Go to Post I like the way you are saving weight by cutting out the center of the speed controllers. - jcatt [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rating: Thread Rating: 26 votes, 5.00 average. Display Modes
  #16   Spotlight this post!  
Unread 02-11-2015, 11:31 AM
notmattlythgoe's Avatar
notmattlythgoe notmattlythgoe is offline
Flywheel Police
AKA: Matthew Lythgoe
FRC #2363 (Triple Helix)
Team Role: Mentor
 
Join Date: Feb 2010
Rookie Year: 2009
Location: Newport News, VA
Posts: 1,712
notmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond repute
Re: PID control help

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


Yes.
Reply With Quote
  #17   Spotlight this post!  
Unread 02-11-2015, 11:58 AM
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 7,998
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
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

Reply With Quote
  #18   Spotlight this post!  
Unread 02-11-2015, 12:26 PM
notmattlythgoe's Avatar
notmattlythgoe notmattlythgoe is offline
Flywheel Police
AKA: Matthew Lythgoe
FRC #2363 (Triple Helix)
Team Role: Mentor
 
Join Date: Feb 2010
Rookie Year: 2009
Location: Newport News, VA
Posts: 1,712
notmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond repute
Re: PID control help

Quote:
Originally Posted by Ether View Post

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?
Reply With Quote
  #19   Spotlight this post!  
Unread 02-11-2015, 01:02 PM
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 7,998
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: PID control help

Quote:
Originally Posted by notmattlythgoe View Post
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.



Attached Thumbnails
Click image for larger version

Name:	2PID.png
Views:	24
Size:	15.6 KB
ID:	18282  
Reply With Quote
  #20   Spotlight this post!  
Unread 02-11-2015, 01:06 PM
gpetilli gpetilli is offline
Registered User
FRC #1559
 
Join Date: Jan 2009
Location: Victor, NY
Posts: 285
gpetilli is a name known to allgpetilli is a name known to allgpetilli is a name known to allgpetilli is a name known to allgpetilli is a name known to allgpetilli is a name known to all
Re: PID control help

Quote:
Originally Posted by notmattlythgoe View Post
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.
Reply With Quote
  #21   Spotlight this post!  
Unread 02-11-2015, 01:07 PM
notmattlythgoe's Avatar
notmattlythgoe notmattlythgoe is offline
Flywheel Police
AKA: Matthew Lythgoe
FRC #2363 (Triple Helix)
Team Role: Mentor
 
Join Date: Feb 2010
Rookie Year: 2009
Location: Newport News, VA
Posts: 1,712
notmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond repute
Re: PID control help

Quote:
Originally Posted by Ether View Post
...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.

Last edited by notmattlythgoe : 02-11-2015 at 01:09 PM.
Reply With Quote
  #22   Spotlight this post!  
Unread 02-11-2015, 01:09 PM
cstelter cstelter is offline
Programming Mentor
AKA: Craig Stelter
FRC #3018 (Nordic Storm)
Team Role: Mentor
 
Join Date: Apr 2012
Rookie Year: 2012
Location: Mankato, MN
Posts: 77
cstelter will become famous soon enough
Re: PID control help

Quote:
Originally Posted by Ether View Post
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.
Reply With Quote
  #23   Spotlight this post!  
Unread 02-11-2015, 01:12 PM
notmattlythgoe's Avatar
notmattlythgoe notmattlythgoe is offline
Flywheel Police
AKA: Matthew Lythgoe
FRC #2363 (Triple Helix)
Team Role: Mentor
 
Join Date: Feb 2010
Rookie Year: 2009
Location: Newport News, VA
Posts: 1,712
notmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond repute
Re: PID control help

Quote:
Originally Posted by cstelter View Post
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.
Reply With Quote
  #24   Spotlight this post!  
Unread 02-11-2015, 01:16 PM
notmattlythgoe's Avatar
notmattlythgoe notmattlythgoe is offline
Flywheel Police
AKA: Matthew Lythgoe
FRC #2363 (Triple Helix)
Team Role: Mentor
 
Join Date: Feb 2010
Rookie Year: 2009
Location: Newport News, VA
Posts: 1,712
notmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond repute
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?
Reply With Quote
  #25   Spotlight this post!  
Unread 02-11-2015, 01:19 PM
gpetilli gpetilli is offline
Registered User
FRC #1559
 
Join Date: Jan 2009
Location: Victor, NY
Posts: 285
gpetilli is a name known to allgpetilli is a name known to allgpetilli is a name known to allgpetilli is a name known to allgpetilli is a name known to allgpetilli is a name known to all
Re: PID control help

Quote:
Originally Posted by cstelter View Post
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.
Reply With Quote
  #26   Spotlight this post!  
Unread 02-18-2015, 10:22 PM
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 7,998
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: PID control help

Quote:
Originally Posted by Ether View Post
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.


Attached Thumbnails
Click image for larger version

Name:	sync2motors (symmetric).png
Views:	233
Size:	18.7 KB
ID:	18417  
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 08:44 AM.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


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