|
ME 405 Romi
|
Pathing plan task class for ROMI navigation. More...
Public Member Functions | |
| __init__ (self, total_dist, automatic_mode, c_state, fwd_ref, piv_ref, yaw, centroid_goal, yaw_goal, bump_on, bump_flg) | |
| Initialize the pathing_plan_task object. | |
| wrapper (self, val) | |
| Wrap a yaw value to the 0-2PI range. | |
| line_following (self, final_dist, next_state) | |
| Configure control task for line following and check progress. | |
| alignment_goal (self, yaw_goal, rot_direction, next_state) | |
| Configure control task for large pivoting turns. | |
| alignment_control (self, next_state) | |
| Configure control task for precise controlled turning. | |
| free_traverse (self, final_dist, next_state, ref) | |
| Configure control task for forward motion and check progress. | |
| run (self) | |
| Main task generator for cooperative scheduler. | |
Public Attributes | |
| int | state = LINE_FOLLOW_STATE_0 |
| total_dist = total_dist | |
| automatic_mode = automatic_mode | |
| c_state = c_state | |
| fwd_ref = fwd_ref | |
| yaw = yaw | |
| int | yaw_init = 0 |
| piv_ref = piv_ref | |
| centroid_goal = centroid_goal | |
| yaw_goal = yaw_goal | |
| bump_on = bump_on | |
| bump_flg = bump_flg | |
| int | bump_off = 0 |
| int | iteration = 0 |
| list | yaw_goals_5 = [YAWGOAL5, EXPYAWGOAL1, EXPYAWGOAL2, EXPYAWGOAL3] |
| list | direction = [1, 1, -1, 1] |
| list | dist = [CP4_GARAGE, 3600, 3800, 4000] |
Pathing plan task class for ROMI navigation.
This class implements a finite state machine for autonomous navigation of the Pololu ROMI robot through a predefined course with checkpoints and obstacles.
Definition at line 91 of file pathing_plan_task.py.
| pathing_plan_task.pathing_plan.__init__ | ( | self, | |
| total_dist, | |||
| automatic_mode, | |||
| c_state, | |||
| fwd_ref, | |||
| piv_ref, | |||
| yaw, | |||
| centroid_goal, | |||
| yaw_goal, | |||
| bump_on, | |||
| bump_flg ) |
Initialize the pathing_plan_task object.
| total_dist | Float share containing total distance traveled by ROMI (set by observer) |
| automatic_mode | Integer share flag to enable automatic line following mode |
| c_state | Integer share flag holding the expected state of control_task |
| fwd_ref | Integer share holding forward reference speed in mm/s |
| piv_ref | Float share holding pivoting reference angular speed in rad/s |
| yaw | Float share containing current yaw from IMU task |
| centroid_goal | Float share for line following centroid controller set point |
| yaw_goal | Float share for heading control set point (target angle) |
| bump_on | Integer share flag to turn on bump sensors |
| bump_flg | Integer share flag set by bump task when sensors are triggered |
Definition at line 99 of file pathing_plan_task.py.
| pathing_plan_task.pathing_plan.alignment_control | ( | self, | |
| next_state ) |
Configure control task for precise controlled turning.
Sets all necessary flags for controlled turning mode to achieve precise yaw alignment. Expected to be used after alignment_goal(). Does not set yaw_goal itself.
| next_state | State number to transition to when alignment is complete |
Definition at line 191 of file pathing_plan_task.py.

| pathing_plan_task.pathing_plan.alignment_goal | ( | self, | |
| yaw_goal, | |||
| rot_direction, | |||
| next_state ) |
Configure control task for large pivoting turns.
Sets all necessary flags to put control_task into pivoting mode for making large, inaccurate turns. Transitions to the next state when within 0.5 rad of goal.
| yaw_goal | Target yaw value to reach |
| rot_direction | Direction to turn (1 for CCW, -1 for CW) |
| next_state | State number to transition to when goal is reached |
Definition at line 167 of file pathing_plan_task.py.


| pathing_plan_task.pathing_plan.free_traverse | ( | self, | |
| final_dist, | |||
| next_state, | |||
| ref ) |
Configure control task for forward motion and check progress.
Sets all necessary flags to put control_task into forward motion mode and monitors whether ROMI has traveled far enough to transition to the next state.
| final_dist | Distance threshold to compare against total distance traveled |
| next_state | State number to transition to when distance is reached |
| ref | Reference speed for ROMI to traverse at in mm/s |
Definition at line 207 of file pathing_plan_task.py.

| pathing_plan_task.pathing_plan.line_following | ( | self, | |
| final_dist, | |||
| next_state ) |
Configure control task for line following and check progress.
Sets all necessary flags to put control_task into line following mode and monitors whether ROMI has traveled far enough to transition to the next state.
| final_dist | Distance threshold to compare against total distance traveled |
| next_state | State number to transition to when distance is reached |
Definition at line 149 of file pathing_plan_task.py.

| pathing_plan_task.pathing_plan.run | ( | self | ) |
Main task generator for cooperative scheduler.
Implements a 34-state finite state machine for autonomous course navigation. Each state executes once in sequence and never returns. The generator yields control after processing each state.
State sequence overview:
States execute in the following order: LINE_FOLLOW_STATE_0, CENTROID_OFFSET_STATE, ALIGNMENT_GOAL_1, ALIGNMENT_CONTROL_1, FORK, ALIGNMENT_GOAL_2, ALIGNMENT_CONTROL_2, FREE_TRAVERSE_1, CP2_PIVOT_1, CP2_PIVOT_2, LINE_FOLLOWING_2, ALIGNMENT_GOAL_3, ALIGNMENT_CONTROL_3, FREE_TRAVERSE_2, LINE_FOLLOW_3, ALIGNMENT_GOAL_4, ALIGNMENT_CONTROL_4, FREE_TRAVERSE_3, LINE_FOLLOW_GRG, ALIGNMENT_GOAL_5, ALIGNMENT_CONTROL_5, FREE_TRAVERSE_4, ALIGNMENT_GOAL_6, ALIGNMENT_CONTROL_6, FREE_TRAVERSE_5, WALL, ALIGNMENT_GOAL_7, ALIGNMENT_CONTROL_7, CUP, ALIGNMENT_GOAL_8, ALIGNMENT_CONTROL_8, FINISH, FINISH_LINE
Path overview: Start line following to the Y, move the centroid to the left to keep right, face CP1, drive directly there, face CP2, drive directly there, line follow briefly, turn to CP3, drive there pushing cup out of the way, turn to CP4, drive there and line follow at the end to align, align at garage entrance, drive through, turn towards wall, drive out, hit wall and backup, turn towards cup, drive over it, turn towards finish, drive back to the line, use line following to get into CP6.
Definition at line 228 of file pathing_plan_task.py.

| pathing_plan_task.pathing_plan.wrapper | ( | self, | |
| val ) |
Wrap a yaw value to the 0-2PI range.
This method ensures yaw values stay within the valid range used by the IMU, preventing negative values or values exceeding 2π.
| val | The yaw value to be wrapped |
Definition at line 132 of file pathing_plan_task.py.

| pathing_plan_task.pathing_plan.automatic_mode = automatic_mode |
Definition at line 116 of file pathing_plan_task.py.
| pathing_plan_task.pathing_plan.bump_flg = bump_flg |
Definition at line 125 of file pathing_plan_task.py.
| int pathing_plan_task.pathing_plan.bump_off = 0 |
Definition at line 126 of file pathing_plan_task.py.
| pathing_plan_task.pathing_plan.bump_on = bump_on |
Definition at line 124 of file pathing_plan_task.py.
| pathing_plan_task.pathing_plan.c_state = c_state |
Definition at line 117 of file pathing_plan_task.py.
| pathing_plan_task.pathing_plan.centroid_goal = centroid_goal |
Definition at line 122 of file pathing_plan_task.py.
| list pathing_plan_task.pathing_plan.direction = [1, 1, -1, 1] |
Definition at line 129 of file pathing_plan_task.py.
| list pathing_plan_task.pathing_plan.dist = [CP4_GARAGE, 3600, 3800, 4000] |
Definition at line 130 of file pathing_plan_task.py.
| pathing_plan_task.pathing_plan.fwd_ref = fwd_ref |
Definition at line 118 of file pathing_plan_task.py.
| int pathing_plan_task.pathing_plan.iteration = 0 |
Definition at line 127 of file pathing_plan_task.py.
| pathing_plan_task.pathing_plan.piv_ref = piv_ref |
Definition at line 121 of file pathing_plan_task.py.
| int pathing_plan_task.pathing_plan.state = LINE_FOLLOW_STATE_0 |
Definition at line 114 of file pathing_plan_task.py.
| pathing_plan_task.pathing_plan.total_dist = total_dist |
Definition at line 115 of file pathing_plan_task.py.
| pathing_plan_task.pathing_plan.yaw = yaw |
Definition at line 119 of file pathing_plan_task.py.
| pathing_plan_task.pathing_plan.yaw_goal = yaw_goal |
Definition at line 123 of file pathing_plan_task.py.
| list pathing_plan_task.pathing_plan.yaw_goals_5 = [YAWGOAL5, EXPYAWGOAL1, EXPYAWGOAL2, EXPYAWGOAL3] |
Definition at line 128 of file pathing_plan_task.py.
| pathing_plan_task.pathing_plan.yaw_init = 0 |
Definition at line 120 of file pathing_plan_task.py.