Ball Balancer Project
Functions | Variables
taskController.py File Reference

The task that interfaces with the Closed Loop class. More...

Functions

def taskController.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 error. More...
 

Variables

 taskController.S0_INIT = micropython.const(0)
 
 taskController.S1_SET = micropython.const(1)
 
 taskController.S2_ACTIVE = micropython.const(2)
 
 taskController.S3_NOBALL = micropython.const(3)
 

Detailed Description

The task that interfaces with the Closed Loop class.

This task's main function is to provide the ClosedLoop driver with the user-selected gain and Vref values.

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

Function Documentation

◆ taskControllerFcn()

def taskController.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 error.

This function calls upon the driver to set the duty cycle percentage for motor 1.

Parameters
taskNameis the name associated the with taskController in main.py.
periodsets the rate at which taskController is to run.
clFlagis the shared boolean that toggles closed-loop control.
Velocityis the share of the velocity value with taskEncoder.py
Vrefis the share of the velocity requested by the user in taskUser.
Duty1is the share that contains the duty cycle percentage for motor 1.
Kpis the share of the user-requested proportional gain.
Kiis the share of the user-requested integral gain.