Ball Balancer Project
Variables
main.py File Reference

The main script for running the tasks of the final lab project. More...

Variables

 main.zFlag = shares.Share(False)
 The variable, zFlag, is a shared variable. More...
 
 main.Data = shares.Share()
 The variable, Data, is a queue of shared data. More...
 
 main.Delta = shares.Share()
 The variable, Delta, is a queue of shared data. More...
 
 main.Velocity = shares.Share()
 The variable, Velocity, is a queue of shared data. More...
 
 main.Duty1 = shares.Share()
 The variable, Duty1, is a queue of shared data. More...
 
 main.Duty2 = shares.Share()
 The variable, Duty2, is a queue of shared data. More...
 
 main.clFlag = shares.Share(False)
 The variable, clFlag, is a shared variable. More...
 
 main.Kp = shares.Share()
 The variable, Kp, is a shared variable. More...
 
 main.Ki = shares.Share()
 The variable, Ki, is a shared variable. More...
 
 main.Kd = shares.Share()
 The variable, Kd, is a shared variable. More...
 
 main.AngVel = shares.Share()
 The variable, AngVel, is a shared variable. More...
 
 main.Position = shares.Share()
 The variable, Position, is a shared variable. More...
 
 main.Contact = shares.Share()
 The variable, Contact, is a shared variable. More...
 
list main.taskList
 

Detailed Description

The main script for running the tasks of the final lab project.

The purpose of this main script is to run the tasks responsible for the functionality of the final project. The shares/queues that will be used in this lab are also primarily defined in this script.

@author     Jake Lesher
@author     Daniel Xu
@date       02/16/2022

Variable Documentation

◆ AngVel

main.AngVel = shares.Share()

The variable, AngVel, is a shared variable.

This shared variable is the value of __________

◆ clFlag

main.clFlag = shares.Share(False)

The variable, clFlag, is a shared variable.

This shared variable is a boolean that is shared between taskUser and taskController to determine whether or not the motor should be running in closed-loop.

◆ Contact

main.Contact = shares.Share()

The variable, Contact, is a shared variable.

This shared variable is a boolean telling if there is z-contact on the touch panel.

◆ Data

main.Data = shares.Share()

The variable, Data, is a queue of shared data.

This shared queue is the positional data of the encoder, in radians. It is updated in taskEncoder and recorded in taskUser.

◆ Delta

main.Delta = shares.Share()

The variable, Delta, is a queue of shared data.

This shared queue is the delta data of the encoder in radians. It is updated in taskEncoder and recorded in taskUser.

◆ Duty1

main.Duty1 = shares.Share()

The variable, Duty1, is a queue of shared data.

This shared queue is the duty cycle for motor 1 as requested in taskUser. The queue is then read in taskMotor, where it is sent to the motor driver.

◆ Duty2

main.Duty2 = shares.Share()

The variable, Duty2, is a queue of shared data.

This shared queue is the current angular velocity in rad/s. It is updated in taskEncoder and recorded in taskUser.

◆ Kd

main.Kd = shares.Share()

The variable, Kd, is a shared variable.

This shared variable is the value of the derivative gain to be used in the closed-loop.

◆ Ki

main.Ki = shares.Share()

The variable, Ki, is a shared variable.

This shared variable is the value of the integral gain to be used in the closed-loop.

◆ Kp

main.Kp = shares.Share()

The variable, Kp, is a shared variable.

This shared variable is the value of the proportional gain to be used in the closed-loop.

◆ Position

main.Position = shares.Share()

The variable, Position, is a shared variable.

This shared variable is the value position read by the touch panel [mm].

◆ taskList

list main.taskList
Initial value:
1 = [taskIMU.taskIMUFcn('taskIMU', 10_000, Data, Velocity),
2  taskPanel.taskPanelFcn('taskPanel', 10_000, Position, Contact),
3  taskUser.taskUserFcn('taskUser', 10_000, Data, Velocity, Duty1, Duty2, clFlag, Kp, Ki,Kd, Position, Contact),
4  taskMotor.taskMotorFcn('taskMotor', 10_000, Duty1, Duty2),
5  taskController.taskControllerFcn('taskController', 10_000, clFlag, Velocity, Duty1, Kp, Ki, Kd, Data, Duty2, Position, Contact)]
def taskControllerFcn(taskName, period, clFlag, Velocity, Duty1, Kp, Ki, Kd, Data, Duty2, Position, Contact)
This function interacts with the ClosedLoop driver, sending a duty cycle based on the calculated erro...
Definition: taskController.py:31
def taskIMUFcn(taskName, period, Data, Velocity)
This function interacts with the driver to update the position.
Definition: taskIMU.py:22
def taskMotorFcn(taskName, period, Duty1, Duty2)
This function interacts with the DRV8847 driver and corresponding motors.
Definition: taskMotor.py:31
def taskPanelFcn(taskName, period, Position, Contact)
This function interacts with the driver to update the position.
Definition: taskPanel.py:19
def taskUserFcn(taskName, period, Data, Velocity, Duty1, Duty2, clFlag, Kp, Ki, Kd, Position, Contact)
This function serves as the main user interface.
Definition: taskUser.py:140

◆ Velocity

main.Velocity = shares.Share()

The variable, Velocity, is a queue of shared data.

This shared queue is the current angular velocity in rad/s. It is updated in taskEncoder and recorded in taskUser.

◆ zFlag

main.zFlag = shares.Share(False)

The variable, zFlag, is a shared variable.

This shared variable is a boolean that is shared between taskUser and taskEncoder to determine whether or not the encoder object needs to be zeroed.