All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
pidlib.h File Reference

A port of the ROBOTC pidlib library, macros and prototypes. More...

Go to the source code of this file.

Data Structures

struct  _pidController
 Structure to hold all data for one instance of a PID controller. More...
 

Macros

#define kPidLibVersion   102
 Current pidlib Version is 1.02. More...
 
#define PIDLIB_USE_DYNAMIC   1
 Use heap for pid controller data rather than static data. More...
 
#define MAX_PID   4
 Allow 4 pid controllers. More...
 
#define PIDLIB_LUT_SIZE   128
 size of linearizing table More...
 
#define PIDLIB_LUT_FACTOR   20.0
 severity pf the linearize power function More...
 
#define PIDLIB_LUT_OFFSET   10
 offset below which the linearize function is not used More...
 
#define PIDLIB_INTEGRAL_DRIVE_MAX   0.25
 This causes the motor never to be given more than a 0.25 drive command due to integral. More...
 

Typedefs

typedef struct _pidController pidController
 Structure to hold all data for one instance of a PID controller. More...
 

Functions

pidControllerPidControllerInit (float Kp, float Ki, float Kd, tVexSensors port, int16_t sensor_reverse)
 Initialize the PID controller. More...
 
pidControllerPidControllerInitWithBias (float Kp, float Ki, float Kd, float Kbias, tVexSensors port, int16_t sensor_reverse)
 Initialize the PID controller - includes bias. More...
 
int16_t PidControllerUpdate (pidController *p)
 Update the pid process variables. More...
 
void PidControllerMakeLut (void)
 Create a power based lut. More...
 

Detailed Description

A port of the ROBOTC pidlib library, macros and prototypes.

Macro Definition Documentation

#define kPidLibVersion   102

Current pidlib Version is 1.02.

#define PIDLIB_USE_DYNAMIC   1

Use heap for pid controller data rather than static data.

#define MAX_PID   4

Allow 4 pid controllers.

#define PIDLIB_LUT_SIZE   128

size of linearizing table

#define PIDLIB_LUT_FACTOR   20.0

severity pf the linearize power function

#define PIDLIB_LUT_OFFSET   10

offset below which the linearize function is not used

#define PIDLIB_INTEGRAL_DRIVE_MAX   0.25

This causes the motor never to be given more than a 0.25 drive command due to integral.

Typedef Documentation

typedef struct _pidController pidController

Structure to hold all data for one instance of a PID controller.

Note
Currently at 64 bytes memory usage

Function Documentation

pidController* PidControllerInit ( float  Kp,
float  Ki,
float  Kd,
tVexSensors  port,
int16_t  sensor_reverse 
)

Initialize the PID controller.

pidController* PidControllerInitWithBias ( float  Kp,
float  Ki,
float  Kd,
float  Kbias,
tVexSensors  port,
int16_t  sensor_reverse 
)

Initialize the PID controller - includes bias.

int16_t PidControllerUpdate ( pidController p)

Update the pid process variables.

void PidControllerMakeLut ( void  )

Create a power based lut.