Go to Post Mentor: How is that held in place? CAD Lead: Go to the hardware store and buy a bag of constraints and put the constraints on the robot. - Kenyow [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 03-02-2015, 05:21 PM
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 03-02-2015, 05:22 PM
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 03-02-2015, 05:23 PM
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 03-02-2015, 05:26 PM
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 03-02-2015, 05:27 PM
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: 145
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 03-02-2015, 05:31 PM
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 03-02-2015, 05:31 PM
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 03-02-2015, 05:34 PM
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 03-02-2015, 05:46 PM
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 03-02-2015, 05:58 PM
Jefferson Jefferson is offline
Registered User
AKA: Jeff Clements
FRC #0016 (Bomb Squad)
Team Role: Mentor
 
Join Date: Jan 2011
Rookie Year: 2010
Location: Mountain Home, AR
Posts: 257
Jefferson has a brilliant futureJefferson has a brilliant futureJefferson has a brilliant futureJefferson has a brilliant futureJefferson has a brilliant futureJefferson has a brilliant futureJefferson has a brilliant futureJefferson has a brilliant futureJefferson has a brilliant futureJefferson has a brilliant futureJefferson has a brilliant future
Re: Elevator Motion Profiling / PID Ramping

Quote:
Originally Posted by Aero View Post
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?
We used a pretty simplistic approach to ramping/position control this year:

First, capture the time the new setpoint was set (rampStartTime)

ramp = rGain*(GetClock() - rampStartTime)
output = error*ramp
constrain output in a reasonable range for the current load

Adjust the rGain to get the ramp up you want and the constraints to limit the top end.
  #11   Spotlight this post!  
Unread 03-02-2015, 05:59 PM
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?
  #12   Spotlight this post!  
Unread 03-02-2015, 06:06 PM
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.
  #13   Spotlight this post!  
Unread 03-02-2015, 06:11 PM
AdamHeard's Avatar
AdamHeard AdamHeard is offline
Lead Mentor
FRC #0973 (Greybots)
Team Role: Mentor
 
Join Date: Oct 2004
Rookie Year: 2004
Location: Atascadero
Posts: 5,494
AdamHeard has a reputation beyond reputeAdamHeard has a reputation beyond reputeAdamHeard has a reputation beyond reputeAdamHeard has a reputation beyond reputeAdamHeard has a reputation beyond reputeAdamHeard has a reputation beyond reputeAdamHeard has a reputation beyond reputeAdamHeard has a reputation beyond reputeAdamHeard has a reputation beyond reputeAdamHeard has a reputation beyond reputeAdamHeard has a reputation beyond repute
Send a message via AIM to AdamHeard
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.
Gear slower. It will do wonders here.
  #14   Spotlight this post!  
Unread 03-02-2015, 06:19 PM
Tom Bottiglieri Tom Bottiglieri is offline
Registered User
FRC #0254 (The Cheesy Poofs)
Team Role: Engineer
 
Join Date: Jan 2004
Rookie Year: 2003
Location: San Francisco, CA
Posts: 3,182
Tom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond repute
Re: Elevator Motion Profiling / PID Ramping

Quote:
Originally Posted by Jared View Post
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.
.
Off topic a bit - I saw your team was using Java this year. Have you run into issues with the timing of the JVM's Timer? We have used this construct successfully over the past two years, but on the roborio the timing is complete garbage. We have ditched using derivatives on any control loops due to massive noise.

My best theory is the squawkVM was ported manually and used VXworks timers under the hood. The standard JRE we use now probably just sleeps or something.

Last edited by Tom Bottiglieri : 03-02-2015 at 06:21 PM.
  #15   Spotlight this post!  
Unread 03-02-2015, 06:30 PM
virtuald's Avatar
virtuald virtuald is offline
RobotPy Guy
AKA: Dustin Spicuzza
FRC #1418 (), FRC #1973, FRC #4796, FRC #6367 ()
Team Role: Mentor
 
Join Date: Dec 2008
Rookie Year: 2003
Location: Boston, MA
Posts: 1,033
virtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant future
Re: Elevator Motion Profiling / PID Ramping

Quote:
Originally Posted by Tom Bottiglieri View Post
Off topic a bit - I saw your team was using Java this year. Have you run into issues with the timing of the JVM's Timer? We have used this construct successfully over the past two years, but on the roborio the timing is complete garbage. We have ditched using derivatives on any control loops due to massive noise.

My best theory is the squawkVM was ported manually and used VXworks timers under the hood. The standard JRE we use now probably just sleeps or something.
More off topic -- I'm pretty sure that the JVM just does a sleep under the hood. To get more precise timing in python, we did a big sleep, then sleeps in increments of 200us to get the rest of the way there. We get +/- 0.5ms accuracy with this method.
__________________
Maintainer of RobotPy - Python for FRC
Creator of pyfrc (Robot Simulator + utilities for Python) and pynetworktables/pynetworktables2js (NetworkTables for Python & Javascript)

2017 Season: Teams #1973, #4796, #6369
Team #1418 (remote mentor): Newton Quarterfinalists, 2016 Chesapeake District Champion, 2x Innovation in Control award, 2x district event winner
Team #1418: 2015 DC Regional Innovation In Control Award, #2 seed; 2014 VA Industrial Design Award; 2014 Finalists in DC & VA
Team #2423: 2012 & 2013 Boston Regional Innovation in Control Award


Resources: FIRSTWiki (relaunched!) | My Software Stuff
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 08:09 PM.

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