MC mixer: replace multirotor_motor_limits by control_allocator_status

CA: fix saturation computation
Since the CA matrix is normalized, the same scale applied to be used when using the effectiveness matrix

MCRateControl: use control_allocator_status to get saturation info
This commit is contained in:
bresch
2021-11-03 16:56:33 +01:00
committed by Daniel Agar
parent dd83ef1813
commit d47f9f155a
17 changed files with 115 additions and 71 deletions
@@ -75,7 +75,7 @@
class ControlAllocation
{
public:
ControlAllocation() = default;
ControlAllocation() { _control_allocation_scale.setAll(1.f); }
virtual ~ControlAllocation() = default;
static constexpr uint8_t NUM_ACTUATORS = 16;
@@ -190,6 +190,11 @@ public:
*/
void clipActuatorSetpoint(matrix::Vector<float, NUM_ACTUATORS> &actuator) const;
/**
* Compute the amount of allocated control thrust and torque
*/
void updateControlAllocated();
/**
* Normalize the actuator setpoint between minimum and maximum values.
*
@@ -208,6 +213,7 @@ public:
protected:
matrix::Matrix<float, NUM_AXES, NUM_ACTUATORS> _effectiveness; //< Effectiveness matrix
matrix::Vector<float, NUM_AXES> _control_allocation_scale; //< Scaling applied during allocation
matrix::Vector<float, NUM_ACTUATORS> _actuator_trim; //< Neutral actuator values
matrix::Vector<float, NUM_ACTUATORS> _actuator_min; //< Minimum actuator values
matrix::Vector<float, NUM_ACTUATORS> _actuator_max; //< Maximum actuator values