PX4-Autopilot icon indicating copy to clipboard operation
PX4-Autopilot copied to clipboard

[RFC]: Add attitude reference model

Open KonradRudin opened this issue 2 years ago • 3 comments

Solved Problem

For tracking a POI with a camera, the attitude changes should be smooth and not exceed certain limits for the gimbal to be able to continuously track it. Also it is preferred in general to have a smooth signal when transitioning between modes. Be aware that tuning it properly can be an issue, since it can interact with the navigation control (npfg/tecs) in the feedback loop. Thus it is in general disabled and can be enabled for roll and pitch independently.

This PR is ready now for comments and proposing changes.

Solution

  • An attitude reference model is introduced for roll and pitch reference in fixed wing vehicle mode, consisting of a second order filter with velocity and acceleration limiting. As such, the roll and pitch behavior can be defined and constrained.
  • The reference model is active for all auto fixed wing modes except starting/landing where direct attitude control might be preferred. Also for future mode, one can decide, if the reference model should be used or not by publishing the respective uORB topic.

Changelog Entry

For release notes:

Feature: Attitude reference model for fixed wing

Test coverage

  • Unit/integration test: ...
  • Simulation/hardware testing logs: https://review.px4.io/

Context

Related links, screenshot before/after, video

KonradRudin avatar Dec 04 '23 08:12 KonradRudin

Here's an abandoned PR for multicopter attitude reference. https://github.com/PX4/PX4-Autopilot/pull/21153 @bresch is there any relevant context worth sharing?

dagar avatar Dec 04 '23 14:12 dagar

One of the reasons why I didn't continue my PR is because I think the 2nd order reference model should be at the rate level and not the attitude. In fact, looking at the open-loop longitudinal dynamics of a plane, the dominant dynamics (relevant here) come from the short-period mode, which usually matches a 2nd order system really well. Also, the closed-loop rate dynamics normally follow a 2nd order system while the attitude closed-loop response looks much more like a 1st order system (where 1/P is the time constant). Another argument would be that having a 2nd order reference model on the rate loop makes the architecture more modular as the rate response could be tuned separately from the attitude loop (1. tune rate loop, 2. set rate reference model, 3. tune attitude loop, 4. set attitude reference model). Furthermore the attitude response is usually tuned to be critically or over-damped, which can be achieved by a 1st order model.

One counter-argument to my proposal is that having a rate reference model affects the attitude loop. However, this also ensures that direct rate inputs/feedforwards or attitude disturbances are not able to reach the rate loop unfiltered.

bresch avatar Dec 04 '23 16:12 bresch

One of the reasons why I didn't continue my PR is because I think the 2nd order reference model should be at the rate level and not the attitude. In fact, looking at the open-loop longitudinal dynamics of a plane, the dominant dynamics (relevant here) come from the short-period mode, which usually matches a 2nd order system really well. Also, the closed-loop rate dynamics normally follow a 2nd order system while the attitude closed-loop response looks much more like a 1st order system (where 1/P is the time constant). Another argument would be that having a 2nd order reference model on the rate loop makes the architecture more modular as the rate response could be tuned separately from the attitude loop (1. tune rate loop, 2. set rate reference model, 3. tune attitude loop, 4. set attitude reference model). Furthermore the attitude response is usually tuned to be critically or over-damped, which can be achieved by a 1st order model.

One counter-argument to my proposal is that having a rate reference model affects the attitude loop. However, this also ensures that direct rate inputs/feedforwards or attitude disturbances are not able to reach the rate loop unfiltered.

@bresch We also thought about adding the reference model on the rate level instead of the attitude level. But we decided against since we think it is easier for a user the define the reference model on defining the attitude behavior. Also, i don't think we need to have a complete aerodynamics model including the short-period mode as i do not want to make a complete dynamics inversion. The simple second order model fits the control architecture with separated attitude/attitude rate controller and control allocation and can thus easily use some feedforward for thee control architecture.

KonradRudin avatar Dec 18 '23 08:12 KonradRudin

Closing this. The advantages of have feedforward terms and the second order model does not improve the situation that much compared to the slew rate limiting in the fixed wing position controller. So the added complexity is not worth it ATM.

KonradRudin avatar Feb 05 '25 14:02 KonradRudin