-
Notifications
You must be signed in to change notification settings - Fork 13.6k
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
Enable support for global position setpoints with SET_POSITION_TARGET_GLOBAL_INT #12819
Enable support for global position setpoints with SET_POSITION_TARGET_GLOBAL_INT #12819
Conversation
276e52e
to
07b79e4
Compare
Just a reminder to update http://docs.px4.io/master/en/flight_modes/offboard.html when this goes in. I assume this only really affects offboard mode? |
@hamishwillee Ofcourse! I will prepare a PR for the docs. Yes it only affects offboard mode |
Thanks @Jaeyoung-Lim . Not everyone "remembers" docs. I'm pleased you do. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome! These small fixes are so critical to keep adopters happy.
Please have a quick look at the CI failures |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this! I made some comments how I think this could be improved.
Also, it would be nice to add an integration test to MAVSDK to test it.
Co-Authored-By: Julian Oes <[email protected]>
Co-Authored-By: Julian Oes <[email protected]>
984cca2
to
07e944f
Compare
@julianoes I would be interested in adding the unit tests to mavsdk. Could you provide any pointers? |
@Jaeyoung-Lim that would be great. Actually, MAVSDK doesn't support global position offboard yet, so it would have to be added there as well, like the implementation for local position: And then a test would look like this: |
@julianoes Thanks for the pointers! |
@julianoes Could we merge this since the documentation has been updated already? I would prefer making the improvements regarding the indentation and logic together with the message handling of |
@Jaeyoung-Lim absolutely! |
@Jaeyoung-Lim are you open to add support for this on the MAVROS |
@TSC21 Thanks for the suggestions! I would be interested to add support on MAVROS. I was super confused with that plugin when I was trying to use global setpoints on mavros for that reason(hence, this PR). Could you explain on why we would want to use |
@TSC21 Ah I misunderstood what you were saying. So I should replace the current callback to the |
@Jaeyoung-Lim what I am saying is that inside the |
Also |
Describe problem solved by the proposed pull request
Currently offboard position setpoints can only be passed in local coordinates with
SET_POSITION_TARGET_LOCAL_NED
. However, when running multiple vehicles at the same time, this is not scalable as setpoints need to be transformed to each vehicle's local frame.Also, there has been a lot of workarounds for external applications to use global coordinates and converting it to local coordinates to just enable offboard mode.
Fixes #11625
Describe your preferred solution
Added a message handler in mavlinkreceiver for
SET_POSITION_TARGET_GLOBAL_INT
which converts the setpoint to local coordinates.Test data / coverage
This log shows the vehicle position being set to altitude of 12m with the same lon / lat with the home position.
I have also tested with multiple vehicles flying in a circular pattern: https://youtu.be/tj3FcbmsVpw
Additional context
Tools such as mavros convert global position setpoints into local coordinates as a workaround. There has been confusion from
mavros
users of px4 not supporting this message(mavlink/mavros#1256, mavlink/mavros#903, mavlink/mavros#728 )