SET_ATTITUDE_TARGET doesn't persist

In Mavproxy with a SITL airplane in Guided mode, I send a SET_ATTITUDE_TARGET command.
As a result, the airplane changes to the specified attitude - but only for a short period after which it returns to whatever it was doing before the command was entered.
For example, if SET_ATTITUDE_TARGET was entered when flying to a waypoint, it would change the attitude, but 2 seconds later adjust the course back towards the waypoint. I was expecting SET_ATTITUDE_TARGET to override the mission (as it’s the last command entered).
The same thing happens when it’s simply flying a circular wait pattern in Guided mode. Upon entering the SET_ATTITUDE_TARGET command, it would change the attitude for 2 seconds and then return to the doing the wait pattern.

What was the motivation behind such an implementation ?
How can I make the airplane hold the attitude specified in the command ?

The actual threshold is 3 seconds and it’s hardcoded (#1, #2, #3). I don’t know exact motivation behind this (I hope authors reveal it) but I assume it’s kind of failsafe behaviour – return to the last waypoint if there are no guided commands appear.

1 Like

Thanks a lot for pointing me to the code !
If I change this value to be VERY high, would this cause the vehicle to maintain attitude until a different message is received ?

Sorry, I’m not sure I follow what value you intend to change. Do you mean the SET_ATTITUDE_TARGET command sending rate?

Oh, I would not recommend you to change it unless you have a really good reason to do this. I think it may imbalance other parts of the stack. Why just not to simply send SET_ATTITUDE_TARGET with a higher rate (10Hz) from your guidance code?

1 Like