ME 405 Term Project
Loading...
Searching...
No Matches
spectator_task.SpectatorTask Class Reference

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.

Detailed Description

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.

Constructor & Destructor Documentation

◆ __init__()

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 )

Initialize the object's attributes

Member Function Documentation

◆ _reset_odometry()

spectator_task.SpectatorTask._reset_odometry ( self)
protected

At the start of a run, reset the accumulated pose and previous encoder counts.

◆ run()

spectator_task.SpectatorTask.run ( self)

FINITE STATE MACHINE

◆ set_initial_pose()

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.

HELPER FUNCTIONS

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.

Member Data Documentation

◆ abs_theta_sh

spectator_task.SpectatorTask.abs_theta_sh = abs_theta_sh

◆ abs_x_sh

spectator_task.SpectatorTask.abs_x_sh = abs_x_sh

◆ abs_y_sh

spectator_task.SpectatorTask.abs_y_sh = abs_y_sh

◆ CPR_MOTOR

int spectator_task.SpectatorTask.CPR_MOTOR = 12
static

◆ CPR_WHEEL

int spectator_task.SpectatorTask.CPR_WHEEL = GEAR_RATIO*CPR_MOTOR
static

◆ game_origin_mode

spectator_task.SpectatorTask.game_origin_mode = game_origin_mode

◆ GEAR_RATIO

int spectator_task.SpectatorTask.GEAR_RATIO = 3952/33
static

◆ left_pos_sh

spectator_task.SpectatorTask.left_pos_sh = left_pos_sh

◆ prev_left_counts

spectator_task.SpectatorTask.prev_left_counts = left_counts

◆ prev_right_counts

spectator_task.SpectatorTask.prev_right_counts = right_counts

◆ RAD_PER_COUNT

int spectator_task.SpectatorTask.RAD_PER_COUNT = 2 * math.pi / CPR_WHEEL
static

◆ right_pos_sh

spectator_task.SpectatorTask.right_pos_sh = right_pos_sh

◆ run_observer

spectator_task.SpectatorTask.run_observer = run_observer

◆ S0_INIT

int spectator_task.SpectatorTask.S0_INIT = 0
static

◆ S1_WAITING

int spectator_task.SpectatorTask.S1_WAITING = 1
static

◆ S2_ESTIMATING

int spectator_task.SpectatorTask.S2_ESTIMATING = 2
static

◆ start_left_counts

spectator_task.SpectatorTask.start_left_counts = left_counts

◆ start_right_counts

spectator_task.SpectatorTask.start_right_counts = right_counts

◆ state

int spectator_task.SpectatorTask.state = self.S0_INIT

0: INIT STATE -----------------------------------------------—

1: WAITING STATE --------------------------------------------—

◆ theta0_rad

float spectator_task.SpectatorTask.theta0_rad = float(theta0_rad)

◆ theta_rad

spectator_task.SpectatorTask.theta_rad = self.theta0_rad

◆ total_s_sh

spectator_task.SpectatorTask.total_s_sh = total_s_sh

◆ WHEEL_BASE_MM

int spectator_task.SpectatorTask.WHEEL_BASE_MM = 141
static

◆ WHEEL_RADIUS_MM

int spectator_task.SpectatorTask.WHEEL_RADIUS_MM = 35
static

◆ x0_mm

float spectator_task.SpectatorTask.x0_mm = float(x0_mm)

◆ x_mm

spectator_task.SpectatorTask.x_mm = self.x0_mm

◆ y0_mm

float spectator_task.SpectatorTask.y0_mm = float(y0_mm)

◆ y_mm

spectator_task.SpectatorTask.y_mm = self.y0_mm

The documentation for this class was generated from the following file: