-
Notifications
You must be signed in to change notification settings - Fork 13.7k
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
Fix inaccurate velocity set-point transformation in FlightTaskOffboard #13373
Fix inaccurate velocity set-point transformation in FlightTaskOffboard #13373
Conversation
@junwoo091400 Pleas test this as it is used in a lot of vehicles |
@Jaeyoung-Lim Will do! Just need to buy some propellers..😂😅 |
@junwoo091400 Are you planning to test offboard on real hardware? A quick test can be done through SITL |
@Jaeyoung-Lim Oops, Will try that first thing in the morning!! |
@Jaeyoung-Lim Currently having some problems setting up SITL on Ubuntu on top of Windows (WSL). jMAVSim didn't work, due to it being 'mounted' on WSL. Trying Gazebo :( |
This issue has been automatically marked as stale because it has not had recent activity. Thank you for your contributions. |
@junwoo091400 Any updates? |
This issue has been automatically marked as stale because it has not had recent activity. Thank you for your contributions. |
This issue has been automatically marked as stale because it has not had recent activity. Thank you for your contributions. |
Closing as FlightTaskOffboard is now not present |
Describe problem solved by this pull request
Previous code 'assumed' that the craft is parallel to the ground(pitch / roll = 0), when transforming velocity set-point from body-frame to local-frame(NED) for Offboard velocity setpoint control in Body-Frame. Thus, in most cases, if this was used, previously, velocity set-point was over-calculated(because of neglecting pitch / roll).
Describe your solution
By taking into account the craft's 'attitude', Rotation matrix will transform the Velocity set-point, if it is needed, i.e.
if(_sub_triplet_setpoint.get().current.velocity_frame == position_setpoint_s::VELOCITY_FRAME_BODY_NED) && (velocity_ctrl_xy || velocity_ctrl_z)
Describe possible alternatives
This is a pretty simple logic issue. So I guess there is no 'alternative'?
Test data / coverage
Not tested :(.
Additional context
origin of discussion : Handle velocity frames correctly for rover offboard velocity control #13363 comment section.
I thought about the best way to implement this, as this calculation isn't always needed, so I finally settled on creating a local variable
vel_setpoint_local
, and perform the calculation only if the setpoint frame isVELOCITY_FRAME_BODY_NED
. Also, because the velocity setpoints can be 'invalid', I also took that into account, basically Zero-ing the values(Velocity), if it's not valid.Any inputs / feedbacks are welcome! I'm a newbie in PX4, so I definitely want to learn from more experienced developers :)