C/C++ Question PID Library Wrapper - WIP ?


Active Member
Licensed User
I spent time trying to wrap the PID Library and got pretty far.
I did it mostly as an exercise on how to wrap a library as it would have been a lot easier to just write it as a code module.

Question on Initialize ...

//commonly used functions **************************************************************************
PID(double*, double*, double*, // * constructor. links the PID to the Input, Output, and
double, double, double, int, int); // Setpoint. Initial tuning parameters are also set here.
// (overload for specifying proportional mode)

/*Constructor (...)*********************************************************
* The parameters specified here are those for for which we can't set up
* reliable defaults, so we need to have the user set them.
PID::pID(double* Input, double* Output, double* Setpoint,
double Kp, double Ki, double Kd, int POn, int ControllerDirection)

When I use the Constructor and wrap it as the Initialize Method it has 3 pointers to doubles, (Input, Output, and Setpoint. Do I convert these to ArrayDouble* so something like:

PID(ArrayDouble* Input, ArrayDouble* Output, ArrayDouble* SetPoint, ...

Then .... MyInput = (Double *)Input->data or would I use an Object*

PID(Object* Input, Object* Output, Object* SetPoint, ... ???

I attached my attempt at a library wrapper but it is still very much a work in progress.....


  • rpid.zip
    8.6 KB · Views: 237