[Dprglist] PID

Murray Altheim murray18 at altheim.com
Thu Oct 1 01:23:59 PDT 2020


On 1/10/20 4:53 am, Doug Paradis wrote:
> Murray,
>        I haven't been able to dig into your code or data, however, I know of one situation that can lead to a similar issue. If your target location is defined as a hard value (ex. 2 meters) without tolerances, the controller will hunt for 
> the exact tick value. It is better to place a tolerance around the position target, such as, "if ((position >= target + tolerance) && (position <= target - tolerance))". Typical motor encoder setups have a 1000 or more ticks/revolution. If 
> we have a setup with 80 mm wheels and 1250 ticks / revolution. The position change per tick is ~0.2 mm / tick (i.e., 200 microns). I have seen encoder/wheel combinations that have distance to tick values even smaller.
>       Why you may see only one wheel hunt is because the other wheel has reached the targeted value, while the second motor hunts to find its perfect value. If you are decreasing velocity as you approach the target, small distances from the 
> target will require the P in controller to ramp up so that the robot (with inertia) can move to make that small adjustment. This might cause the robot to overshot the "exact tick" when the robot moves  causing the P to reverse direction ad 
> infinitum ... If the other motor has a shut off when target reached, it will remain stopped, however if it is still controlling, the robot movement by one wheel will cause the other wheel to move off its target and also start to hunt.
> 
>       This may not apply to your situation, but it is a trap that I have seen.

Hi Doug,

I haven't actually been able to find out where that hunting behaviour comes
from but your explanation sounds pretty much like a real possibility for
what I've got code-wise and what I've (cursorily) observed in the logs.
I.e., what you've described sounds suspiciously like what might be
happening. I hadn't noticed it happening when I was simply testing and
tuning the PID controller, it seems to have cropped up for the first time
when I was running this "one meter" behaviour with the acceleration and
deceleration and trying to stop at a tick limit. It will do the hunting
behaviour while the robot is on the stand (unloaded, not connected to
the ground) so I don't think it's a port-starboard interaction but the
rest of it is entirely possible.

Cheers,

Murray

...........................................................................
Murray Altheim <murray18 at altheim dot com>                       = =  ===
http://www.altheim.com/murray/                                     ===  ===
                                                                    = =  ===
     In the evening
     The rice leaves in the garden
     Rustle in the autumn wind
     That blows through my reed hut.
            -- Minamoto no Tsunenobu



More information about the DPRGlist mailing list