Reference/execution error
« 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

f5soh

  • *****
  • 4445
    • LibrePilot
Re: Reference/execution error
« Reply #1 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.

Re: Reference/execution error
« Reply #2 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?

mr_w

  • *
  • 207
    • LibrePilot
Re: Reference/execution error
« Reply #3 on: May 08, 2018, 04:44:07 pm »
It should be (remote control) stick deflection within range -1, 1

Re: Reference/execution error
« Reply #4 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

f5soh

  • *****
  • 4445
    • LibrePilot
Re: Reference/execution error
« Reply #5 on: May 09, 2018, 06:17:10 pm »
Attitude response can be set in Config > Stabilization tab
If you set the Attitude response to 50°, a full command send -/+1 results in -/+50° bank angle or -/+0.5 equals to -/+25°

mr_w

  • *
  • 207
    • LibrePilot
Re: Reference/execution error
« Reply #6 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