ME405 Portfolio
The following documentation details each step of the ME 405 term project.
PB_FSM.Platform_Ball_Task Class Reference

Public Member Functions

def Fault_Detection (self, pin)
 This method manages fault and prevents danger to user. More...
 
def __init__ (self, interval)
 Defines variables and objects needed for FSM. More...
 
def run (self)
 Runs one iteration of the platform ball task.
 
def transitionTo (self, newState)
 Sets new state. More...
 

Public Attributes

 state
 The state to run on the next iteration of the task.
 
 interval
 The amount of time in microseconds between runs of the task.
 
 start_time
 The timestamp for the first iteration.
 
 next_time
 The "timestamp" for when the task should run next.
 
 User_Button
 Defining nucleo user input button as external interrupt self.Fault_Interrupt = pyb.ExtInt(pyb.Pin.board.PB2, pyb.ExtInt.IRQ_FALLING, pyb.Pin.PULL_UP, self.Fault_Detection) More...
 
 mot1
 Define motor 2, controls rotation about X axis.
 
 mot2
 Define motor 1, controls rotation about Y axis.
 
 Touch_Panel
 Define touch panel driver.
 
 Platform
 Define Initialized Platform Controller.
 
 Platform_Ball
 Define Initialized Platform and Ball Controller.
 
 IMU
 Define BNO055 sensor object.
 
 pos_X
 Variable storing two most recent X contact positions.
 
 pos_Y
 Variable storing two most recent Y contact positions.
 
 theta_X
 Variable storing two most recent angles about X.
 
 theta_Y
 Variable storing two most recent angles about Y.
 
 runs
 Variable storing number of loops through Platform/Ball control.
 
 curr_time
 Updates current time.
 
 Touch_Data
 Variable storing current touch panel data for each loop.
 
 IMU_Data
 Variable storing current IMU sensor data for each loop.
 

Static Public Attributes

int S0_INIT = 0
 Constant defining state 0 - Initialization.
 
int S1_PLATFORM_ZERO = 1
 Constant defining state 1 - Zero the Platform.
 
int S2_BALANCE = 2
 Constant defining state 2 - Balance the Ball.
 
int S3_FAULT = 3
 Constant defining state 3 - Fault Correction.
 

Constructor & Destructor Documentation

◆ __init__()

def PB_FSM.Platform_Ball_Task.__init__ (   self,
  interval 
)

Defines variables and objects needed for FSM.

Parameters
intervalInput for time between runs in microseconds

Member Function Documentation

◆ Fault_Detection()

def PB_FSM.Platform_Ball_Task.Fault_Detection (   self,
  pin 
)

This method manages fault and prevents danger to user.

When this method is called by the FSM or external interrupt both motors are disabled and the FSM moves into state 3 which waits for a user input before resuming operation.

◆ transitionTo()

def PB_FSM.Platform_Ball_Task.transitionTo (   self,
  newState 
)

Sets new state.

Parameters
newStateVariable representing the desired new state

Member Data Documentation

◆ User_Button

PB_FSM.Platform_Ball_Task.User_Button

Defining nucleo user input button as external interrupt self.Fault_Interrupt = pyb.ExtInt(pyb.Pin.board.PB2, pyb.ExtInt.IRQ_FALLING, pyb.Pin.PULL_UP, self.Fault_Detection)

Setting up Nucleo user button for fault reset


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