|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
||||
|
||||
|
My team hasn't done it, but I'm SURE someone out there has:
A PID loop that controls BOTH velocity and position. Basically it allows you to say "I want to move 33 feet forward, and do it at 6 fps." The PID loop manages both the acceleration to the target speed, keeps track of the distance travelled, and decelerates and corrects as you approach your target distance. Surprisingly, I did a search on CD, and didn't come up with much, although I probably missed something .Overviews, explanations, even code snippets would be much appreciated! -Shawn T. Lim |
|
#2
|
||||
|
||||
|
Re: Two variable PID? I know someone's done it =)...
sure, there are many systems that have PID loops on more than one parameter.
Think of it this way, PID loops are used to hold a system parameter at a desired level or output you could have a PID loop on position, and tell your robot "move forward 6 feet, move back 9 feet" and a separate loop that controls speed. In this case the position loop would invoke the speed loop. When its told to move forward it would set the speed in the forward direction. The 6 ft/S would be the upper limit of velocity. |
|
#3
|
|||||
|
|||||
|
Re: Two variable PID? I know someone's done it =)...
Quote:
|
|
#4
|
||||||
|
||||||
|
Re: Two variable PID? I know someone's done it =)...
Quote:
If you really want to control multiple parameters simultaneously, the best solution is to use a state space control algorithm. I would recommend doing a web search on "state space control" or "full state feedback". A good example of trying to control position and velocity with state space methods is shown here (from my alma mater, nonetheless). Last edited by Chris Hibner : 14-08-2006 at 18:54. |
|
#5
|
|||||
|
|||||
|
Re: Two variable PID? I know someone's done it =)...
Miss Daisy has done this for 2 years now.
It's actually not a 2 variable PID problem; it's two 1 variable PID problems. A velocity control loop looks like this: Velocity Command --> Velocity PID Controller--> Motor Output (with encoder counts/cycle looping back to the PID controller) A traditional position control loop looks like this: Position Command --> Position PID Controller --> Motor Output (with encoder counts looping back to the PID controller) However, the problem with position command directly affecting a motor output is that (1) motors are rarely linear in response, which is what you want for an ideal PID control system, and (2) there is no guarantee that multiple motors will get to the same position in the same amound of time. The easiest solution? Instead of generating a motor output from your position loop, generate a velocity command. The velocity controller will ensure that it reaches that speed, and it's response will be more linear, making tuning much easier. Your combined controller would look like this: Position Command --> Position PID Controller --> Velocity Command --> Velocity PID Controller --> Motor Output (with encoder counts looping to position controller and encoder counts/cycle looping to velocity controller) This makes user/autonomous code highly redundant: use the same velocity loop in both modes, but in user get the velocity command from the joystick position, and in autonomous get the velocity command from the position control loop (with setpoints generated by dead reckoning, sensors, etc.). If you need help with how to code this, let me know, but this should get you started. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| PID | shadowops06 | Programming | 5 | 16-06-2006 22:48 |
| Putting two and two together... | Andy Grady | General Forum | 13 | 08-01-2004 18:29 |
| Anyone know the animation winners? (I know team 191,who else | archiver | 2001 | 3 | 24-06-2002 03:24 |
| someone's making a robot that can pull 4 goals! | Anton Abaya | Rumor Mill | 18 | 12-02-2002 21:10 |
| Looks like someone's been busy... | Carolyn Duncan | Chit-Chat | 27 | 03-08-2001 21:41 |