Details below come from
- class
ev3dev2.motor.MoveSteering(left_motor_port, right_motor_port, desc=None, motor_class=<class 'ev3dev2.motor.LargeMotor'>) Bases: ev3dev2.motor.MoveTank Controls a pair of motors simultaneously, via a single “steering” value and a speed. - steering [-100, 100]:
- -100 means turn left on the spot (right motor at 100% forward, left motor at 100% backward),
- 0 means drive in a straight line, and
- 100 means turn right on the spot (left motor at 100% forward, right motor at 100% backward).
“steering” can be any number between -100 and 100. Example: steering_drive = MoveSteering(OUTPUT_A, OUTPUT_B)
# drive in a turn for 10 rotations of the outer motor
steering_drive.on_for_rotations(-20, SpeedPercent(75), 10)
on_for_rotations(steering, speed, rotations, brake=True, block=True)Rotate the motors according to the provided steering. The distance each motor will travel follows the rules of MoveTank.on_for_rotations().
on_for_degrees(steering, speed, degrees, brake=True, block=True)Rotate the motors according to the provided steering. The distance each motor will travel follows the rules of MoveTank.on_for_degrees().
on_for_seconds(steering, speed, seconds, brake=True, block=True)Rotate the motors according to the provided steering for seconds.
on(steering, speed)Start rotating the motors according to the provided steering and speed forever.
get_speed_steering(steering, speed)Calculate the speed_sp for each motor in a pair to achieve the specified steering. Note that calling this function alone will not make the motors move, it only calculates the speed. A run_* function must be called afterwards to make the motors move. - steering [-100, 100]:
- -100 means turn left on the spot (right motor at 100% forward, left motor at 100% backward),
- 0 means drive in a straight line, and
- 100 means turn right on the spot (left motor at 100% forward, right motor at 100% backward).
- speed:
- The speed that should be applied to the outmost motor (the one rotating faster). The speed of the other motor will be computed automatically.
Most methods which run motors will accept a speed argument. While this can be provided as an integer which will be interpreted as a percentage of max speed, you can also specify an instance of any of the following classes, each of which represents a different unit system: - class
ev3dev2.motor.SpeedValue A base class for other unit types. Don’t use this directly; instead, see SpeedPercent, SpeedRPS, SpeedRPM, SpeedDPS, and SpeedDPM.
- class
ev3dev2.motor.SpeedPercent(percent, desc=None) Speed as a percentage of the motor’s maximum rated speed.
- class
ev3dev2.motor.SpeedNativeUnits(native_counts, desc=None) Speed in tacho counts per second.
- class
ev3dev2.motor.SpeedRPS(rotations_per_second, desc=None) Speed in rotations-per-second.
- class
ev3dev2.motor.SpeedRPM(rotations_per_minute, desc=None) Speed in rotations-per-minute.
- class
ev3dev2.motor.SpeedDPS(degrees_per_second, desc=None) Speed in degrees-per-second.
- class
ev3dev2.motor.SpeedDPM(degrees_per_minute, desc=None) Speed in degrees-per-minute.
Example: from ev3dev2.motor import SpeedRPM
# later...
# rotates the motor at 200 RPM (rotations-per-minute) for five seconds.
my_motor.on_for_seconds(SpeedRPM(200), 5)
|