[Dprglist] PID

Murray Altheim murray18 at altheim.com
Thu Oct 1 13:16:31 PDT 2020


Hi Patrick,

I'm on version 4 of my PID controller. Version 1 was written with a great
deal of ignorance of what actually constituted a PID controller, a bit of
seat-of-the-pants programming. I knew that the P term was calculated from
the error and knew that setting the setpoint from 0 to 70 was going to
create a huge error, I (in version 1) wrote the slew into the PID controller
itself. So I had some notion that somewhere that big jerk in input value
had to be handled, I just didn't know where.

As David Anderson has pointed out, that kind of control needs to be waaay
higher in the decision tree, not down at the limbic system level of the
PID controller. I like the idea of putting it so far up the tree that it
is itself a behaviour of sorts, or a prescription for a behavioural
"personality". I wouldn't want to get in a drunk or a belligerent elevator,
and I want my robot to be likewise civil.

Cheers,

Murray

On 2/10/20 3:28 am, Patrick R. Michaud wrote:
> The page that I found useful in concept is https://acme-robotics.gitbook.io/road-runner/tour/motion-profiling .  It helps to also read the previous two pages on "PID Control" and "Feedforward Control" to understand the setup for this page.
> 
> The introductory paragraph on that page describes pretty much what I think you're trying to achieve/avoid by ramping velocity up/down instead of using straight PID:
> 
>     For a moment, let's return to the elevator example. While the addition
>     of a gravity feedforward in the last section improves the position
>     control, the PID controller is still doing the majority of the work
>     to follow step responses. When a new position is commanded, the error
>     immediately spikes and the controller saturates, sending the carriage
>     at the mechanism's maximum acceleration. Soon the carriage slows down
>     and overshoots the setpoint a little before settling around the
>     commanded position. While efficient, the sudden acceleration causes
>     unnecessary mechanical/electrical strain and the resultant overshoot
>     wastes time. For drivetrain movements, there are additional issues
>     with wheel slippage.
> 
> The page then has a graph where they show the generation of a motion profile of velocity along the desired movement path, and the PID controller then follows that profile rather than absolute position.
> 
> For our team's robot, it was amazing how well the motion profiling was able to handle navigation, giving the team a great deal of control over acceleration and velocity, and (to your point) making the robot have smooth moves rather than appearing "jerky" in its movements.  You can see an example run in the first 36 seconds of https://www.youtube.com/watch?v=Rn6QyGm2-2U , where the robot is "autonomous" and driving completely on its own.
> 
> Pm
> 
> 
> On Thu, Oct 01, 2020 at 09:24:06PM +1300, Murray Altheim wrote:
>> Hi Patrick,
>>
>> I wasn't aware of the term, but one of the things I remember David
>> Anderson saying in his YouTube video, amplified by some other things
>> I'd read/seen, was that tuning the PID and developing the robot's
>> behaviours essentially sets up its observable personality. And being
>> a child of aesthetics (i.e., background in the arts) I want my robot
>> to exhibit smooth moves rather than appear jerky (so uncool). So
>> once I've got to the point where I can reliably control it I'll be
>> interested in exploring this idea of motion profiling.
>>
>> Thanks for that.
>>
>> Cheers,
>>
>> Murray
>>
>> On 30/09/20 7:11 pm, Patrick R. Michaud wrote:
>>> This reminds me of what I've seen called "motion profiling" in FTC/FRC, where the motors (driving wheels) use PID to follow a velocity curve rather than a position setpoint.  The end result is a lot smoother stop/start of the motors, since a new position setpoint doesn't result in a drastic step change in the P-term going to the motors.
>>>
>>> The navigation library (Roadrunner) my team used in last season's competition used velocity motion profiling for its drivetrain, and it was really nice to not have sudden starts/stops impacting the autonomous navigation.  They also wanted to try to do some motion profiling on their lift mechanism, but didn't quite get that working (they were able to tune a simpler PID to be "good enough").
>>>
>>> Pm
>>>
>>> On Wed, Sep 30, 2020 at 02:00:29PM +1300, Murray Altheim via DPRGlist wrote:
>>>> Hi Rud,
>>>>
>>>> The setpoint for the PID controllers is a velocity value. The basic
>>>> task is to accelerate to cruising velocity at 25% of the distance,
>>>> then slow at 90% down to targeting velocity to stop at 2m.
>>>>
>>>>     0                              1m                             2m
>>>>     0          ->cruising                             ->targeting  0
>>>>     0              25              50             75         90  100
>>>>     |_______________|_______________|______________|__________|____|
>>>>
>>>> Does that make any more sense?
>>>>
>>>> Cheers,
>>>>
>>>> Murray
>>>>
>>>> On 30/09/20 1:50 pm, Rud Merriam via DPRGlist wrote:
>>>>> Hi,
>>>>>
>>>>> I'm not understanding the log outputs.
>>>>>
>>>>> At line 9740 the stbd motor has reached the 2m mark. The setpoint is set to 10.00 while earlier it was set to 50.00. I would think the setpoint should be the end position, i.e. 2m equivalent.
>>>>>
>>>>> At line 9754 setpoint is not 0 and the error is 10.019. If it is at the end position the error should be 0. After that error is non-zero so outputs are generated which move the motors.
>>>>>
>>>>> IMO the setpoint should be the number of steps (or equivalent) you want the motor to have moved. The error is the difference.
>>>>>
>>>>>
>>>>> -73 -
>>>>> *Rud Merriam K5RUD*
>>>>> /Mystic Lake Software/ <http://mysticlakesoftware.com/>
>>>>>
>>>>> On 9/29/20 7:24 PM, Murray Altheim via DPRGlist wrote:
>>>>>> Hi,
>>>>>>
>>>>>> Addressing the hunting behaviour on the KR01 robot that we've discussed
>>>>>> previously (i.e., rocking back and forth about 1/8 of a wheel turn after
>>>>>> stopping), here's a full color (!) log of the journey:
>>>>>>
>>>>>> https://service.robots.org.nz/wiki/attach/PIDController/pid_bounce_log.html
>>>>>>
>>>>>> I may mention this in tonight's video discussion, thought to provide a link
>>>>>> here. It basically shows the encoder and PID controller output as the robot
>>>>>> accelerates to cruising speed then decelerates to a slow, targeting velocity
>>>>>> before attempting to stop at the 2 meter mark.
>>>>>>
>>>>>> 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
>>>>>>
>>>>>> _______________________________________________
>>>>>> DPRGlist mailing list
>>>>>> DPRGlist at lists.dprg.org
>>>>>> http://lists.dprg.org/listinfo.cgi/dprglist-dprg.org
>>>>>
>>>>> _______________________________________________
>>>>> DPRGlist mailing list
>>>>> DPRGlist at lists.dprg.org
>>>>> http://lists.dprg.org/listinfo.cgi/dprglist-dprg.org
>>>>>
>>>>
>>>> -- 
>>>>
>>>> ...........................................................................
>>>> 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
>>>>
>>>> _______________________________________________
>>>> DPRGlist mailing list
>>>> DPRGlist at lists.dprg.org
>>>> http://lists.dprg.org/listinfo.cgi/dprglist-dprg.org
>>>
>>
>> -- 
>>
>> ...........................................................................
>> 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
>>
> 

-- 

...........................................................................
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