LibrePilot Forum

Users => Vehicles - MultiRotors => Topic started by: fboriero on May 08, 2018, 11:38:32 am

Title: Reference/execution error
Post by: fboriero on May 08, 2018, 11:38:32 am
Hi!
I am trying to send an attitude trajectory (pitch in degrees)  to my small quad. In the attached picture you can see the planned trajectory (blu line) and the trajectory executed and measured using an external tracking system (orange line).

The Flight mode is: "Attitude, Attitude, Rate, CruiseControl".

Do you have any suggestions on how I can handle this problem?

Thanks
Fabrizio
Title: Re: Reference/execution error
Post by: f5soh on May 08, 2018, 12:05:13 pm
If you send at some point a 10° pitch max you should not measure a 35° bank angle result.
Seems there is another parameter/calc sent introducing the error.
You can monitor the Attitude state from Fc, you will see similar error...
Try setting the Attitude response to 10° in Stabilization settings, you should not see the error because FC limit bank angle.
Title: Re: Reference/execution error
Post by: fboriero on May 08, 2018, 03:36:41 pm
Thanks a lot for your reply...

Another question:
When I call:
Code: [Select]
manualControlCommand->getField("Pitch")->setDouble(pitch);

What is the expected input?
Title: Re: Reference/execution error
Post by: mr_w on May 08, 2018, 04:44:07 pm
It should be (remote control) stick deflection within range -1, 1
Title: Re: Reference/execution error
Post by: fboriero on May 09, 2018, 05:03:10 pm
Yes, you are right! I changed the control input in a range [-1,1] and it runs!

Is there a better way to send a reference pitch angle to the attitude controller?
How can I change the maximum angle?

Thanks again
Title: Re: Reference/execution error
Post by: f5soh on May 09, 2018, 06:17:10 pm
Attitude response can be set in Config > Stabilization tab (https://librepilot.atlassian.net/wiki/spaces/LPDOC/pages/19890317/Attitude+Setup#AttitudeSetup-Settings)
If you set the Attitude response to 50°, a full command send -/+1 results in -/+50° bank angle or -/+0.5 equals to -/+25°
Title: Re: Reference/execution error
Post by: mr_w on May 10, 2018, 02:08:07 am
If you want to control the desired attitude rather than to mimic remote control unit, you will need to manipulate StabilizationDesired UAVO instead of ManualControlCommand.

But, you also need to set its "flight side" to read-only via its metadata (I truly believe there are examples on how to do it), so that internal manualcontrol path will not override your changes.



More detailed description is something like this (control flow):

1. (receiver) -> ManualControlCommand

2a. (manualcontrol/manualhandler.c) ManualControlCommand -> ActuatorDesired -> jump to #5

2b. (manualcontrol/stabilizedhandler.c) ManualControlCommand -> StabilizationDesired

3. (stabilization/outerloop.c) StabilizationDesired -> RateDesired

4. (stabilization/innerloop.c) RateDesired -> ActuatorDesired

5. (actuator/actuator.c) ActuatorDesired -> Mixer -> ActuatorCommand