Page 1 of 1

Position Control jitters around target position

Posted: Thu Mar 07, 2019 9:03 am
by cjr
Next question ;)

Again using Command 65, i'm moving to some target position. Works so far, deccelerates, crawls to target (depending on Ki and MaxI).

As soon as the Target position is reached (the position error changes its sign), RoboClaw suddenly speeds up a little bit, overshooting the target (e.g. Pos 100000) by e.g. 800 steps. Then it reverses, crawls again to the target and the cycle repeats. I can reduce the behaviour by lowering Ki and/or MaxI till the DeadZone stops the motor, but i would really like to understand what's happening.

Release-notes show that You dropped the Leaky Integrator. I have yet to understand what the Back Calculation thing does.

Parameters are:

Velocity Kp = 0.953690
Velocity Ki = 0.059158
Velocity Kd = 0.000000
QPPS = 50000
Position Kp = 10.000000
Position Ki = 0.029297
Position Kd = 0.000000
Max I = 100000
Deadzone = 30
Min Position = 0
Max Position = 1163000
S3 Pin Func = 0 / 0x00
S4 Pin Func = 2 / 0x02
S5 Pin Func = 2 / 0x02

These are the values given to the Arduino/Linux library, so the PID values are the floating point ones. The Velocity PID values are from the AutoTune, the Position ones are handcrafted till positioning was fairly ok.

Many Thanks in advance.

Christof

Re: Position Control jitters around target position

Posted: Thu Mar 07, 2019 10:02 am
by Basicmicro Support
This is proabbly an interactioin of the Vel integral and Pos integral. You usually do not want to use a Pos integral when using cascaded control. At most you would use Vel PI and Pos PD. It defintely sounds like this is different than normal hunting/stiction caused oscilations which is why I suspect an unexpected interaction.

Note the +-30 deadzone is probably also part of this interaction problem.

Start by zeroing the Pos I and IMax settings. If position accuracy isnt good enough increase P but also make sure you have Vel P and I tuned well. If they are tuned well then a simple Vel PI and Pos P cascaded controller usually gives very good results. I recommend zeroing Deadzone until you have a good Pos P tuned and then add Deadzone to prevent hunting/stiction caused oscilations. Note to get higher Pos P(which will give a more aggressive movement) you can add some Pos D to dampen out any overshoot.

Re: Position Control jitters around target position

Posted: Thu Mar 14, 2019 10:38 am
by cjr
Thank You for this information. I will try this next week when i'm back at the machine.

Re: Position Control jitters around target position

Posted: Tue May 28, 2019 6:59 am
by cjr
The "next week" thing never happened, but a colleague did some tests and optimizations and a different encoder and the movement is now good enough for the moment.

Re: Position Control jitters around target position

Posted: Wed May 29, 2019 10:40 am
by Basicmicro Support
If you still have hunting around the target position this can be caused by backlash in the geartrain as well. You can set a small amount of deadzone in the position PID settings. 2 to 5 in most cases.

Re: Position Control jitters around target position

Posted: Wed Jun 05, 2019 12:04 am
by cjr
Thank You. Yes, we definitively have some backslash, we know this also from our older motors and controllers. Everywhere we allow some amount of being not-exactly-on-target-position, so no problem here.

I was under the impression that the RoboClaw stops the movement as soon as it is for some amount of time in the deadzone. Is this correct?

Re: Position Control jitters around target position

Posted: Wed Jun 05, 2019 12:07 am
by cjr
Oh, about the hunting: The target position is reached exactly, then it is stable for maybe 200-300 ms, then it jumps 100-200 steps away and crawls back to the target. Then the cycle starts anew, only in the other direction. It does not stay long enough in the deadzone to stop the movement. At least that's my hypothesis from the looks of it :D

Re: Position Control jitters around target position

Posted: Thu Jun 06, 2019 10:15 am
by Basicmicro Support
Its not as specific as that. It's just when you set deadzone what is considered zero error is wider than 0. This causes the PID to stop the motor.

100-200 is huge. I would not expect hunting like this in general.

Is the system non-linear?
Is there significant stiction?
What are your tuned PID values? Integral specifically can cause some odd behaviors.