Skip to content

Commit 34e851c

Browse files
committed
ICE: allow throttle setpoint to be set to NAN to stop motor without disarming
Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
1 parent 1b929a3 commit 34e851c

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

msg/InternalCombustionEngineControl.msg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
uint64 timestamp # time since system start (microseconds)
22

33
bool ignition_on # activate/deactivate ignition (spark plug)
4-
float32 throttle_control # setpoint for throttle actuator, with slew rate if enabled, idles with 0 [norm] [@range 0,1]
4+
float32 throttle_control # setpoint for throttle actuator, with slew rate if enabled, idles with 0 [norm] [@range 0,1] [@uncontrolled NAN to stop motor]
55
float32 choke_control # setpoint for choke actuator, 1: fully closed [norm] [@range 0,1]
66
float32 starter_engine_control # setpoint for (electric) starter motor [norm] [@range 0,1]
77

src/lib/mixer_module/functions/FunctionICEngineControl.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ class FunctionICEControl : public FunctionProviderBase
5555
internal_combustion_engine_control_s internal_combustion_engine_control;
5656

5757
// map [0, 1] to [-1, 1] which is the interface for non-motor PWM channels
58+
// NAN is mapped to disarmed
5859
if (_internal_combustion_engine_control_sub.update(&internal_combustion_engine_control)) {
5960
_data[0] = internal_combustion_engine_control.ignition_on * 2.f - 1.f;
6061
_data[1] = internal_combustion_engine_control.throttle_control * 2.f - 1.f;

src/modules/internal_combustion_engine_control/InternalCombustionEngineControl.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ void InternalCombustionEngineControl::controlEngineStop()
291291
_ignition_on = false;
292292
_choke_control = _param_ice_stop_choke.get() ? 1.f : 0.f;
293293
_starter_engine_control = 0.f;
294-
_throttle_control = 0.f;
294+
_throttle_control = NAN; // this will set it to the DISARMED value
295295
}
296296

297297
void InternalCombustionEngineControl::controlEngineFault()
@@ -393,6 +393,9 @@ The state machine:
393393
- Allows for user inputs from:
394394
- Manual control AUX
395395
- Arming state in [VehicleStatus.msg](../msg_docs/VehicleStatus.md)
396+
- In the state "Stopped" the throttle is set to NAN, which by definition will set the
397+
throttle output to the disarmed value configured for the specific output.
398+
396399
397400
The module publishes [InternalCombustionEngineControl.msg](../msg_docs/InternalCombustionEngineControl.md).
398401

0 commit comments

Comments
 (0)