RCPWM does not clip setpoint

I’ve come across a curious fact while investigating a Myxa issue.

Given a (partial) configuration like follows.

aux.ctl.1_rcpwm.deadband: 0.0
aux.ctl.1_rcpwm.rev_mid_fwd: [0.0010, 0.0010, 0.0020]
aux.ctl.dead0: false
aux.ctl.mode: dv 200.0
aux.ctl.type: 1

Running the motor with a PWM setpoint of 2000 µs results in a velocity of 200 rad/s, like expected. A setpoint of 2500 µs, however, results in 300 rad/s, exceeding the configured velocity in aux.ctl.mode.

From the documentation, I would have expected the ratiometric control value to be clipped to [0, +1], or [0, 200] \, \text{rad}/\text{s}.

Turns out this is documented:

The analog signal is not clamped to [-1, +1] or [0, +1] upon projection, and if the input analog signal value is large, the range may be exceeded through linear extrapolation.

My bad :wink:

1 Like