Mechatronics Portfolio
Logan Williamson's Mechatronics Portfolio and Documentation Repository
Variables
main.py File Reference

Main script of ME305 Lab0x03. More...

Variables

 main.zFlag = shares.Share(False)
 Create object zFlag shared between all files. More...
 
 main.faultFlag = shares.Share(False)
 Create object zFlag shared between all files. More...
 
 main.wFlag = shares.Share(False)
 Create object wFlag shared between all files. More...
 
 main.cFlag = shares.Share(False)
 
 main.timDATA = shares.Share(0)
 Create an object timDATA shared between all files. More...
 
 main.posDATA = shares.Share((0,0,0))
 Create an object posDATA shared between all files. More...
 
 main.calDATA = shares.Share((0,0,0,0))
 Create an object calDATA shared between all files. More...
 
 main.DATA = shares.Share((0,0,0,0,0))
 Create an object DATA shared between all files. More...
 
 main.speedDATA = shares.Share((0,0,0))
 Create an object speedDATA shared between all files. More...
 
 main.duty_y = shares.Share(0)
 Create an object duty1 shared between all files. More...
 
 main.duty_x = shares.Share(0)
 Create an object DATA shared between all files. More...
 
 main.K_pi = shares.Share(0)
 Create a shared object K_pi corresponding to inner loop controller gain. More...
 
 main.K_di = shares.Share(0)
 Create a shared object K_di corresponding to inner loop controller gain. More...
 
 main.K_po = shares.Share(0)
 Create a shared object K_po corresponding to outer loop controller gain. More...
 
 main.K_do = shares.Share(0)
 Create a shared object K_do corresponding to outer loop controller gain. More...
 
 main.setpoint_x = shares.Share(0)
 Create a shared object setpoint_x corresponding to the desired motor speed. More...
 
 main.setpoint_y = shares.Share(0)
 Create a shared object setpoint_y corresponding to the desired motor speed. More...
 
list main.taskList
 

Detailed Description

Main script of ME305 Lab0x03.

This file instantiates the shared flag variables, shared data variables, and controls the task sharing between taskEncoder.py and taskUser.py.

Author
: Logan Williamson
: Brianna Roberts
Date
01/27/2022

Variable Documentation

◆ calDATA

main.calDATA = shares.Share((0,0,0,0))

Create an object calDATA shared between all files.

This is the parsed calibration status values for printing in taskUser when attempting to and printed in the taskUser when prompted

◆ DATA

main.DATA = shares.Share((0,0,0,0,0))

Create an object DATA shared between all files.

This is a shares.Share object that records touchpanel position and velocity data.

◆ duty_x

main.duty_x = shares.Share(0)

Create an object DATA shared between all files.

This is a tuple that records the data and the position. used when user prompts to ask for 30 second data collection. This is shared with taskUser and formatted to print in an array.

◆ duty_y

main.duty_y = shares.Share(0)

Create an object duty1 shared between all files.

This is a value that will be passed into the motor.Motor objects for the purpose of setting the duty cycle (and by extension, the speed) of the

◆ faultFlag

main.faultFlag = shares.Share(False)

Create object zFlag shared between all files.

Used as a flag between files to communicate when z or Z is pressed. also used in order to communicate between tasks.

◆ K_di

main.K_di = shares.Share(0)

Create a shared object K_di corresponding to inner loop controller gain.

This is a shares.Share object that enables the user to input an inner loop controller gain.

◆ K_do

main.K_do = shares.Share(0)

Create a shared object K_do corresponding to outer loop controller gain.

This is a shares.Share object that enables the user to input an outer loop controller gain.

◆ K_pi

main.K_pi = shares.Share(0)

Create a shared object K_pi corresponding to inner loop controller gain.

This is a shares.Share object that enables the user to input an inner loop controller gain.

◆ K_po

main.K_po = shares.Share(0)

Create a shared object K_po corresponding to outer loop controller gain.

This is a shares.Share object that enables the user to input an outer loop controller gain.

◆ posDATA

main.posDATA = shares.Share((0,0,0))

Create an object posDATA shared between all files.

This is the value of position that is written in the taskEncoder and printed in the taskUser when prompted

◆ setpoint_x

main.setpoint_x = shares.Share(0)

Create a shared object setpoint_x corresponding to the desired motor speed.

This is a shares.Share object that sets the desired motor speed in rad/s. The values are limited to -175 to 175 rad/s; values outside this range will be 'rounded' to the nearest limit on this range upon input.

◆ setpoint_y

main.setpoint_y = shares.Share(0)

Create a shared object setpoint_y corresponding to the desired motor speed.

This is a shares.Share object that sets the desired motor speed in rad/s. The values are limited to -175 to 175 rad/s; values outside this range will be 'rounded' to the nearest limit on this range upon input. This controls the motor_1 closed loop controller setpoint.

◆ speedDATA

main.speedDATA = shares.Share((0,0,0))

Create an object speedDATA shared between all files.

This is the value of angular velocity that is written in the taskIMU and printed in the taskUser when prompted

◆ taskList

list main.taskList
Initial value:
1= [taskIMU.taskBNO055Fcn('Task IMU', 10_000, zFlag, posDATA, calDATA, DATA, speedDATA),
2 taskPanel.taskPanelFcn('Task Panel',10_000, faultFlag, cFlag, DATA),
3 taskUser.taskUserFcn ('Task User', 10_000, zFlag, timDATA, posDATA, calDATA, DATA, speedDATA, duty_y, duty_x, K_pi, K_di, K_po, K_do, setpoint_x, setpoint_y, wFlag, cFlag),
4 taskMotor.taskMotorFcn ('Task Motor', 10_000, faultFlag, duty_y, duty_x, K_pi, K_di, K_po, K_do, setpoint_x, setpoint_y, wFlag, posDATA, speedDATA, DATA)]
def taskBNO055Fcn(taskName, period, zFlag, posDATA, calDATA, DATA, speedDATA)
A generator to implement the IMU task as an FSM.
Definition: taskIMU.py:33
def taskPanelFcn(taskName, period, faultFlag, cFlag, DATA)
A generator to implement the touchpanel operation as an FSM.
Definition: taskPanel.py:33

◆ timDATA

main.timDATA = shares.Share(0)

Create an object timDATA shared between all files.

This is the value of time used in taskEncoder to keep track of time. Set to timDATA.write(ticks_ms()-init_time)

◆ wFlag

main.wFlag = shares.Share(False)

Create object wFlag shared between all files.

Used as a flag between files to communicate when the program is in closed- or open-loop control mode. When wFlag is False, the motor speed is being set by user input (open-loop control). When wFlag is True, the motor speed is set by gain and setpoint values specified by the user.

◆ zFlag

main.zFlag = shares.Share(False)

Create object zFlag shared between all files.

Used as a flag between files to communicate when z or Z is pressed. also used in order to communicate between tasks.