mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-19 10:33:35 +08:00
uavcan: esc: fix uavcan ESC control
This fixes a number of issues with uavcan ESC control. - Motor Testing when using a CANnode as a PWM expander now works by allowing the FunctionMotors class to perform prearm control - The esc.RawCommand message is now always published for configured uavcan ESC outputs. Previously prior to arming the message would be published empty, which causes certain ESCs to enter an error state. - Useless and redundant code has been removed and small name changes have been applied.
This commit is contained in:
@@ -68,7 +68,11 @@ public:
|
||||
|
||||
float value(OutputFunction func) override { return _data.control[(int)func - (int)OutputFunction::Motor1]; }
|
||||
|
||||
#if defined(CONFIG_DRIVERS_UAVCANNODE)
|
||||
bool allowPrearmControl() const override { return true; }
|
||||
#else
|
||||
bool allowPrearmControl() const override { return false; }
|
||||
#endif
|
||||
|
||||
uORB::SubscriptionCallbackWorkItem *subscriptionCallback() override { return &_topic; }
|
||||
|
||||
|
||||
@@ -541,8 +541,6 @@ uint16_t MixingOutput::output_limit_calc_single(int i, float value) const
|
||||
void
|
||||
MixingOutput::output_limit_calc(const bool armed, const int num_channels, const float output[MAX_ACTUATORS])
|
||||
{
|
||||
const bool pre_armed = armNoThrottle();
|
||||
|
||||
// time to slowly ramp up the ESCs
|
||||
static constexpr hrt_abstime RAMP_TIME_US = 500_ms;
|
||||
|
||||
@@ -589,7 +587,7 @@ MixingOutput::output_limit_calc(const bool armed, const int num_channels, const
|
||||
*/
|
||||
auto local_limit_state = _output_state;
|
||||
|
||||
if (pre_armed) {
|
||||
if (isPrearmed()) {
|
||||
local_limit_state = OutputLimitState::ON;
|
||||
}
|
||||
|
||||
|
||||
@@ -209,7 +209,7 @@ protected:
|
||||
|
||||
private:
|
||||
|
||||
bool armNoThrottle() const
|
||||
bool isPrearmed() const
|
||||
{
|
||||
return (_armed.prearmed && !_armed.armed) || _armed.in_esc_calibration_mode;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user