forked from Archive/PX4-Autopilot
Rovers: stop motors when commanding zero speed
This commit is contained in:
parent
4ff03e4a06
commit
d0d113405a
|
@ -45,7 +45,15 @@ ActuatorEffectivenessRoverAckermann::getEffectivenessMatrix(Configuration &confi
|
||||||
}
|
}
|
||||||
|
|
||||||
configuration.addActuator(ActuatorType::MOTORS, Vector3f{}, Vector3f{1.f, 0.f, 0.f});
|
configuration.addActuator(ActuatorType::MOTORS, Vector3f{}, Vector3f{1.f, 0.f, 0.f});
|
||||||
|
_motors_mask = 1u << 0;
|
||||||
configuration.addActuator(ActuatorType::SERVOS, Vector3f{0.f, 0.f, 1.f}, Vector3f{});
|
configuration.addActuator(ActuatorType::SERVOS, Vector3f{0.f, 0.f, 1.f}, Vector3f{});
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ActuatorEffectivenessRoverAckermann::updateSetpoint(const matrix::Vector<float, NUM_AXES> &control_sp,
|
||||||
|
int matrix_index, ActuatorVector &actuator_sp, const matrix::Vector<float, NUM_ACTUATORS> &actuator_min,
|
||||||
|
const matrix::Vector<float, NUM_ACTUATORS> &actuator_max)
|
||||||
|
{
|
||||||
|
stopMaskedMotorsWithZeroThrust(_motors_mask, actuator_sp);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,6 +43,11 @@ public:
|
||||||
|
|
||||||
bool getEffectivenessMatrix(Configuration &configuration, EffectivenessUpdateReason external_update) override;
|
bool getEffectivenessMatrix(Configuration &configuration, EffectivenessUpdateReason external_update) override;
|
||||||
|
|
||||||
|
void updateSetpoint(const matrix::Vector<float, NUM_AXES> &control_sp, int matrix_index,
|
||||||
|
ActuatorVector &actuator_sp, const matrix::Vector<float, NUM_ACTUATORS> &actuator_min,
|
||||||
|
const matrix::Vector<float, NUM_ACTUATORS> &actuator_max) override;
|
||||||
|
|
||||||
const char *name() const override { return "Rover (Ackermann)"; }
|
const char *name() const override { return "Rover (Ackermann)"; }
|
||||||
private:
|
private:
|
||||||
|
uint32_t _motors_mask{};
|
||||||
};
|
};
|
||||||
|
|
|
@ -46,6 +46,14 @@ ActuatorEffectivenessRoverDifferential::getEffectivenessMatrix(Configuration &co
|
||||||
|
|
||||||
configuration.addActuator(ActuatorType::MOTORS, Vector3f{0.f, 0.f, 0.5f}, Vector3f{0.5f, 0.f, 0.f});
|
configuration.addActuator(ActuatorType::MOTORS, Vector3f{0.f, 0.f, 0.5f}, Vector3f{0.5f, 0.f, 0.f});
|
||||||
configuration.addActuator(ActuatorType::MOTORS, Vector3f{0.f, 0.f, -0.5f}, Vector3f{0.5f, 0.f, 0.f});
|
configuration.addActuator(ActuatorType::MOTORS, Vector3f{0.f, 0.f, -0.5f}, Vector3f{0.5f, 0.f, 0.f});
|
||||||
|
_motors_mask = (1u << 0) | (1u << 1);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ActuatorEffectivenessRoverDifferential::updateSetpoint(const matrix::Vector<float, NUM_AXES> &control_sp,
|
||||||
|
int matrix_index, ActuatorVector &actuator_sp, const matrix::Vector<float, NUM_ACTUATORS> &actuator_min,
|
||||||
|
const matrix::Vector<float, NUM_ACTUATORS> &actuator_max)
|
||||||
|
{
|
||||||
|
stopMaskedMotorsWithZeroThrust(_motors_mask, actuator_sp);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,6 +43,11 @@ public:
|
||||||
|
|
||||||
bool getEffectivenessMatrix(Configuration &configuration, EffectivenessUpdateReason external_update) override;
|
bool getEffectivenessMatrix(Configuration &configuration, EffectivenessUpdateReason external_update) override;
|
||||||
|
|
||||||
|
void updateSetpoint(const matrix::Vector<float, NUM_AXES> &control_sp, int matrix_index,
|
||||||
|
ActuatorVector &actuator_sp, const matrix::Vector<float, NUM_ACTUATORS> &actuator_min,
|
||||||
|
const matrix::Vector<float, NUM_ACTUATORS> &actuator_max) override;
|
||||||
|
|
||||||
const char *name() const override { return "Rover (Differential)"; }
|
const char *name() const override { return "Rover (Differential)"; }
|
||||||
private:
|
private:
|
||||||
|
uint32_t _motors_mask{};
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue