mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-06-29 12:10:35 +08:00
control_allocator: limit status publication rate to 200Hz
Reduces CPU load by ~3.5% on F4 @2khz. And compute getAllocatedControl as needed (~1.5% CPU reduction)
This commit is contained in:
@@ -132,7 +132,8 @@ public:
|
||||
*
|
||||
* @return Control vector
|
||||
*/
|
||||
const matrix::Vector<float, NUM_AXES> &getAllocatedControl() const { return _control_allocated; }
|
||||
matrix::Vector<float, NUM_AXES> getAllocatedControl() const
|
||||
{ return (_effectiveness * _actuator_sp).emult(_control_allocation_scale); }
|
||||
|
||||
/**
|
||||
* Get the control effectiveness matrix
|
||||
@@ -189,11 +190,6 @@ 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.
|
||||
*
|
||||
@@ -218,7 +214,6 @@ protected:
|
||||
matrix::Vector<float, NUM_ACTUATORS> _actuator_max; //< Maximum actuator values
|
||||
matrix::Vector<float, NUM_ACTUATORS> _actuator_sp; //< Actuator setpoint
|
||||
matrix::Vector<float, NUM_AXES> _control_sp; //< Control setpoint
|
||||
matrix::Vector<float, NUM_AXES> _control_allocated; //< Allocated control
|
||||
matrix::Vector<float, NUM_AXES> _control_trim; //< Control at trim actuator values
|
||||
int _num_actuators{0};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user