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

A port of the ROBOTC pidlib library. More...

#include <stdlib.h>
#include <math.h>
#include "ch.h"
#include "hal.h"
#include "vex.h"
#include "pidlib.h"
#include "fastmath.c"

Macros

#define _LinearizeDrive(x)   PidDriveLut[abs(x)] * sgn(x)
 Macro to optimize LUT access. 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 ()
 Create a power based lut. More...
 

Detailed Description

A port of the ROBOTC pidlib library.

Macro Definition Documentation

#define _LinearizeDrive (   x)    PidDriveLut[abs(x)] * sgn(x)

Macro to optimize LUT access.

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.