Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Java (http://www.chiefdelphi.com/forums/forumdisplay.php?f=184)
-   -   PID control help (http://www.chiefdelphi.com/forums/showthread.php?t=134276)

notmattlythgoe 11-02-2015 11:31

Re: PID control help
 
Quote:

Originally Posted by Ether (Post 1441756)
Please don't take this the wrong way, but I need to know before answering: did you see the attachment?



Yes.

Ether 11-02-2015 11:58

Re: PID control help
 

Motor1 is controlled by a PID whose setpoint is the driver's position command and whose process variable is position feedback from encoder1. The output of this PID is limited to 90% to allow for motor tolerances as suggested by Steve in post#9.

Motor2 is controlled by a closed-loop controller whose output is the sum of two terms:
1) the output from an Integral controller whose setpoint is encoder1 position and whose process variable is encoder2 position, and

2) the output from a Proportional controller whose setpoint is the driver's position command and whose process variable is encoder2 position


notmattlythgoe 11-02-2015 12:26

Re: PID control help
 
Quote:

Originally Posted by Ether (Post 1441801)

Motor1 is controlled by a PID whose setpoint is the driver's position command and whose process variable is position feedback from encoder1. The output of this PID is limited to 90% to allow for motor tolerances as suggested by Steve in post#9.

Motor2 is controlled by a closed-loop controller whose output is the sum of two terms:
1) the output from an Integral controller whose setpoint is encoder1 position and whose process variable is encoder2 position, and

2) the output from a Proportional controller whose setpoint is the driver's position command and whose process variable is encoder2 position


Would this be better or more efficient than having your motor1, and a motor2 that just uses a positional PID controller and the setpoint is always the position of motor1?

Ether 11-02-2015 13:02

Re: PID control help
 
1 Attachment(s)
Quote:

Originally Posted by notmattlythgoe (Post 1441816)
Would this be better or more efficient than having your motor1, and a motor2 that just uses a positional PID controller and the setpoint is always the position of motor1?

...and the process variable for Motor2 is encoder2 position, like this?

The problem I see with that is the transient response to large step changes in driver position command. Motor1 responds immediately to the large change, but Motor2's controller must wait for the error to form between encoder1 & encoder2. Granted, you could crank the P gain way up for Motor2, but it's not immediately clear how well that would work in practice.




gpetilli 11-02-2015 13:06

Re: PID control help
 
Quote:

Originally Posted by notmattlythgoe (Post 1441816)
Would this be better or more efficient than having your motor1, and a motor2 that just uses a positional PID controller and the setpoint is always the position of motor1?

Yes. If motor2 is only a slave to motor1, then motor2 will not move until a sufficient error in position has occurred (due to a change in command to motor1).

What Ether suggested is basically to send the same command to both motors simultaneously, and use the Integrated error between the positions to fine tune motor2. The Integrated error has high DC gain but slow "step response".

The settled response for both systems should be similar, but the match while changing position should be much better with Ether's system.

notmattlythgoe 11-02-2015 13:07

Re: PID control help
 
Quote:

Originally Posted by Ether (Post 1441840)
...and the process variable for Motor2 is encoder2 position, like this?

The problem I see with that is the transient response to large step changes in driver position command. Motor1 responds immediately to the large change, but Motor2's controller must wait for the error to form between encoder1 & encoder2. Granted, you could crank the P gain way up for Motor2, but it's not immediately clear how well that would work in practice.




Yes like that.

Yeah, that could definitely cause some problems. Depending on the system you might be able to tune it to react correctly, but it could difficult. The more you limit the speed of motor1 the better the system would react I'd imagine.

The more I think about it, the more I like your original proposal. I wish I had a system I could try it out on.

cstelter 11-02-2015 13:09

Re: PID control help
 
Quote:

Originally Posted by Ether (Post 1441749)
For case (a), would something like this work? Is there a better way?



I'll play :-).

Would this work? I don't know.

Is there a better way? I don't know.

This seems to be taking me back to one or two courses I had in college regarding stability and Laplace transforms I think-- but I'm not sure about that. That work was all based on electrical circuits, but I think the math translates to any system of differential equations. Either that or I'm way off in the weeds. I've had no need to revisit that part of my education in the past 25 years, so it's not just rusty, it's frozen/locked up.

The part I find curious is using different error terms for P and I on the 'slave' motor. I have absolutely no idea what effect that might have, nor how to solve for it. Thus proving my inability to claim any guru status whatsoever. But I am finding the discussion fascinating, so I really appreciate it.

Intuitively it seems it could work, but whether or not in practice the system could keep up with it, or if another formulation would be more effective, I don't know.

notmattlythgoe 11-02-2015 13:12

Re: PID control help
 
Quote:

Originally Posted by cstelter (Post 1441849)
I'll play :-).

Would this work? I don't know.

Is there a better way? I don't know.

This seems to be taking me back to one or two courses I had in college regarding stability and Laplace transforms I think-- but I'm not sure about that. That work was all based on electrical circuits, but I think the math translates to any system of differential equations. Either that or I'm way off in the weeds. I've had no need to revisit that part of my education in the past 25 years, so it's not just rusty, it's frozen/locked up.

The part I find curious is using different error terms for P and I on the 'slave' motor. I have absolutely no idea what effect that might have, nor how to solve for it. Thus proving my inability to claim any guru status whatsoever. But I am finding the discussion fascinating, so I really appreciate it.

Intuitively it seems it could work, but whether or not in practice the system could keep up with it, or if another formulation would be more effective, I don't know.

I'd imagine your P values would be very similar if not identical. The I value would definitely be different. I'd imagine you'd need a larger I value on motor2 to react fast enough to the differences in distance.

notmattlythgoe 11-02-2015 13:16

Re: PID control help
 
One thing we decided to do differently this year was control our autonomous drivetrain distances by using a speed controlled PID with a P controller setting the setpoint based on the distance to target. We've had some major success with it so far.

What if you used identical speed controlled PID loops and used the I controller from Ether's proposal to adjust the setpoint of motor 2?

gpetilli 11-02-2015 13:19

Re: PID control help
 
Quote:

Originally Posted by cstelter (Post 1441849)
I'll play :-).

Would this work? I don't know.

Is there a better way? I don't know.

This seems to be taking me back to one or two courses I had in college regarding stability and Laplace transforms I think-- but I'm not sure about that. That work was all based on electrical circuits, but I think the math translates to any system of differential equations. Either that or I'm way off in the weeds. I've had no need to revisit that part of my education in the past 25 years, so it's not just rusty, it's frozen/locked up.

The part I find curious is using different error terms for P and I on the 'slave' motor. I have absolutely no idea what effect that might have, nor how to solve for it. Thus proving my inability to claim any guru status whatsoever. But I am finding the discussion fascinating, so I really appreciate it.

Intuitively it seems it could work, but whether or not in practice the system could keep up with it, or if another formulation would be more effective, I don't know.

This is a bit more complicated than even most college courses (although the concepts are all there). Most courses only deal with one system of equations at a time, not two slaved systems. Don't feel bad about being lost in the weeds.

Basically any servo control loop "attenuates" the error. Three things about this statement -
1) it needs error to work
2) the error is never zero
3) far better reduce the systematic error before entering the loop

By sending the same command to both motors simultaneously, you reduce the error before it even develops. The servo has less work to do, is easier to tune and responds faster.

Ether 18-02-2015 22:22

Re: PID control help
 
1 Attachment(s)
Quote:

Originally Posted by Ether (Post 1441749)
For case (a), would something like this work? Is there a better way?

This might be a better way. Hat tip to Jared Russell at this thread.




All times are GMT -5. The time now is 11:15.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi