diff --git a/msg/InternalCombustionEngineControl.msg b/msg/InternalCombustionEngineControl.msg index 479b325e47..d1ea495998 100644 --- a/msg/InternalCombustionEngineControl.msg +++ b/msg/InternalCombustionEngineControl.msg @@ -1,7 +1,7 @@ uint64 timestamp # time since system start (microseconds) bool ignition_on # activate/deactivate ignition (spark plug) -float32 throttle_control # setpoint for throttle actuator, with slew rate if enabled, idles with 0 [norm] [@range 0,1] +float32 throttle_control # setpoint for throttle actuator, with slew rate if enabled, idles with 0 [norm] [@range 0,1] [@uncontrolled NAN to stop motor] float32 choke_control # setpoint for choke actuator, 1: fully closed [norm] [@range 0,1] float32 starter_engine_control # setpoint for (electric) starter motor [norm] [@range 0,1] diff --git a/src/lib/mixer_module/functions/FunctionICEngineControl.hpp b/src/lib/mixer_module/functions/FunctionICEngineControl.hpp index 0609f5cc94..6888384fce 100644 --- a/src/lib/mixer_module/functions/FunctionICEngineControl.hpp +++ b/src/lib/mixer_module/functions/FunctionICEngineControl.hpp @@ -55,6 +55,7 @@ public: internal_combustion_engine_control_s internal_combustion_engine_control; // map [0, 1] to [-1, 1] which is the interface for non-motor PWM channels + // NAN is mapped to disarmed if (_internal_combustion_engine_control_sub.update(&internal_combustion_engine_control)) { _data[0] = internal_combustion_engine_control.ignition_on * 2.f - 1.f; _data[1] = internal_combustion_engine_control.throttle_control * 2.f - 1.f; diff --git a/src/modules/internal_combustion_engine_control/InternalCombustionEngineControl.cpp b/src/modules/internal_combustion_engine_control/InternalCombustionEngineControl.cpp index eadd2aa46d..33ab49eb32 100644 --- a/src/modules/internal_combustion_engine_control/InternalCombustionEngineControl.cpp +++ b/src/modules/internal_combustion_engine_control/InternalCombustionEngineControl.cpp @@ -291,7 +291,7 @@ void InternalCombustionEngineControl::controlEngineStop() _ignition_on = false; _choke_control = _param_ice_stop_choke.get() ? 1.f : 0.f; _starter_engine_control = 0.f; - _throttle_control = 0.f; + _throttle_control = NAN; // this will set it to the DISARMED value } void InternalCombustionEngineControl::controlEngineFault() @@ -393,6 +393,9 @@ The state machine: - Allows for user inputs from: - Manual control AUX - Arming state in [VehicleStatus.msg](../msg_docs/VehicleStatus.md) +- In the state "Stopped" the throttle is set to NAN, which by definition will set the + throttle output to the disarmed value configured for the specific output. + The module publishes [InternalCombustionEngineControl.msg](../msg_docs/InternalCombustionEngineControl.md).