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.