Re: [NXC]Motor-control-functions
Posted: 13 Dec 2012, 08:01
indeed I'm also curious what mazzn tried , but anyway -
IMHO the PosReg functions are far too complicated to handle and have lots of issues concerning intern tacho counters and internally stored targeting errors which add up to increasing error values over the time, especially when passive shifting happens intermediately.
So I'm not surprised that those functions might have led to suboptimal usage.
the same it's about this code: far too hard to understand and far too complicated to modify:
IMO, an absolute targeting function should have the following simple syntax - all additonal adjustment must be managed by FW or API functions, maybe userinvention possible by adjusting seperate global motor variables (P, I, D, ramp/up/down) but no compulsion of being passed at every function call which makes the handling much more convenient:
IMHO the PosReg functions are far too complicated to handle and have lots of issues concerning intern tacho counters and internally stored targeting errors which add up to increasing error values over the time, especially when passive shifting happens intermediately.
So I'm not surprised that those functions might have led to suboptimal usage.
the same it's about this code: far too hard to understand and far too complicated to modify:
Code: Select all
MotorTarget [OUT_x] = ZZZ; // set Encoder-Target MotorTarget[OUT_x] internally used by a PID control, automatically setting of ramp up/down
MoveMotorTo(MotorTarget[OUT_x]) { // PID-Control takes motorcontrol ; MotorRunState set to "busy"; interruptable by user at any time,
while (MotorRunState(OUT_x) != idle) } // while movement is not finished and target has not been reached finally;
BreakMotor(OUT_x); // after target has been reached perfectly: break or coast, switch off PID-Control, MotorRunstate set to "idle"