ControlBothMotors module

Controls both the left and right motors as a task.

class ControlBothMotors.ControlBothMotors(kp, ki, kd, s_leftRequestedSpeed, s_rightRequestedSpeed, s_xCoord: Share, s_yCoord: Share, s_heading: Share)

Bases: object

Controls both motor speeds in closed loop, taking data straight from their encoders.

Also updates a running XY position given IMU heading

Parameters:
  • kp (float) – Proportional gain.

  • ki (float) – Integral gain.

  • kd (float) – Derivative gain.

  • s_leftRequestedSpeed (Share) – Conveys speed requested by LineFollower to left motor control loop.

  • s_rightRequestedSpeed (Share) – Conveys speed requested by LineFollower to right motor control loop.

  • s_xCoord (Share) – Romi field x coordinate.

  • s_yCoord (Share) – Romi field y coordinate.

  • s_heading (Share) – Romi field heading.

run()

Implementation of task as a generator function

Yields:

int – state