anki_vector.motors¶
Control the motors of Vector.
Classes
|
Controls the low-level motor functions. |
-
class
anki_vector.motors.
MotorComponent
(robot)¶ Controls the low-level motor functions.
-
set_head_motor
(speed)¶ Tell Vector’s head motor to move with a certain speed.
Positive speed for up, negative speed for down. Measured in radians per second.
To unlock the head track, call set_head_motor(0).
import anki_vector with anki_vector.Robot() as robot: robot.motors.set_head_motor(-5.0)
- Parameters
speed (
float
) – Motor speed for Vector’s head, measured in radians per second.
-
set_lift_motor
(speed)¶ Tell Vector’s lift motor to move with a certain speed.
Positive speed for up, negative speed for down. Measured in radians per second.
To unlock the lift track, call set_lift_motor(0).
import anki_vector import time with anki_vector.Robot() as robot: robot.motors.set_lift_motor(-5.0) time.sleep(3.0) robot.motors.set_lift_motor(5.0) time.sleep(3.0)
- Parameters
speed (
float
) – Motor speed for Vector’s lift, measured in radians per second.
-
set_wheel_motors
(left_wheel_speed, right_wheel_speed, left_wheel_accel=0.0, right_wheel_accel=0.0)¶ Tell Vector to move his wheels / treads at a given speed.
The wheels will continue to move at that speed until commanded to drive at a new speed, or if
stop_all_motors()
is called.To unlock the wheel track, call set_wheel_motors(0, 0).
import anki_vector import time with anki_vector.Robot() as robot: robot.motors.set_wheel_motors(25, 50) time.sleep(3.0)
- Parameters
left_wheel_speed (
float
) – Speed of the left tread (in millimeters per second).right_wheel_speed (
float
) – Speed of the right tread (in millimeters per second).left_wheel_accel (
float
) – Acceleration of left tread (in millimeters per second squared)None
value defaults this to the same as l_wheel_speed.right_wheel_accel (
float
) – Acceleration of right tread (in millimeters per second squared)None
value defaults this to the same as r_wheel_speed.
-
stop_all_motors
()¶ Tell Vector to stop all motors.
import anki_vector import time with anki_vector.Robot() as robot: robot.motors.set_wheel_motors(25, 50) # wait a short time to observe the motors moving time.sleep(0.5) robot.motors.stop_all_motors()
-