control_allocator: make effective source name a class member

This commit is contained in:
Beat Küng 2021-11-24 10:46:36 +01:00 committed by Daniel Agar
parent 20d96f3bd9
commit 9c767ff1ee
5 changed files with 13 additions and 16 deletions

View File

@ -103,6 +103,11 @@ public:
*/
virtual int numActuators() const = 0;
/**
* Display name
*/
virtual const char *name() const = 0;
protected:
matrix::Vector<float, NUM_ACTUATORS> _trim; ///< Actuator trim
FlightPhase _flight_phase{FlightPhase::HOVER_FLIGHT}; ///< Current flight phase

View File

@ -79,6 +79,8 @@ public:
bool getEffectivenessMatrix(matrix::Matrix<float, NUM_AXES, NUM_ACTUATORS> &matrix, bool force) override;
int numActuators() const override { return _num_actuators; }
const char *name() const override { return "Multirotor"; }
private:
bool _updated{true};
int _num_actuators{0};

View File

@ -59,6 +59,8 @@ public:
void setFlightPhase(const FlightPhase &flight_phase) override;
int numActuators() const override { return 7; }
const char *name() const override { return "Standard VTOL"; }
protected:
bool _updated{true};
};

View File

@ -59,6 +59,8 @@ public:
void setFlightPhase(const FlightPhase &flight_phase) override;
int numActuators() const override { return 10; }
const char *name() const override { return "VTOL Tiltrotor"; }
protected:
bool _updated{true};
};

View File

@ -442,22 +442,8 @@ int ControlAllocator::print_status()
}
// Print current airframe
switch ((EffectivenessSource)_param_ca_airframe.get()) {
case EffectivenessSource::NONE:
PX4_INFO("EffectivenessSource: None");
break;
case EffectivenessSource::MULTIROTOR:
PX4_INFO("EffectivenessSource: MC parameters");
break;
case EffectivenessSource::STANDARD_VTOL:
PX4_INFO("EffectivenessSource: Standard VTOL");
break;
case EffectivenessSource::TILTROTOR_VTOL:
PX4_INFO("EffectivenessSource: Tiltrotor VTOL");
break;
if (_actuator_effectiveness != nullptr) {
PX4_INFO("Effectiveness Source: %s", _actuator_effectiveness->name());
}
// Print current effectiveness matrix