Browse Source

control_allocator: make effective source name a class member

master
Beat Küng 3 years ago committed by Daniel Agar
parent
commit
9c767ff1ee
  1. 5
      src/modules/control_allocator/ActuatorEffectiveness/ActuatorEffectiveness.hpp
  2. 2
      src/modules/control_allocator/ActuatorEffectiveness/ActuatorEffectivenessMultirotor.hpp
  3. 2
      src/modules/control_allocator/ActuatorEffectiveness/ActuatorEffectivenessStandardVTOL.hpp
  4. 2
      src/modules/control_allocator/ActuatorEffectiveness/ActuatorEffectivenessTiltrotorVTOL.hpp
  5. 18
      src/modules/control_allocator/ControlAllocator.cpp

5
src/modules/control_allocator/ActuatorEffectiveness/ActuatorEffectiveness.hpp

@ -103,6 +103,11 @@ public: @@ -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

2
src/modules/control_allocator/ActuatorEffectiveness/ActuatorEffectivenessMultirotor.hpp

@ -79,6 +79,8 @@ public: @@ -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};

2
src/modules/control_allocator/ActuatorEffectiveness/ActuatorEffectivenessStandardVTOL.hpp

@ -59,6 +59,8 @@ public: @@ -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};
};

2
src/modules/control_allocator/ActuatorEffectiveness/ActuatorEffectivenessTiltrotorVTOL.hpp

@ -59,6 +59,8 @@ public: @@ -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};
};

18
src/modules/control_allocator/ControlAllocator.cpp

@ -442,22 +442,8 @@ int ControlAllocator::print_status() @@ -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

Loading…
Cancel
Save