ME 305
Variables
main.py File Reference

Initializes values and manages tasks. More...

Variables

 main.vFlag = shares.Share(False)
 Signal that the button d has been pressed. More...
 
 main.duty_1 = shares.Share(0)
 Duty Cycle for Motor 1. More...
 
 main.duty_2 = shares.Share(0)
 Duty Cycle for Motor 2. More...
 
 main.Velo = shares.Share(0)
 Stores a single data point reading the delta time between updates. More...
 
 main.Kd = shares.Share('')
 Stores the target velocity value. More...
 
 main.opmode = shares.Share('')
 Shared variable that holds the IMU operating mode.
 
 main.cFlag = shares.Share(False)
 Shared variable that holds the IMU operating mode.
 
 main.calwrite = shares.Share(False)
 Shared variable that holds the IMU operating mode.
 
 main.cal_byte = shares.Share('')
 Shared variable that holds the IMU operating mode.
 
 main.calread = shares.Share(False)
 Shared variable to begin reading IMU calibration data.
 
 main.bFlag = shares.Share(False)
 Shared variable to begin platofrm position and velocity data collection.
 
 main.PWM_tim = pyb.Timer(3, freq = 20000)
 The instance of the driver class. More...
 
 main.motor_1
 Obect to contain proper settings to run motor 1. More...
 
 main.motor_2
 Obect to contain proper settings to run motor 2. More...
 

Detailed Description

Initializes values and manages tasks.

This is the main file to run the tasks required to interact with the encoder. It will continually call the specified task until the user interrupts the program by ending it with Keyboard Interrupt (Ctrl-C). Variables shared between tasks are initialized here and the tasks, and there periods are defined to run at 100Hz. Pictures of the state transition diagrams can be found in their respective task files. A picture of the task diagram can be found below. To view the code repository for this lab, see link below.

Code repository for this lab: https://bitbucket.org/rdeanr/me305/src/master/Lab4/

See Lab 4 for state transition diagrams and other plots

Author
Ryan Dean
Zachary Hendrix
Date
2/3/2022

Variable Documentation

◆ duty_1

main.duty_1 = shares.Share(0)

Duty Cycle for Motor 1.

Shared variable duty cycle for motor 1.

Holds the duty cycle for Motor 1 to transport between task_user and task_motor

◆ duty_2

main.duty_2 = shares.Share(0)

Duty Cycle for Motor 2.

Shared variable duty cycle for motor 2.

Holds the duty cycle for Motor 2 to transport between task_user and task_motor

◆ Kd

main.Kd = shares.Share('')

Stores the target velocity value.

Used to communicate between tasks in order to pass the gain across files.

◆ motor_1

main.motor_1
Initial value:
1= motor.Motor([1, 2], PWM_tim, pyb.Pin.cpu.B4,
2 pyb.Pin.cpu.B5)
Motor Class.
Definition: motor.py:21

Obect to contain proper settings to run motor 1.

◆ motor_2

main.motor_2
Initial value:
1= motor.Motor([3, 4], PWM_tim, pyb.Pin.cpu.B0,
2 pyb.Pin.cpu.B1)

Obect to contain proper settings to run motor 2.

◆ PWM_tim

main.PWM_tim = pyb.Timer(3, freq = 20000)

The instance of the driver class.

Objec to contain and set Nucleo timing settings

Creates a new driver instance that is used through this lab. This gets referenced to use all of the driver methods.

◆ Velo

main.Velo = shares.Share(0)

Stores a single data point reading the delta time between updates.

Shared variable angular velocity of platform.

◆ vFlag

main.vFlag = shares.Share(False)

Signal that the button d has been pressed.

Signal that the button v has been pressed.

Shared object so we can update its value in every file. It turns true after z is pressed, and turns false after the delta has been returned.

Shared object signaling that the user wants to collect platform velocity data