I have a custom servo ctrl, where I set the despos of each motor, and then user the stock servoCtrl function.
I'm noting that Mpts->PosError != (Mptr->DesPos - Mptr->ActPos), contrary to the manual, unless I do the computation myself inuser_pid_ctrl.
Is this normal, or is the manual wrong when using a custom ctrl?
Also, while i'm here:
- I regularly have to reselect the "user servo setup" routine in "realtime routines". It will show the correct function already selected in the drop down menu, but I have to reselect it for each motor. Any known cause/fix for this? I've added code of my own to detect when it occurs, so my program doesn't go off using the wrong servoCtrl function.
-The usralgo.ko is only created in debug more, meaning code changes, even with a complete rebuild, in release mode are wrong (as I have to manually copy the usralgo.ko file to the release folder each time). Any fix for this?
All this with the latest (1.5.0.21) IDE.
Thanks!
Bart.
double user_pid_ctrl(struct MotorData *Mptr){
.....
Mptr->DesPos = SOMEVALUE;
//Without this line, poserror is wrong
Mptr->PosError = Mptr->DesPos - Mptr->ActPos;
//--------------------------------------------------------------
// Use the built in PID loop to run the actual command
return pshm->ServoCtrl(Mptr);
}