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

Main script of ME305 Lab0x04. More...

Variables

 Lab0x04_main.zFlag = shares.Share(False)
 Create object zFlag shared between all files. More...
 
 Lab0x04_main.faultFlag = shares.Share(False)
 Create object zFlag shared between all files. More...
 
 Lab0x04_main.wFlag = shares.Share(False)
 Create object wFlag shared between all files. More...
 
 Lab0x04_main.timDATA = shares.Share(0)
 Create an object timDATA shared between all files. More...
 
 Lab0x04_main.posDATA = shares.Share(0)
 Create an object posDATA shared between all files. More...
 
 Lab0x04_main.delDATA = shares.Share(0)
 Create an object delDATA shared between all files. More...
 
 Lab0x04_main.DATA = shares.Share(0)
 Create an object DATA shared between all files. More...
 
 Lab0x04_main.speedDATA = shares.Share(0)
 Create an object soeedDATA shared between all files. More...
 
 Lab0x04_main.duty1 = shares.Share(0)
 Create an object duty1 shared between all files. More...
 
 Lab0x04_main.duty2 = shares.Share(0)
 Create an object DATA shared between all files. More...
 
 Lab0x04_main.K_p = shares.Share(0)
 Create a shared object K_p corresponding to closed-loop controller gain. More...
 
 Lab0x04_main.setpoint = shares.Share(0)
 Create a shared object setpoint corresponding to the desired motor speed. More...
 
list Lab0x04_main.taskList
 

Detailed Description

Main script of ME305 Lab0x04.

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

◆ DATA

Lab0x04_main.DATA = shares.Share(0)

Create an object DATA shared between all files.

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

◆ delDATA

Lab0x04_main.delDATA = shares.Share(0)

Create an object delDATA shared between all files.

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

◆ duty1

Lab0x04_main.duty1 = 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

◆ duty2

Lab0x04_main.duty2 = 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.

◆ faultFlag

Lab0x04_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_p

Lab0x04_main.K_p = shares.Share(0)

Create a shared object K_p corresponding to closed-loop controller gain.

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

◆ posDATA

Lab0x04_main.posDATA = shares.Share(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

Lab0x04_main.setpoint = shares.Share(0)

Create a shared object setpoint 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.

◆ speedDATA

Lab0x04_main.speedDATA = shares.Share(0)

Create an object soeedDATA 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.

◆ taskList

list Lab0x04_main.taskList
Initial value:
1= [Lab0x04_taskUser.taskUserFcn ('Task User', 10_000, zFlag, timDATA, posDATA, delDATA, DATA, speedDATA, faultFlag, duty1, duty2, K_p, setpoint, wFlag),
2 Lab0x04_taskEncoder.taskEncoderFcn ('Task Encoder', 10_000, zFlag, timDATA, posDATA, delDATA, DATA, speedDATA),
3 Lab0x04_taskMotor.taskMotorFcn ('Task Motor', 10_000, faultFlag, duty1, duty2, K_p, setpoint, wFlag, speedDATA)]

◆ timDATA

Lab0x04_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

Lab0x04_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

Lab0x04_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.