Public Member Functions | |
| __init__ (self, pid_params=PidParams(), robot_params=RobotParams(), update_period_ms=100) | |
| move (self, left_speed_mmps, right_speed_mmps) | |
| stop (self) | |
Protected Member Functions | |
| _initialise (self) | |
| _compute_left_speed (self) | |
| _compute_right_speed (self) | |
| _update_speeds (self) | |
Protected Attributes | |
| _cut = ControlUtils(robot_params) | |
| _left_pid | |
| _right_pid | |
| _update_period_ms = update_period_ms | |
| _pid_timer | |
Static Protected Attributes | |
| int | _left_speed = 0 |
| int | _right_speed = 0 |
| int | _previous_left_speed = 0 |
| int | _previous_right_speed = 0 |
| int | _counter = 0 |
| int | _left_encoder = 0 |
| int | _right_encoder = 0 |
| _one = BnrOneAPlus(0, 0) | |
| bool | _initialised = False |
This class provides PID control for a differential drive robot.
| onepi.utils.drive_pid.DrivePid.__init__ | ( | self, | |
| pid_params = PidParams(), | |||
| robot_params = RobotParams(), | |||
| update_period_ms = 100 ) |
initialises the class with kp, ki, kd, max speed (mm/s) and update period (ms)
|
protected |
computes left speed
|
protected |
computes right speed
|
protected |
resets the system to be ready to start (again)
|
protected |
update wheel speeds by running the pid controller and sets the wheel speeds of the robot
| onepi.utils.drive_pid.DrivePid.move | ( | self, | |
| left_speed_mmps, | |||
| right_speed_mmps ) |
Makes the robot move at the desired wheel speeds in mm/s
| onepi.utils.drive_pid.DrivePid.stop | ( | self | ) |
Stops the robot and stops the corresponding timer used by the controller
|
protected |
|
protected |
|
protected |