MicroPython EvoMotorPair#
- class evo.EvoMotorPair(m1, m2)#
Native synchronized two-motor drive helper.
m1andm2must beevo.EvoMotorinstances. Constructor returns a new pair object.
Motion Profile
- EvoMotorPair.setStartSpeed(speed)#
Set the starting ramp speed. Negative values are stored as their absolute value. Returns
None.
- EvoMotorPair.setEndSpeed(speed)#
Set the ending ramp speed. Negative values are stored as their absolute value. Returns
None.
- EvoMotorPair.setAcceleration(acceleration)#
Set acceleration in degrees-per-second style units used by profiled moves. Negative values are stored as their absolute value. Returns
None.
- EvoMotorPair.getAcceleration()#
Return the configured acceleration as an integer.
- EvoMotorPair.setDeceleration(deceleration)#
Set deceleration for profiled moves. Negative values are stored as their absolute value. Returns
None.
- EvoMotorPair.getDeceleration()#
Return the configured deceleration as an integer.
- EvoMotorPair.setAccelerationProfile(profile)#
Select
evo.ACCEL_NONE,evo.ACCEL_TRAPEZOIDorevo.ACCEL_SCURVE. ReturnsNone.
- EvoMotorPair.getAccelerationProfile()#
Return the current acceleration profile constant.
Synchronisation
- EvoMotorPair.setStopBehaviour(behaviour)#
- EvoMotorPair.setStopBehavior(behaviour)#
Set the default stop behaviour to
evo.COAST,evo.BRAKEorevo.HOLD. ReturnsNone.
- EvoMotorPair.setSyncPID(kp, ki, kd)#
Set integer PID gains used to keep both motors synchronized during profiled moves. Returns
None.
- EvoMotorPair.getSyncPID()#
Return
(kp, ki, kd)as a tuple.
Movement
- EvoMotorPair.move(left_dps, right_dps)#
- EvoMotorPair.moveSpeed(left_dps, right_dps)#
Start continuous speed-control movement for both motors.
move()is an alias ofmoveSpeed(). ReturnsNone.
- EvoMotorPair.movePower(left_power, right_power)#
Drive both motors using raw PWM power. Returns
None.
- EvoMotorPair.moveDegrees(left_dps, right_dps, degrees, stopBehavior=None)#
- EvoMotorPair.runDegrees(left_dps, right_dps, degrees, stopBehavior=None)#
Run both motors for an encoder distance and stop using
stopBehavioror the pair default. ReturnsNone.
- EvoMotorPair.moveTime(left_dps, right_dps, time_ms, slowdown_ms=200, stopBehavior=None)#
Run both motors for
time_msmilliseconds, optionally slowing during the finalslowdown_msmilliseconds. RaisesValueErroriftime_msis negative. ReturnsNone.
State
- EvoMotorPair.hold()#
- EvoMotorPair.brake()#
- EvoMotorPair.coast()#
Stop both motors using the named stop mode. Returns
None.
- EvoMotorPair.stop(stopBehavior=evo.BRAKE)#
Stop both motors immediately using the supplied behaviour. Returns
None.
- EvoMotorPair.resetAngle()#
Reset both motor angle references to zero. Returns
None.
- EvoMotorPair.isBusy()#
Return
Truewhile a blocking profiled move is active, otherwiseFalse.
- EvoMotorPair.deinit()#
Stop the pair with brake behaviour and mark it idle. Returns
None.