function
Vehicles.Interfaces.throttlePwmToUnit
Map throttle PWM microseconds to [0, 1]
Public declarations
Explicit source declarations; dimensions, modifications and defaults are shown as written, without evaluation.
| Role | Name | Type | Dimensions / attributes / default | Description |
|---|---|---|---|---|
| input | pwm_us | Real | | |
| output | command | Real | |
Modelica declarations and implementation
Show parameters, interfaces and source
Parameters, inputs, outputs, defaults and equations from the source file.
function throttlePwmToUnit "Map throttle PWM microseconds to [0, 1]"
input Real pwm_us;
output Real command;
algorithm
command := MathUtilities.clip((pwm_us - 1000.0) / 1000.0, 0.0, 1.0);
annotation(Inline = true);
end throttlePwmToUnit;