apply¶
- ReachAngularPosition.apply() None | float | int
It computes the
pwmto apply to thepowertrain’s DC motor in order to reach atarget_angular_positionby thetargetrotating object of theencoder, within a specificbraking_angle.Returns¶
Notes
The braking angle is the angle within which the motor’s
pwmis controlled in order to brake and reach thetarget_angular_position.The rule is applied only if the difference between
target_angular_positionand theencoder’s targetangular_positionis lower than or equal to thebraking_angle.The lower the
braking_anglethe higher the deceleration of the system, thus the higher the vibrations produced.First of all, the rule computes the
powertrain’s static error according to the following formula:\[\theta_{err} \left( T_l \right) = \frac{T_l}{T_{max}} \, \frac{\theta_b}{\eta_t}\]where:
\(\theta_{err}\) is the
powertrainstatic error,\(T_l\) is the load torque on the
powertrainDC motor (DCMotor.load_torque),\(T_{max}\) is the maximum torque developed by the
powertrainDC motor (DCMotor.maximum_torque),\(\theta_b\) is the
braking_angleparameter,\(\eta_t\) is the
powertrainoverall efficiency, computed as:
\[\eta_t = \prod_{i = 1}^N \eta_i\]where:
\(\eta_i\) is the mechanical mating efficiency of the mating between two gears (
SpurGear.master_gear_efficiencyorHelicalGear.master_gear_efficiencyorWormGear.master_gear_efficiencyorWormWheel.master_gear_efficiency),\(N\) is the total number of gear matings in the
powertrain.
Then it checks the applicability condition, defined as:
\[\theta \ge \theta_s = \theta_t - \theta_b + \theta_{err}\]where:
\(\theta\) is the
encoder’stargetangular_position,\(\theta_s\) is the braking starting angle,
\(\theta_t\) is the
target_angular_positionparameter.
If the applicability condition is not met, then it returns
None, otherwise it computes thepwmas:\[D \left( \theta \right) = 1 - \frac{\theta - \theta_s}{\theta_b}\]where \(D\) is the supply voltage PWM duty cycle
pwmto apply to the DC motor in order to reach thetarget_angular_positionby theencoder’stargetrotating object.