TRC Library for FTC (2011) 2011
TRC Library Code Project

C:/Users/Michael/Ftc/2011/code/trclib/pidctrl.h File Reference

Go to the source code of this file.

Data Structures

struct  PIDCTRL

Defines

#define _PIDCTRL_H
#define MOD_ID   MOD_PIDCTRL
#define PIDCTRLF_USER_MASK   0x00ff
#define PIDCTRLF_INVERSE   0x0001
#define PIDCTRLF_ABS_SETPOINT   0x0002
#define PID_TOLERANCE_NO_STOP   -1.0
#define PIDCtrlGetTarget(p)   (p.setPoint)
#define PIDCtrlIsOnTarget(p, t)   (abs(p.prevError) <= p.targetTolerance)

Functions

float PIDCtrlGetInput (__in int pidCtrlID)
void PIDCtrlReset (__out PIDCTRL &pidCtrl)
void PIDCtrlInit (__out PIDCTRL &pidCtrl, __in int pidCtrlID, __in float Kp, __in float Ki, __in float Kd, __in float minOutput, __in float maxOutput, __in int pidCtrlFlags)
void PIDCtrlSetPowerLimit (__out PIDCTRL &pidCtrl, __in float minOutput, __in float maxOutput)
void PIDCtrlSetTarget (__inout PIDCTRL &pidCtrl, __in float setPoint, __in float targetTolerance)
float PIDCtrlOutput (__inout PIDCTRL &pidCtrl)

Define Documentation

#define _PIDCTRL_H

Definition at line 16 of file pidctrl.h.

#define MOD_ID   MOD_PIDCTRL

Definition at line 23 of file pidctrl.h.

#define PID_TOLERANCE_NO_STOP   -1.0

Definition at line 32 of file pidctrl.h.

#define PIDCTRLF_ABS_SETPOINT   0x0002

Definition at line 30 of file pidctrl.h.

#define PIDCTRLF_INVERSE   0x0001

Definition at line 29 of file pidctrl.h.

#define PIDCTRLF_USER_MASK   0x00ff

Definition at line 28 of file pidctrl.h.

#define PIDCtrlGetTarget (   p)    (p.setPoint)

Definition at line 34 of file pidctrl.h.

#define PIDCtrlIsOnTarget (   p,
 
)    (abs(p.prevError) <= p.targetTolerance)

This macro determines if we are on target by comparing the last error to the given tolerance.

Parameters:
pPoints to the PID Control structure.
tSpecifies the error tolerance.
Returns:
Returns true if the last error is within the given tolerance.

Definition at line 73 of file pidctrl.h.


Function Documentation

float PIDCtrlGetInput ( __in int  pidCtrlID)
void PIDCtrlInit ( __out PIDCTRL pidCtrl,
__in int  pidCtrlID,
__in float  Kp,
__in float  Ki,
__in float  Kd,
__in float  minOutput,
__in float  maxOutput,
__in int  pidCtrlFlags 
)

This function initializes the PID control object.

Parameters:
pidCtrlPoints to the PID Control structure to be initialized.
pidCtrlIDSpecifies the PID controller ID.
KpSpecifies the Kp constant.
KiSpecifies the Ki constant.
KdSpecifies the Kd constant.
minOutputSpecifies the minimum value of the output range.
maxOutputSpecifies the maximum value of the output range.
pidCtrlFlagsSpecifies the PID controller flags.

Definition at line 111 of file pidctrl.h.

float PIDCtrlOutput ( __inout PIDCTRL pidCtrl)

This function calculates the output based on the current input.

Parameters:
pidCtrlPoints to the PID structure.
Returns:
Returns the calculate output value.

Definition at line 203 of file pidctrl.h.

void PIDCtrlReset ( __out PIDCTRL pidCtrl)

This function resets the PID control.

Parameters:
pidCtrlPoints to the PID Control structure to be reset.

Definition at line 81 of file pidctrl.h.

void PIDCtrlSetPowerLimit ( __out PIDCTRL pidCtrl,
__in float  minOutput,
__in float  maxOutput 
)

This function sets the output power limit.

Parameters:
pidCtrlPoints to the PID Control structure.
minOutputSpecifies the minimum output level.
maxOutputSpecifies the maximum output level.

Definition at line 149 of file pidctrl.h.

void PIDCtrlSetTarget ( __inout PIDCTRL pidCtrl,
__in float  setPoint,
__in float  targetTolerance 
)

This function sets the SetPoint.

Parameters:
pidCtrlPoints to the PID Control structure.
setPointSpecifies the SetPoint target.
targetToleranceSpecifies the the target tolerance of PID control.

Definition at line 174 of file pidctrl.h.

 All Data Structures Files Functions Variables Defines