Luisa Chiu Portfolio
LabFF_task_userinterface.Task_User Class Reference

User interface task for data collection and interaction with all the tasks. More...

Public Member Functions

def __init__ (self, period, balance_flag, calib_pan_flag, calib_IMU_flag, disable_flag, state_vect_x, state_vect_y, L_1, L_2)
 Constructs the user interface task. More...
 
def run (self)
 Runs one iteration of the FSM. More...
 
def transition_to (self, new_state)
 Transitions the FSM to a new state. More...
 

Public Attributes

 period
 The frequency of the task. More...
 
 state
 Sets initial state to State 0. More...
 
 runs
 Sets the number of runs to 0. More...
 
 next_time
 The utime.ticks_us() value associated with the next run of the FSM. More...
 
 ser
 A serial port to use for user I/O. More...
 
 balance_flag
 A boolean flag used to start balancing the platform and/or ball. More...
 
 i
 A variable used for indexing. More...
 
 calib_pan_flag
 A boolean flag used to start touch panel calibration. More...
 
 calib_IMU_flag
 A boolean flag used to start IMU calibration. More...
 
 disable_flag
 A boolean flag used to disable motors. More...
 
 state_vect_x
 A shared list used to define state vector x. More...
 
 state_vect_y
 A shared list used to define state vector y. More...
 
 L_1
 Variable used to define actuation level for motor 1. More...
 
 L_2
 Variable used to define actuation level for motor 2. More...
 
 time_array
 An array for time. More...
 
 x_array
 An array for x position. More...
 
 thy_array
 An array for theta y angle. More...
 
 xd_array
 An array for x velocity. More...
 
 thyd_array
 An array for angular velocity (y direction) More...
 
 y_array
 An array for y position. More...
 
 thx_array
 An array for theta x angle. More...
 
 yd_array
 An array for y velocity. More...
 
 thxd_array
 An array for angular velocity (x direction) More...
 
 collect_time
 Starts timer for data collection. More...
 
 time_diff
 Creates a variable that calculates difference between time reference points. More...
 

Detailed Description

User interface task for data collection and interaction with all the tasks.

Implements a finite state machine that communicates with the user to interface with all the tasks

Constructor & Destructor Documentation

◆ __init__()

def LabFF_task_userinterface.Task_User.__init__ (   self,
  period,
  balance_flag,
  calib_pan_flag,
  calib_IMU_flag,
  disable_flag,
  state_vect_x,
  state_vect_y,
  L_1,
  L_2 
)

Constructs the user interface task.

The user task is implemented as a finite state machine that interacts between the user and the program.

Parameters
periodThe period, in microseconds, between runs of the task
balance_flagA boolean flag used to enable ball balancing
calib_pan_flagA boolean flag used to enable touch panel calibration
calib_IMU_flagA boolean flag used to enable IMU calibration
disable_flagA boolean flag used to disable the motors
L_1Variable used to define actuation level for motor 1
L_2Variable used to define actuation level for motor 2
state_vect_xList used to define state vector x
state_vect_yList used to define state vector y

Member Function Documentation

◆ run()

def LabFF_task_userinterface.Task_User.run (   self)

Runs one iteration of the FSM.

Implements a finite state machine

◆ transition_to()

def LabFF_task_userinterface.Task_User.transition_to (   self,
  new_state 
)

Transitions the FSM to a new state.

A function that transitions the FSM to a new state

Parameters
new_stateThe state to transition to

Member Data Documentation

◆ balance_flag

LabFF_task_userinterface.Task_User.balance_flag

A boolean flag used to start balancing the platform and/or ball.

Works with the motor task and user interface to implement closed-loop control that balances the platform and ball

◆ calib_IMU_flag

LabFF_task_userinterface.Task_User.calib_IMU_flag

A boolean flag used to start IMU calibration.

Works with the task IMU and user interface to do IMU calibration

◆ calib_pan_flag

LabFF_task_userinterface.Task_User.calib_pan_flag

A boolean flag used to start touch panel calibration.

Works with the task panel and user interface to do resistive touch panel calibration

◆ collect_time

LabFF_task_userinterface.Task_User.collect_time

Starts timer for data collection.

An increasing microsecond counter equal to current_time

◆ disable_flag

LabFF_task_userinterface.Task_User.disable_flag

A boolean flag used to disable motors.

Works with the motor task and user interface to halt motor movement

◆ i

LabFF_task_userinterface.Task_User.i

A variable used for indexing.

This value helps index state vector points for data collection

◆ L_1

LabFF_task_userinterface.Task_User.L_1

Variable used to define actuation level for motor 1.

This value is calculated using input gain and torque

◆ L_2

LabFF_task_userinterface.Task_User.L_2

Variable used to define actuation level for motor 2.

This value is calculated using input gain and torque

◆ next_time

LabFF_task_userinterface.Task_User.next_time

The utime.ticks_us() value associated with the next run of the FSM.

Defines a variable that adds the period to the ongoing timer

◆ period

LabFF_task_userinterface.Task_User.period

The frequency of the task.

Defines variable that specifies timer frequency

◆ runs

LabFF_task_userinterface.Task_User.runs

Sets the number of runs to 0.

Defines a variable to keep track of runs

◆ ser

LabFF_task_userinterface.Task_User.ser

A serial port to use for user I/O.

Creates a new USB_VCP object

◆ state

LabFF_task_userinterface.Task_User.state

Sets initial state to State 0.

Starts timer.

FSM starts at State 0, where user input is prompted for further action

An increasing microsecond counter with an arbitrary reference point

◆ state_vect_x

LabFF_task_userinterface.Task_User.state_vect_x

A shared list used to define state vector x.

Contains variables for x position, theta y, x velocity, and angular velocity (theta y dot)

◆ state_vect_y

LabFF_task_userinterface.Task_User.state_vect_y

A shared list used to define state vector y.

Contains variables for y position, theta x, y velocity, and angular velocity (theta x dot)

◆ thx_array

LabFF_task_userinterface.Task_User.thx_array

An array for theta x angle.

This variable creates an empty array of 1000 data points, which will be populated with angular position data in the x axis gathered from the IMU

◆ thxd_array

LabFF_task_userinterface.Task_User.thxd_array

An array for angular velocity (x direction)

This variable creates an empty array of 1000 data points, which will be populated with angular velocity data in the x axis gathered from the IMU

◆ thy_array

LabFF_task_userinterface.Task_User.thy_array

An array for theta y angle.

This variable creates an empty array of 1000 data points, which will be populated with angular position data in the y axis gathered from the IMU

◆ thyd_array

LabFF_task_userinterface.Task_User.thyd_array

An array for angular velocity (y direction)

This variable creates an empty array of 1000 data points, which will be populated with angular velocity data in the y axis gathered from the IMU

◆ time_array

LabFF_task_userinterface.Task_User.time_array

An array for time.

This variable creates an empty array of 1000 data points, which will be populated with time data

◆ time_diff

LabFF_task_userinterface.Task_User.time_diff

Creates a variable that calculates difference between time reference points.

Used to collect data for a maximum time of 30 seconds

◆ x_array

LabFF_task_userinterface.Task_User.x_array

An array for x position.

This variable creates an empty array of 1000 data points, which will be populated with x-position data gathered from the touch panel

◆ xd_array

LabFF_task_userinterface.Task_User.xd_array

An array for x velocity.

This variable creates an empty array of 1000 data points, which will be populated with x-velocity data gathered from the touch panel

◆ y_array

LabFF_task_userinterface.Task_User.y_array

An array for y position.

This variable creates an empty array of 1000 data points, which will be populated with y-position data gathered from the touch panel

◆ yd_array

LabFF_task_userinterface.Task_User.yd_array

An array for y velocity.

This variable creates an empty array of 1000 data points, which will be populated with y-velocity data gathered from the touch panel


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