|
ME 405 Term Project
|
Public Member Functions | |
| __init__ (self, run_observer, game_origin_mode, left_pos_sh, right_pos_sh, total_s_sh, abs_x_sh, abs_y_sh, abs_theta_sh, x0_mm=0.0, y0_mm=0.0, theta0_rad=0.0) | |
| set_initial_pose (self, x_mm, y_mm, theta_rad=0.0) | |
| Set the initial pose of the robot in the world/game coordinate frame. | |
| run (self) | |
Public Attributes | |
| left_pos_sh = left_pos_sh | |
| right_pos_sh = right_pos_sh | |
| total_s_sh = total_s_sh | |
| abs_x_sh = abs_x_sh | |
| abs_y_sh = abs_y_sh | |
| abs_theta_sh = abs_theta_sh | |
| float | x0_mm = float(x0_mm) |
| float | y0_mm = float(y0_mm) |
| float | theta0_rad = float(theta0_rad) |
| x_mm = self.x0_mm | |
| y_mm = self.y0_mm | |
| theta_rad = self.theta0_rad | |
| run_observer = run_observer | |
| game_origin_mode = game_origin_mode | |
| int | state = self.S0_INIT |
| 0: INIT STATE -----------------------------------------------— | |
| start_left_counts = left_counts | |
| start_right_counts = right_counts | |
| prev_left_counts = left_counts | |
| prev_right_counts = right_counts | |
Static Public Attributes | |
| int | GEAR_RATIO = 3952/33 |
| int | CPR_MOTOR = 12 |
| int | CPR_WHEEL = GEAR_RATIO*CPR_MOTOR |
| int | RAD_PER_COUNT = 2 * math.pi / CPR_WHEEL |
| int | WHEEL_RADIUS_MM = 35 |
| int | WHEEL_BASE_MM = 141 |
| int | S0_INIT = 0 |
| int | S1_WAITING = 1 |
| int | S2_ESTIMATING = 2 |
Protected Member Functions | |
| _reset_odometry (self) | |
| At the start of a run, reset the accumulated pose and previous encoder counts. | |
Estimates the absolute position of the robot using encoder data.
Attributes:
run_observer: Share to start/stop the observer.
game_origin_mode: Share to select world frame or game origin mode.
left_pos_sh: Share for left wheel encoder position.
right_pos_sh: Share for right wheel encoder position.
total_s_sh: Share for total distance traveled along center line.
abs_x_sh: Share for absolute x position.
abs_y_sh: Share for absolute y position.
abs_theta_sh: Share for absolute heading.
| spectator_task.SpectatorTask.__init__ | ( | self, | |
| run_observer, | |||
| game_origin_mode, | |||
| left_pos_sh, | |||
| right_pos_sh, | |||
| total_s_sh, | |||
| abs_x_sh, | |||
| abs_y_sh, | |||
| abs_theta_sh, | |||
| x0_mm = 0.0, | |||
| y0_mm = 0.0, | |||
| theta0_rad = 0.0 ) |
|
protected |
At the start of a run, reset the accumulated pose and previous encoder counts.
| spectator_task.SpectatorTask.set_initial_pose | ( | self, | |
| x_mm, | |||
| y_mm, | |||
| theta_rad = 0.0 ) |
Set the initial pose of the robot in the world/game coordinate frame.
This pose will be used the next time the observer is started. For example, if the track origin is at (0, 0) and Romi's starting position is (300 mm, 150 mm) with heading pi/2 rad, you would call:
spectator.set_initial_pose(300.0, 150.0, math.pi/2)
before run_observer is asserted.
| spectator_task.SpectatorTask.abs_theta_sh = abs_theta_sh |
| spectator_task.SpectatorTask.abs_x_sh = abs_x_sh |
| spectator_task.SpectatorTask.abs_y_sh = abs_y_sh |
|
static |
|
static |
| spectator_task.SpectatorTask.game_origin_mode = game_origin_mode |
|
static |
| spectator_task.SpectatorTask.left_pos_sh = left_pos_sh |
| spectator_task.SpectatorTask.prev_left_counts = left_counts |
| spectator_task.SpectatorTask.prev_right_counts = right_counts |
|
static |
| spectator_task.SpectatorTask.right_pos_sh = right_pos_sh |
| spectator_task.SpectatorTask.run_observer = run_observer |
|
static |
|
static |
|
static |
| spectator_task.SpectatorTask.start_left_counts = left_counts |
| spectator_task.SpectatorTask.start_right_counts = right_counts |
| int spectator_task.SpectatorTask.state = self.S0_INIT |
0: INIT STATE -----------------------------------------------—
1: WAITING STATE --------------------------------------------—
| float spectator_task.SpectatorTask.theta0_rad = float(theta0_rad) |
| spectator_task.SpectatorTask.theta_rad = self.theta0_rad |
| spectator_task.SpectatorTask.total_s_sh = total_s_sh |
|
static |
|
static |
| float spectator_task.SpectatorTask.x0_mm = float(x0_mm) |
| spectator_task.SpectatorTask.x_mm = self.x0_mm |
| float spectator_task.SpectatorTask.y0_mm = float(y0_mm) |
| spectator_task.SpectatorTask.y_mm = self.y0_mm |