Go to Post We can either sit around and complain about what could have been, or we can focus on the upside of what we have and move on. - Vikesrock [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: 2 votes, 5.00 average. Display Modes
  #1   Spotlight this post!  
Unread 18-01-2015, 13:40
duane's Avatar
duane duane is offline
Registered User
FRC #0701 (RoboVikes)
Team Role: Mentor
 
Join Date: Jan 2006
Rookie Year: 2003
Location: Vacaville
Posts: 90
duane is an unknown quantity at this point
Send a message via AIM to duane
Drive System Control Compensation

I'm looking for techniques to use for compensating the drive system for speed and control.

Conceptually, I'm looking for techniques for smooth acceleration and for fine speed control.

I'd like to prevent the robot from accelerating too quickly. The usual process is to just transfer the joystick value to the drive motors and just use the motor acceleration curve. I'd like to have more control over that curve. I'm looking for ideas for what the transfer function looks like for controlling that curve.

For fine speed control, I'd like to do something like a computer mouse control. Some mice have a transfer function that allows for micro control at small movements but accelerated control at larger movements. This allows you to move the most quickly across a large screen without actually having the same real estate.

Any articles or suggestions for similar ideas would be a great help.

Thanks,
__________________
Duane Murphy
Mentor - Software
Vanden Vikings FIRST Team 701
http://www.vandenrobotics.com
  #2   Spotlight this post!  
Unread 18-01-2015, 13:53
nighterfighter nighterfighter is offline
1771 Alum, 1771 Mentor
AKA: Matt B
FRC #1771 (1771)
Team Role: Mentor
 
Join Date: Sep 2009
Rookie Year: 2007
Location: Suwanee/Kennesaw, GA
Posts: 835
nighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant future
Re: Drive System Control Compensation

I'm sure you have thought of this already, but something we have done in the past:

To get fine and precise control, while using Tank Drive, we had a button on the joystick, that when held, would divide the joystick inputs by half. Essentially this allows the full range of motion of the joysticks, but limits the speed to half. This allowed us to do very precise turns and small movements. (Used it in 2010 to have our vacuum latch onto the soccer balls).

Another option is to have a button, that when held, changes your inputs from a linear correlation to a different type. The joysticks value is a floating value, from -1 to 1. Like you said, most code will just assign the motor.Set () function to the joystick.GetY () (or x, whatever axis you use). Try having a button that squares the value instead (or cubes, try different values!) of just a linear correlation. This should also give you more precise control.
__________________
1771- Programmer, Captain, Drive Team (2009-2012)
4509- Mentor (2013-2015)
1771- Mentor (2015)

Last edited by nighterfighter : 18-01-2015 at 18:43. Reason: I forgot how math works!
  #3   Spotlight this post!  
Unread 18-01-2015, 14:41
matthewdenny's Avatar
matthewdenny matthewdenny is offline
Registered User
FRC #6054 (Dukes)
Team Role: Mentor
 
Join Date: Jan 2012
Rookie Year: 2012
Location: United States
Posts: 306
matthewdenny has a brilliant futurematthewdenny has a brilliant futurematthewdenny has a brilliant futurematthewdenny has a brilliant futurematthewdenny has a brilliant futurematthewdenny has a brilliant futurematthewdenny has a brilliant futurematthewdenny has a brilliant futurematthewdenny has a brilliant futurematthewdenny has a brilliant futurematthewdenny has a brilliant future
The joystick value is <=1 so you would actually square or cube it to get more precise control. Taking the square root would have the opposite effect.
  #4   Spotlight this post!  
Unread 18-01-2015, 15:47
nighterfighter nighterfighter is offline
1771 Alum, 1771 Mentor
AKA: Matt B
FRC #1771 (1771)
Team Role: Mentor
 
Join Date: Sep 2009
Rookie Year: 2007
Location: Suwanee/Kennesaw, GA
Posts: 835
nighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant future
Re: Drive System Control Compensation

Quote:
Originally Posted by matthewdenny View Post
The joystick value is <=1 so you would actually square or cube it to get more precise control. Taking the square root would have the opposite effect.
Oops, you are correct! I will edit that in a moment.
__________________
1771- Programmer, Captain, Drive Team (2009-2012)
4509- Mentor (2013-2015)
1771- Mentor (2015)
  #5   Spotlight this post!  
Unread 18-01-2015, 16:10
tr6scott's Avatar
tr6scott tr6scott is offline
Um, I smell Motor!
AKA: Scott McBride
FRC #2137 (TORC)
Team Role: Mentor
 
Join Date: Dec 2007
Rookie Year: 2005
Location: Oxford, MI
Posts: 507
tr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond repute
Re: Drive System Control Compensation

We programmed a rate limiter this Saturday, which just looks at the motor output the last time, and you set a threshold, (max allowed change per loop time) and if greater, just adds the max, to the output.

This worked well at keeping the totes on the stack, but makes the drivers controls "laggy".

I just posted a question to the programming team, if they thought the rate limit could/should be varied depending on the speed of the bot, or motor output of the controller... Seeing it is a kinematic energy problem, and mathematically, the formula always seems to have a velocity squared term, maybe the rate limit variance should be based on a square of the velocity.

based on our "Kitbot on Steroids" programming mule, this equated to a rate limit of 1.1 or stop to full speed in 0.9 seconds, this was enough acceleration/deceleration to keep a stack of 4 totes on the bot, suspended by the handles only... (trying to determine the pro/cons of supportting tote in two, three, or 4 points. )
__________________
The sooner we get behind schedule, the more time we have to catch up.

  #6   Spotlight this post!  
Unread 19-01-2015, 17:18
duane's Avatar
duane duane is offline
Registered User
FRC #0701 (RoboVikes)
Team Role: Mentor
 
Join Date: Jan 2006
Rookie Year: 2003
Location: Vacaville
Posts: 90
duane is an unknown quantity at this point
Send a message via AIM to duane
Re: Drive System Control Compensation

This sounds like what I am looking for.

This is smelling like a transfer function. Using a difference is also sounding like a differential. :-)

I'm sure I could write down a formula, but it seems like the math should map to some kind of transfer function.

We'll play with this and see how this works.

Also, we are using the Talon SRX. It seems they have a ramp speed. For example, %V/sec. These sound similar.
__________________
Duane Murphy
Mentor - Software
Vanden Vikings FIRST Team 701
http://www.vandenrobotics.com
  #7   Spotlight this post!  
Unread 19-01-2015, 21:01
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: Drive System Control Compensation

We typically do
x = joyx * abs(joyx); y = joyy * abs(joyy)

this squares the input giving a parabolic response while maintaining sign.

It does not protect from the driver slamming full forward to full reverse. For that, you also need to add a ramp function. The old jaguars had that built in to minimize over current issues so you may want to look up the data sheet for time constants.
  #8   Spotlight this post!  
Unread 19-01-2015, 21:37
Lightfoot26's Avatar
Lightfoot26 Lightfoot26 is offline
Just Out For A Rip, Bud...
AKA: Seth Lightfoot
FRC #1625 (Winnovation)
Team Role: Mentor
 
Join Date: Dec 2009
Rookie Year: 2010
Location: Winnebago, IL
Posts: 120
Lightfoot26 is just really niceLightfoot26 is just really niceLightfoot26 is just really niceLightfoot26 is just really niceLightfoot26 is just really nice
Re: Drive System Control Compensation

I don't know how much this applies, (when you say more control over acceleration this just jumped to my mind) but we created an acceleration rate limiter ("ramping" function) to ramp acceleration when the driver jams full speed on the joysticks (this helps with current spikes and wheel slip among other things). You can adjust your max desired slope which is the variable Slope_a and move the joystick slider to simulate joystick movement. There is an indicator of the motor output labeled "motor" as well. The graph will show you the joystick value (white line) in comparison with the motor output (red line). The smaller Slope_a is the longer it takes the motor to reach the full desired speed. When controlling finer movements, these curves overlap exactly. Here is the LabVIEW VI if you want to take a look. (Sorry if it is a little messy!) If you aren't too versed in LV, I'd be happy to explain more, if you have problems with the link let me know.
__________________
Winnovation Team 1625 (2010-??)
  • Electrical/Programming Captain (2011-2013)
  • Auxiliary Driver (2012-2013)
  • Team Captain (2013)
  • Alumni (Graduated May 2013)
  • Electrical and Programming Mentor (2014-??)

Last edited by Lightfoot26 : 19-01-2015 at 21:45.
  #9   Spotlight this post!  
Unread 20-01-2015, 00:27
duane's Avatar
duane duane is offline
Registered User
FRC #0701 (RoboVikes)
Team Role: Mentor
 
Join Date: Jan 2006
Rookie Year: 2003
Location: Vacaville
Posts: 90
duane is an unknown quantity at this point
Send a message via AIM to duane
Re: Drive System Control Compensation

Thanks. That sounds like what we are looking for.

I'll try to find a machine that still has LabView on it. (We've completely switched to C++.)

The Talon SRX also has a ramp builtin. We'll do some experiments with the ramping functions there as well. Might as well use all the processors we have on board. :-)
__________________
Duane Murphy
Mentor - Software
Vanden Vikings FIRST Team 701
http://www.vandenrobotics.com
  #10   Spotlight this post!  
Unread 20-01-2015, 01:22
josesantos's Avatar
josesantos josesantos is offline
Mentor; Former Design Chairman
FRC #0687 (Nerd Herd) (VRC #687z) & FRC #5499 (BHS Robotics)
Team Role: Mentor
 
Join Date: Jan 2012
Rookie Year: 2011
Location: Carson, CA/Berkeley, CA
Posts: 42
josesantos has a reputation beyond reputejosesantos has a reputation beyond reputejosesantos has a reputation beyond reputejosesantos has a reputation beyond reputejosesantos has a reputation beyond reputejosesantos has a reputation beyond reputejosesantos has a reputation beyond reputejosesantos has a reputation beyond reputejosesantos has a reputation beyond reputejosesantos has a reputation beyond reputejosesantos has a reputation beyond repute
Re: Drive System Control Compensation

I've implemented ramping speed filters in RobotC using this example from one of our old programming leads. Essentially, the filter adds to the current speed the different between the current speed and the desired speed divided by some "alpha". This "smooths out" any motor speed changes.

So basically:
speed = speed + (joystick - speed)/alpha

Note that in his example, he multiplies then divides by an arbitrarily large value. I'm told he did this because the controller either didn't support floats or did floating point calculations much more slowly.
__________________
CAMS Robotics, FIRST Team 687 The Nerd Herd 2010-Present
College Mentor 2013-Present // Design Chairman 2012-2013
Berkeley High Robotics, FIRST Team 5499 2014-Present
College Mentor 2014-Present

Last edited by josesantos : 20-01-2015 at 01:24. Reason: clarity
  #11   Spotlight this post!  
Unread 20-01-2015, 04:59
timytamy's Avatar
timytamy timytamy is offline
Registered User
AKA: Tim
FRC #3132 (The Thunder Down Under)
Team Role: Electrical
 
Join Date: Nov 2009
Rookie Year: 2010
Location: Australia
Posts: 293
timytamy has a brilliant futuretimytamy has a brilliant futuretimytamy has a brilliant futuretimytamy has a brilliant futuretimytamy has a brilliant futuretimytamy has a brilliant futuretimytamy has a brilliant futuretimytamy has a brilliant futuretimytamy has a brilliant futuretimytamy has a brilliant futuretimytamy has a brilliant future
Re: Drive System Control Compensation

Quote:
Originally Posted by gpetilli View Post
We typically do
x = joyx * abs(joyx); y = joyy * abs(joyy)

this squares the input giving a parabolic response while maintaining sign.
The wpilib actually has this built in. If you call the arcadeDrive (or tankDrive) method, one of the parameters is a boolean "squaredInputs", which does pretty much what your doing.

eg:
Code:
driveSys.arcadeDrive(joyL.getY(), joyR.getX(), true);
__________________
Tim W
FIRST® Team 3132 - The Thunder Down Under
Sydney, Australia
Website | Facebook | Youtube
  #12   Spotlight this post!  
Unread 21-01-2015, 21:49
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: Drive System Control Compensation

Quote:
Originally Posted by timytamy View Post
The wpilib actually has this built in. If you call the arcadeDrive (or tankDrive) method, one of the parameters is a boolean "squaredInputs", which does pretty much what your doing.
[/code]
great minds think alike. WPI adds new features all the time and it is hard to keep up.
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 12:37.

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