LineFollower module

Houses the LineFollower task class.

class LineFollower.LineFollower(s_pos: Share, leftTargetSpeed: Share, rightTargetSpeed: Share, s_xCoord: Share, s_yCoord: Share, heading: Share, s_tofdistance: Share, linePosTarget_front: int = 3000, linePosTarget_rear: int = 2000, centerSpeed: float = 2, taskperiod: int = 30)

Bases: object

this is a line follower, it follows lines.

Takes sensor data from 3 adjacent tasks: QTRs, IMU, and TOF Also takes distance traveled data from the now singular motor task and combines that with the IMU data to integrate position Commands motor task through requested speed shares

Parameters:
  • s_pos – Share object holding composite QTR position values

  • leftTargetSpeed – Share object conveying desired left motor speed

  • rightTargetSpeed – Share object conveying desired right motor speed

  • s_xCoord (Share) – Share object conveying mm left wheel NET distance traveled

  • s_yCoord (Share) – Share object conveying mm right wheel NET distance traveled

  • heading (Share) – Share object conveying IMU heading

  • s_tofdistance (Share) – Share object conveying TOF distance for wall detection

  • linePosTarget_front (int) – QTR position target for front sensor

  • linePosTarget_rear (int) – QTR position target for rear sensor

  • centerSpeed (float) – sets the desired base speed for the motors, determines how fast romi travels (rad/s)

  • taskperiod (int) – period the task runs at (milliseconds)

run()

Implementation as a generator functions

Yields:

int – machine state