Robot module

class robot.Robot[source]

Bases: object

A class that represents the robot and offers shortcuts functions to runs two motors.

Parameters
  • rmotor (Motor) – The right-side motor

  • lmotor (Motor) – The left-side motor

ROT_DIAMETER = 270
WHEEL_DIAMETER = 80
__init__()[source]
async move_to(distance: float, speed: float) None[source]

Move to the object position at a given speed.

Parameters
  • distance – distance to run

  • speed – the speed [-200; 200] in RPM

property moving
async rotate(speed: float, angle: float) None[source]

Turns itself in clockwise.

The recommended speed is 100.

Parameters
  • speed – the speed [-200; 200] in RPM

  • angle – the angle [-180, 180] in degrees to turn

async stop(*_) None[source]

Stop all motors and timer

static time_for_distance(distance: float, speed: float) float[source]

Returns needed time in seconds to travel a specified distance at a given speed.

Parameters
  • distance – in millimeters

  • speed – in RPM

async robot.main() None[source]

The main function, interact with sensors and Robot class