Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added python example to read offbaord position setpoints from a csv file #600

Merged
merged 8 commits into from
Jun 4, 2023

Conversation

alireza787b
Copy link
Contributor

This PR introduces a new Python example that demonstrates how to perform offboard control with position setpoints read from a CSV file. This example can be useful for developers who want to design complex maneuvers for their drones using pre-calculated trajectories.

The new example, located in the examples/from_csv folder, includes the following features:

A script (offboard_from_csv.py) that reads position, velocity, and acceleration setpoints from a CSV file and sends these setpoints to a connected drone in offboard mode.
A well-documented codebase, explaining each part of the code in detail, the structure of the CSV file, and the meaning of different mode codes used in the script.
A plotted image of the trajectory, providing a visual representation of the intended path of the drone.

In addition, If you remember last week, I added function for the set_position_velocity_acceleration_ned function to the MAVSDK with your great supportive help now that it is merged I decided to add an exmaple so people know how to use it.
However, as of May 2023, this function is not available in the default MAVSDK-Python installation via pip3. For this reason, I've currently commented out the section of code using this function in the example script.

The example is designed in such a way that users can easily uncomment this section and switch to set_position_velocity_acceleration_ned when it becomes available in the default installation. This will allow the users to input acceleration setpoints in addition to position and velocity.

I look forward to your feedback and am open to making any necessary changes.

@alireza787b alireza787b changed the title added python example to read offbaord position setpoints from a csv f… added python example to read offbaord position setpoints from a csv file Jun 1, 2023
@julianoes
Copy link
Collaborator

Amazing, that's very cool, thanks for that!

As soon as MAVSDK 2 is out we will have the new offboard API and can adapt this.

Copy link
Collaborator

@julianoes julianoes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is nice and clear.

Just please fix the issues pycodestyle has:
https://github.com/mavlink/MAVSDK-Python/actions/runs/5145846010/jobs/9270623388?pr=600

And then I'll merge it.

JonasVautherin
JonasVautherin previously approved these changes Jun 2, 2023
Copy link
Collaborator

@JonasVautherin JonasVautherin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pretty cool!

updated white spaces and long line length
@alireza787b
Copy link
Contributor Author

thanks
such strict style rules:)
I fixed them and committed to the branch now.

by the way. What is mavsdk 2? an update to the current system? I haven't heard of it

@julianoes
Copy link
Collaborator

MAVSDK 2 is basically the main branch of MAVSDK.

Also see: mavlink/MAVSDK#2002

@julianoes julianoes merged commit 4a56fe6 into mavlink:main Jun 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants