This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Using the PID library from motorware library

Other Parts Discussed in Thread: MOTORWARE

I've been trying to use the pid module in the motorware library, but I've had a few issues. If I declare a pid handle as follows

PID_Handle currentPID;
currentPID = PID_init(currentPID, sizeof(PID_Obj));

sometimes the pid handle points to memory that I can't see in the debugger and therefore I cannot see the internal variables of the pid controller. I noticed however that if I use the following  syntax.

PID_Handle currentPID;
currentPID = malloc(sizeof(PID_Obj));
currentPID = PID_init(currentPID, sizeof(PID_Obj));

I am able to debug. Is this the correct way to initialize? I couldn't find any examples of this pid controller being used.