|
ME 405 Romi
|
Collision detector for cooperative scheduler. More...
Public Member Functions | |
| __init__ (self, c_state, bump_sensor_right, bump_sensor_left, bump_on_off, bump_flg) | |
| Shares are passed as parameters, used to communicate between tasks in the cooperative scheduler. | |
| run (self) | |
| This function runs via the cooperative scheduler. | |
Public Attributes | |
| c_state = c_state | |
| bump_sensor_right = bump_sensor_right | |
| bump_sensor_left = bump_sensor_left | |
| int | state = 0 |
| bump_on_off = bump_on_off | |
| bump_flg = bump_flg | |
Collision detector for cooperative scheduler.
This class runs continuously, setting flags that are shared with other tasks.
The Bump task uses two sensor objects, for left and right side of the Romi. Any collision with either side will be treated the same.
Definition at line 10 of file bump_task.py.
| bump_task.Bump_Task.__init__ | ( | self, | |
| c_state, | |||
| bump_sensor_right, | |||
| bump_sensor_left, | |||
| bump_on_off, | |||
| bump_flg ) |
Shares are passed as parameters, used to communicate between tasks in the cooperative scheduler.
| c_state | A flag used to tell which control state is desired |
| bump_sensor_right | The right bump Sensor Object |
| bump_sensor_left | The left bump Sensor Object |
| bump_on_off | A flag to tell bump_task to read if the sensors are pressed |
| bump_flg | A flag set if a sensor was pressed while being read |
Definition at line 17 of file bump_task.py.
| bump_task.Bump_Task.run | ( | self | ) |
This function runs via the cooperative scheduler.
State 0 Not reading sensors
State 1 Reading sensors
Effects
Sets bump_flg to 1 when a sensor is pressed from left or right side
Definition at line 35 of file bump_task.py.
| bump_task.Bump_Task.bump_flg = bump_flg |
Definition at line 23 of file bump_task.py.
| bump_task.Bump_Task.bump_on_off = bump_on_off |
Definition at line 22 of file bump_task.py.
| bump_task.Bump_Task.bump_sensor_left = bump_sensor_left |
Definition at line 20 of file bump_task.py.
| bump_task.Bump_Task.bump_sensor_right = bump_sensor_right |
Definition at line 19 of file bump_task.py.
| bump_task.Bump_Task.c_state = c_state |
Definition at line 18 of file bump_task.py.
| int bump_task.Bump_Task.state = 0 |
Definition at line 21 of file bump_task.py.