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

Fix inaccurate velocity set-point transformation in FlightTaskOffboard #13373

Conversation

junwoo091400
Copy link
Contributor

@junwoo091400 junwoo091400 commented Nov 4, 2019

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 is VELOCITY_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 :)

@Jaeyoung-Lim
Copy link
Member

Jaeyoung-Lim commented Nov 4, 2019

@junwoo091400 Pleas test this as it is used in a lot of vehicles

@junwoo091400
Copy link
Contributor Author

@Jaeyoung-Lim Will do! Just need to buy some propellers..😂😅

@Jaeyoung-Lim
Copy link
Member

Jaeyoung-Lim commented Nov 4, 2019

@junwoo091400 Are you planning to test offboard on real hardware? A quick test can be done through SITL

@junwoo091400
Copy link
Contributor Author

@Jaeyoung-Lim Oops, Will try that first thing in the morning!!

@junwoo091400
Copy link
Contributor Author

@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 :(

@stale
Copy link

stale bot commented Feb 3, 2020

This issue has been automatically marked as stale because it has not had recent activity. Thank you for your contributions.

@stale stale bot added the stale label Feb 3, 2020
@Jaeyoung-Lim
Copy link
Member

@junwoo091400 Any updates?

@stale
Copy link

stale bot commented May 3, 2020

This issue has been automatically marked as stale because it has not had recent activity. Thank you for your contributions.

@stale stale bot added the stale label May 3, 2020
@julianoes julianoes requested a review from MaEtUgR May 4, 2020 07:34
@stale stale bot removed the stale label May 4, 2020
@stale
Copy link

stale bot commented Aug 2, 2020

This issue has been automatically marked as stale because it has not had recent activity. Thank you for your contributions.

@stale stale bot added the stale label Aug 2, 2020
@junwoo091400
Copy link
Contributor Author

Closing as FlightTaskOffboard is now not present

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants