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

WIP: Manual attitude setpoint for large heading errors #4564

Merged
merged 3 commits into from
May 19, 2016
Merged

Conversation

RomanBapst
Copy link
Contributor

@RomanBapst RomanBapst commented May 17, 2016

mc pos control: In manual mode calculate attitude setpoint such that it reflects the users intuition of roll and pitch for any given heading error.

TODO:

  • extensive testing in SITL
  • testing on real multicopter
  • review
  • add comments to code

Fixes #4556
Fixes #3620

@RomanBapst
Copy link
Contributor Author

RomanBapst commented May 18, 2016

A good way to test this:

  1. Comment this line https://github.com/PX4/Firmware/blob/master/src/modules/mc_pos_control/mc_pos_control_main.cpp#L1982

  2. Assign any value between -pi and pi to _att_sp.yaw_body here https://github.com/PX4/Firmware/blob/master/src/modules/mc_pos_control/mc_pos_control_main.cpp#L1979
    e.g. add

_att_sp.yaw_body = -0.9f;
  1. Disable absolute yaw control by commenting this line https://github.com/PX4/Firmware/blob/master/src/modules/mc_att_control/mc_att_control_main.cpp#L708

By doing the above steps the copter will no longer have absolute yaw control but you can still make it turn in yaw since there is a FF on the rates. In this situation you can produce an arbitrary yaw error and verify that roll and pitch commands match the users intuition.

@RomanBapst RomanBapst self-assigned this May 18, 2016
@RomanBapst
Copy link
Contributor Author

Log where absolute yaw control was disabled -> arbitrary high yaw error: User was still able to control roll and pitch as he expected:
http://logs.uaventure.com/view/svVXALTKZbkZbCwuyD37v8

Log where absolute yaw control was enabled
http://logs.uaventure.com/view/fBnVjFEUm9BJf6Mmhr9zhX

@LorenzMeier
Copy link
Member

@Tumbili The logic looks right, but I would like to clarify if the only derivation we can choose is through the proposed mix of euler angles, quaternions, trigonometric functions and rotation matrices. It would be good to have a second pass and see if we can't express this more compact using entries of a rotation matrix. I'm concerned that while we fix the common yaw case we might miss extreme angles, in particular for racers.

Roman and others added 3 commits May 19, 2016 13:16
@RomanBapst
Copy link
Contributor Author

@LorenzMeier Tested in SITL and the behaviour is exactly the same. Maybe I can try to add even better comments.

@LorenzMeier
Copy link
Member

Looks good, thanks!

@LorenzMeier LorenzMeier merged commit 02ba331 into master May 19, 2016
@LorenzMeier LorenzMeier deleted the pr-manAttSp branch May 19, 2016 13:28
LorenzMeier pushed a commit that referenced this pull request May 19, 2016
* mc pos control: in manual mode calculate attitude setpoint
such that it reflects the users intuition of roll and pitch
for any given heading error

* added some comments on the new manual attitude setpoint generation

* make calculation shorter
@LorenzMeier
Copy link
Member

Thanks for the quick fix of this issue, I'm sure a lot of users will really appreciate it. I've back ported this to master.

RomanBapst pushed a commit to RomanBapst/Firmware that referenced this pull request Feb 2, 2017
* mc pos control: in manual mode calculate attitude setpoint
such that it reflects the users intuition of roll and pitch
for any given heading error

* added some comments on the new manual attitude setpoint generation

* make calculation shorter
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.

2 participants