Go to Post He is just one of the dozens of evil minions I have molded into my image over the years. Be afraid world, be very afraid. - Andy Grady [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
 
Thread Tools Rating: Thread Rating: 51 votes, 5.00 average. Display Modes
  #1   Spotlight this post!  
Unread 02-03-2015, 17:21
Aero Aero is offline
consumes pizza, produces code
AKA: Ari Lotter
FRC #0865 (Warp7)
Team Role: Programmer
 
Join Date: May 2013
Rookie Year: 2013
Location: Toronto
Posts: 30
Aero is on a distinguished road
Elevator Motion Profiling / PID Ramping

Our elevator is way too fast.

We're currently using a standard PID loop, but it accelerates ridiculously quickly and throws totes.

I've looked into motion profiling, but can't see an easy way to (quickly) dynamically generate profiles between two arbitrary points on our elevator.

Is motion profiling the best solution here, or is there a simpler way to stop our elevator from accelerating too fast?
  #2   Spotlight this post!  
Unread 02-03-2015, 17:22
eddie12390's Avatar
eddie12390 eddie12390 is offline
Registered User
AKA: Eddie
FRC #3260 (SHARP)
Team Role: Programmer
 
Join Date: Jan 2011
Rookie Year: 2011
Location: Pittsburgh
Posts: 285
eddie12390 is a glorious beacon of lighteddie12390 is a glorious beacon of lighteddie12390 is a glorious beacon of lighteddie12390 is a glorious beacon of lighteddie12390 is a glorious beacon of light
Re: Elevator Motion Profiling / PID Ramping

If you're using CAN Talons, you can use the built-in voltage ramping.
__________________
Any post that I make expresses only my opinions. I do not represent the opinions of my team or of any entity affiliated with my team.

As a Mentor:
2016 - Engineering Inspiration at Greater Pittsburgh Regional

As a Driver:
2014 - Winner of Greater Pittsburgh Regional
  #3   Spotlight this post!  
Unread 02-03-2015, 17:23
Aero Aero is offline
consumes pizza, produces code
AKA: Ari Lotter
FRC #0865 (Warp7)
Team Role: Programmer
 
Join Date: May 2013
Rookie Year: 2013
Location: Toronto
Posts: 30
Aero is on a distinguished road
Re: Elevator Motion Profiling / PID Ramping

Quote:
Originally Posted by eddie12390 View Post
If you're using CAN Talons, you can use the built-in voltage ramping.
We're using the 2015 Victors, so no built-in ramping there.
  #4   Spotlight this post!  
Unread 02-03-2015, 17:26
eddie12390's Avatar
eddie12390 eddie12390 is offline
Registered User
AKA: Eddie
FRC #3260 (SHARP)
Team Role: Programmer
 
Join Date: Jan 2011
Rookie Year: 2011
Location: Pittsburgh
Posts: 285
eddie12390 is a glorious beacon of lighteddie12390 is a glorious beacon of lighteddie12390 is a glorious beacon of lighteddie12390 is a glorious beacon of lighteddie12390 is a glorious beacon of light
Re: Elevator Motion Profiling / PID Ramping

Quote:
Originally Posted by Aero View Post
We're using the 2015 Victors, so no built-in ramping there.
Ether has a lot of information about motion profiling here: http://www.chiefdelphi.com/media/papers/3107. If you haven't seen it, it would be a good starting point. I know for sure that the Cheesy Poofs used trapezoidal motion profiles for their 2011 robot so it may be a good place to find an example. (https://github.com/Team254/FRC-2011)
__________________
Any post that I make expresses only my opinions. I do not represent the opinions of my team or of any entity affiliated with my team.

As a Mentor:
2016 - Engineering Inspiration at Greater Pittsburgh Regional

As a Driver:
2014 - Winner of Greater Pittsburgh Regional
  #5   Spotlight this post!  
Unread 02-03-2015, 17:27
Bluman56's Avatar
Bluman56 Bluman56 is offline
Mentor Without Borders
AKA: Nikita
FRC #2579
Team Role: Mentor
 
Join Date: Jan 2015
Rookie Year: 2013
Location: Brooklyn
Posts: 147
Bluman56 is a jewel in the roughBluman56 is a jewel in the roughBluman56 is a jewel in the roughBluman56 is a jewel in the rough
Re: Elevator Motion Profiling / PID Ramping

Did you attempt to lower the P (gain) value of your PID loop?
  #6   Spotlight this post!  
Unread 02-03-2015, 17:31
Aero Aero is offline
consumes pizza, produces code
AKA: Ari Lotter
FRC #0865 (Warp7)
Team Role: Programmer
 
Join Date: May 2013
Rookie Year: 2013
Location: Toronto
Posts: 30
Aero is on a distinguished road
Re: Elevator Motion Profiling / PID Ramping

Quote:
Originally Posted by eddie12390 View Post
Ether has a lot of information about motion profiling here: http://www.chiefdelphi.com/media/papers/3107. If you haven't seen it, it would be a good starting point. I know for sure that the Cheesy Poofs used trapezoidal motion profiles for their 2011 robot so it may be a good place to find an example. (https://github.com/Team254/FRC-2011)
I read the Motion Profiling whitepaper, looked through the Poof's 2011 Github, and also read through 236's 2015 code. All the motion profiling I can find involves drivetrain stuff, which is between static values. Nothing that'll let you move between non-predefined setpoints.

Quote:
Originally Posted by Bluman56 View Post
Did you attempt to lower the P (gain) value of your PID loop?
That will provide slower acceleration, but won't help the deceleration because our integral term will take over.
  #7   Spotlight this post!  
Unread 02-03-2015, 17:31
JABot67 JABot67 is offline
Unregistered User
AKA: John Bottenberg
FRC #2930 (Sonic Squirrels)
Team Role: Engineer
 
Join Date: Feb 2009
Rookie Year: 2007
Location: Redmond, WA
Posts: 328
JABot67 has a reputation beyond reputeJABot67 has a reputation beyond reputeJABot67 has a reputation beyond reputeJABot67 has a reputation beyond reputeJABot67 has a reputation beyond reputeJABot67 has a reputation beyond reputeJABot67 has a reputation beyond reputeJABot67 has a reputation beyond reputeJABot67 has a reputation beyond reputeJABot67 has a reputation beyond reputeJABot67 has a reputation beyond repute
Re: Elevator Motion Profiling / PID Ramping

You could try:

- Open loop speed control on the elevator, such as connecting the Y axis of an operator joystick directly to the elevator motor output

- Closed loop speed control on the elevator (instead of position control), such as using the Y axis of an operator joystick as the setpoint to a (rate/speed control) PID controller which controls the motor

- Limiting the maximum output of the PID controller using SetOutputRange (float mimimumOutput, float maximumOutput)

- Motion profiling

Honestly, the open loop control might be enough. It's basically closed loop control given that the operator can look at the position of the elevator from the driver station to determine if it's moving too fast. If you are trying to do this in autonomous, though, obviously you have to use some sort of closed loop control. Limiting the maximum output of the PID controller may be a good idea in that case.
__________________
John Bottenberg - University of Michigan '14 - Microsoft
FLL Team "Dark Matter": 2003-2005
Robofest Team "Dark Matter": 2005-2008
Team 67 Programmer: 2007-2010
Team 3322 Programming Mentor: 2012-2014
Team 2930 Engineering Mentor: 2015-????
  #8   Spotlight this post!  
Unread 02-03-2015, 17:34
Aero Aero is offline
consumes pizza, produces code
AKA: Ari Lotter
FRC #0865 (Warp7)
Team Role: Programmer
 
Join Date: May 2013
Rookie Year: 2013
Location: Toronto
Posts: 30
Aero is on a distinguished road
Re: Elevator Motion Profiling / PID Ramping

Quote:
Originally Posted by JABot67 View Post
You could try:

- Open loop speed control on the elevator, such as connecting the Y axis of an operator joystick directly to the elevator motor output

- Closed loop speed control on the elevator (instead of position control), such as using the Y axis of an operator joystick as the setpoint to a (rate/speed control) PID controller which controls the motor

- Limiting the maximum output of the PID controller using SetOutputRange (float mimimumOutput, float maximumOutput)

- Motion profiling

Honestly, the open loop control might be enough. It's basically closed loop control given that the operator can look at the position of the elevator from the driver station to determine if it's moving too fast. If you are trying to do this in autonomous, though, obviously you have to use some sort of closed loop control. Limiting the maximum output of the PID controller may be a good idea in that case.
Any sort of speed control won't really work, because our elevator is really fast. It's about 0.75 seconds from bottom to top.
We have limited the max output of our PID controller, but that only provides a max speed, and no acceleration ramping.

I'm still looking into dynamic motion profiling, but I haven't figured it out yet.
  #9   Spotlight this post!  
Unread 02-03-2015, 17:46
JABot67 JABot67 is offline
Unregistered User
AKA: John Bottenberg
FRC #2930 (Sonic Squirrels)
Team Role: Engineer
 
Join Date: Feb 2009
Rookie Year: 2007
Location: Redmond, WA
Posts: 328
JABot67 has a reputation beyond reputeJABot67 has a reputation beyond reputeJABot67 has a reputation beyond reputeJABot67 has a reputation beyond reputeJABot67 has a reputation beyond reputeJABot67 has a reputation beyond reputeJABot67 has a reputation beyond reputeJABot67 has a reputation beyond reputeJABot67 has a reputation beyond reputeJABot67 has a reputation beyond reputeJABot67 has a reputation beyond repute
Re: Elevator Motion Profiling / PID Ramping

Quote:
Originally Posted by Aero View Post
Any sort of speed control won't really work, because our elevator is really fast. It's about 0.75 seconds from bottom to top.
We have limited the max output of our PID controller, but that only provides a max speed, and no acceleration ramping.

I'm still looking into dynamic motion profiling, but I haven't figured it out yet.
Closed loop speed control should allow you to set the speed to whatever you want it to be. You could make it so that it takes 4 seconds or 8 seconds or 16 seconds to go from bottom to top.

Open loop speed control allows your driver/operator to control the elevator's up/down motion directly (at least during teleop). This means that the operator can theoretically make sure the elevator isn't going too fast.

Of course the downside of these options is that it's hard to have position setpoints (ground, 1tote, 2totes, etc) but if you're just trying to get your elevator to stop throwing totes they probably would work.

Motion profiling would be an excellent next step if you think it's both important to have preset positions for the elevator (thus requiring position control) and use the max translation speed of your elevator during the travel time between positions. Downside, of course, is that it's harder to program.
__________________
John Bottenberg - University of Michigan '14 - Microsoft
FLL Team "Dark Matter": 2003-2005
Robofest Team "Dark Matter": 2005-2008
Team 67 Programmer: 2007-2010
Team 3322 Programming Mentor: 2012-2014
Team 2930 Engineering Mentor: 2015-????
  #10   Spotlight this post!  
Unread 02-03-2015, 17:59
Aero Aero is offline
consumes pizza, produces code
AKA: Ari Lotter
FRC #0865 (Warp7)
Team Role: Programmer
 
Join Date: May 2013
Rookie Year: 2013
Location: Toronto
Posts: 30
Aero is on a distinguished road
Re: Elevator Motion Profiling / PID Ramping

Quote:
Originally Posted by JABot67 View Post
Closed loop speed control should allow you to set the speed to whatever you want it to be. You could make it so that it takes 4 seconds or 8 seconds or 16 seconds to go from bottom to top.

Open loop speed control allows your driver/operator to control the elevator's up/down motion directly (at least during teleop). This means that the operator can theoretically make sure the elevator isn't going too fast.

Of course the downside of these options is that it's hard to have position setpoints (ground, 1tote, 2totes, etc) but if you're just trying to get your elevator to stop throwing totes they probably would work.

Motion profiling would be an excellent next step if you think it's both important to have preset positions for the elevator (thus requiring position control) and use the max translation speed of your elevator during the travel time between positions. Downside, of course, is that it's harder to program.
I've already been through this train of thought, and motion profiling really is what we want. How inefficient would it be to generate a new motion profile every time we change setpoints?
  #11   Spotlight this post!  
Unread 02-03-2015, 21:30
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,042
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: Elevator Motion Profiling / PID Ramping

Quote:
Originally Posted by Aero View Post
our elevator is really fast. It's about 0.75 seconds from bottom to top.
First, take Adam's advice about gearing (post#13). Then...

Quote:
Originally Posted by Aero View Post
motion profiling really is what we want. How inefficient would it be to generate a new motion profile every time we change setpoints?
Well it depends on your definition of inefficient I guess.

If you need to change the setpoint only when the speed is zero, it's pretty straightforward to generate a sinusoidal profile for smooth acceleration and deceleration.

Given the max desired acceleration M and the distance D to the new position, compute the constants T, K1, K2, and K3 as shown in the equations. Then you can use the functions a(t), v(t), and x(t) to generate a nice smooth trajectory to the new target. "t" is elapsed time from start of profile.

Note that T will be the time-to-destination and K2 will be the maximum speed.

See the example profile for M=3.5 ft/s2 and D=5 ft.


Attached Thumbnails
Click image for larger version

Name:	trajectory equations.png
Views:	108
Size:	27.7 KB
ID:	18536  Click image for larger version

Name:	M=3.5 D=5 plot.png
Views:	78
Size:	29.1 KB
ID:	18537  

Last edited by Ether : 03-03-2015 at 10:08.
  #12   Spotlight this post!  
Unread 03-03-2015, 08:34
Gdeaver Gdeaver is online now
Registered User
FRC #1640
Team Role: Mentor
 
Join Date: Mar 2004
Rookie Year: 2001
Location: West Chester, Pa.
Posts: 1,358
Gdeaver has a reputation beyond reputeGdeaver has a reputation beyond reputeGdeaver has a reputation beyond reputeGdeaver has a reputation beyond reputeGdeaver has a reputation beyond reputeGdeaver has a reputation beyond reputeGdeaver has a reputation beyond reputeGdeaver has a reputation beyond reputeGdeaver has a reputation beyond reputeGdeaver has a reputation beyond reputeGdeaver has a reputation beyond repute
Re: Elevator Motion Profiling / PID Ramping

I haven't seen much discussion about this on CD but, There is a fuzy logic controller in labview. If implemented well can solve control problems very well. However, This is not a good time to try this path. Off season project.
  #13   Spotlight this post!  
Unread 10-08-2015, 12:04
Hugh Meyer's Avatar
Hugh Meyer Hugh Meyer is offline
Registered User
FRC #1741 (Red Alert Robotics)
Team Role: Mentor
 
Join Date: Feb 2009
Rookie Year: 2008
Location: Greenwood Indiana
Posts: 158
Hugh Meyer has much to be proud ofHugh Meyer has much to be proud ofHugh Meyer has much to be proud ofHugh Meyer has much to be proud ofHugh Meyer has much to be proud ofHugh Meyer has much to be proud ofHugh Meyer has much to be proud ofHugh Meyer has much to be proud of
Re: Elevator Motion Profiling / PID Ramping

Quote:
Originally Posted by Ether View Post

If you need to change the setpoint only when the speed is zero, it's pretty straightforward to generate a sinusoidal profile for smooth acceleration and deceleration.

Given the max desired acceleration M and the distance D to the new position, compute the constants T, K1, K2, and K3 as shown in the equations. Then you can use the functions a(t), v(t), and x(t) to generate a nice smooth trajectory to the new target. "t" is elapsed time from start of profile.

Note that T will be the time-to-destination and K2 will be the maximum speed.

See the example profile for M=3.5 ft/s2 and D=5 ft.


Ether,

I created a spreadsheet to see if I could duplicate your example. Everything matches except for your statement "K2 will be max speed". My spreadsheet shows the max speed as 3.33 (cell I17) with a K2 value of 1.66 (cell D8). What am I doing wrong? Attached is my example sheet.

-Hugh
Attached Files
File Type: xls ExampleFromCDByHugh.xls (56.5 KB, 13 views)
  #14   Spotlight this post!  
Unread 10-08-2015, 12:33
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,042
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: Elevator Motion Profiling / PID Ramping

Quote:
Originally Posted by Hugh Meyer View Post
Ether,

I created a spreadsheet to see if I could duplicate your example. Everything matches except for your statement "K2 will be max speed". My spreadsheet shows the max speed as 3.33 (cell I17) with a K2 value of 1.66 (cell D8). What am I doing wrong? Attached is my example sheet.

-Hugh
The error is mine, not yours. The maximum speed will be 2*K2.

Thanks for pointing that out.

.
  #15   Spotlight this post!  
Unread 02-03-2015, 18:06
Jared's Avatar
Jared Jared is offline
Registered User
no team
Team Role: Programmer
 
Join Date: Aug 2013
Rookie Year: 2012
Location: Connecticut
Posts: 602
Jared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond repute
Re: Elevator Motion Profiling / PID Ramping

I have two ideas that might help
If you want to stick with plain PID, you could try just increasing the value of kD. If it starts to oscillate a lot, try a low pass filter (moving average over 0.1 seconds or so) on the sensor value. This will help slow the elevator, but it may not be enough.

A second solution is a nested PID controller (sometimes called cascade). Have the output of one PID controller be the input of the other.

Your first PID controller looks at the actual elevator position and the desired elevator position, and outputs a desired lift rate - not motor power.

The second PID controller takes this desired lift rate as an input, looks at the actual lift rate, and adjusts elevator lift motor power.

To tune, you first worry about the second PID controller that takes velocity as an input. To tune, you can set it up so that the operator sets a desired lift rate, and the elevator moves at this rate. Make sure all your units are in terms of velocity for this loop and you should have mainly kI for this loop, and no kP. You may want to also try having a feedforward term here, I believe WPI has this built in.

Next, you tune the second PID controller. This should have lots of kD, which will give you the smooth deceleration and dampening you want.
Closed Thread


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 09:21.

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