apply_rules¶
- PWMControl.apply_rules() None
It applies all the
rulesin order to get a validpwmvalue to set to thepowertrain’s motor.It loops over listed
rulesand applies all of them:if a single rule returns a valid
pwm, then this value is set aspowertrain’s motorpwm,if more than a single rule returns a valid
pwm, then it raises aValueError, since multiple rules are valid at the same time and it is not possible to identify whichpwmvalue to use,if no rule returns a valid
pwm, then it setspowertrain’s motorpwmto1.
Before settings the
pwm, its value is saturated in order to be within-1and1.Raises
ValueErrorIf two different rules are applicable at the same time. Only a single applicable rule is allowed to a specific simulation time.