apply

StartLimitCurrent.apply() None | float | int

It computes the pwm to apply to the motor in order to limit its absorbed electric current to be lower or equal to limit_electric_current, until the encoder’s target rotating object’s angular_position equals the target_angular_position.

Returns

float or int or None

PWM value to apply to the motor in order to limit its absorbed electric current to be lower or equal to limit_electric_current

Notes

It checks the applicability condition, defined as:

\[\theta \le \theta_t\]

where:

  • \(\theta\) is the encoder’s target angular_position,

  • \(\theta_t\) is the target_angular_position.

If the applicability condition is not met, then it returns None, otherwise it computes the pwm as:

\[D \left( \dot{\theta} \right) = \frac{1}{2} \, \left( \frac{\dot{\theta}}{\dot{\theta}_0} + \frac{i_{lim}}{i_{max}} + \sqrt{ \left( \frac{\dot{\theta}}{\dot{\theta}_0} \right)^2 + \left( \frac{i_{lim}}{i_{max}} \right)^2 + 2 \frac{\dot{\theta}}{\dot{\theta}_0} \frac{i_{lim} - 2 i_0}{i_{max}} } \right)\]

where: