Go to Post To be blunt: how many motorized carts do you see parked on the side of Einstein? - Koko Ed [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 Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 07-04-2008, 01:45
Uberbots's Avatar
Uberbots Uberbots is offline
Mad Programmer
AKA: Billy Sisson
FRC #1124 (ÜberBots)
Team Role: College Student
 
Join Date: Jan 2006
Rookie Year: 2005
Location: Avon
Posts: 739
Uberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond repute
Re: Accurately "Arcing" in Auton/Hybrid Mode

to do our arc, we tell the robot to do a certain number of rpms on each side of the wheel base, using the following (pseudo) code:

Code:
VForward = 40;
omega = dist_from_wall / some_constant + desired_dist_from_wall / some_constant;
wheel_left = VForward + omega;
wheel_right = VForward - omega;
it has gotten us some pretty accurate turns, with some tweaking.
__________________
A few of my favorite numbers:
175 176 177 195 230 558 716 1024 1071 1592 1784 1816
RPI 2012
BREAKAWAY
  #2   Spotlight this post!  
Unread 07-04-2008, 01:47
kiettyyyy's Avatar
kiettyyyy kiettyyyy is offline
Registered User
FRC #1538 (The Holy Cows)
Team Role: Engineer
 
Join Date: Mar 2006
Rookie Year: 2005
Location: San Diego, CA
Posts: 181
kiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond repute
Send a message via AIM to kiettyyyy
Re: Accurately "Arcing" in Auton/Hybrid Mode

Quote:
Originally Posted by Uberbots View Post
to do our arc, we tell the robot to do a certain number of rpms on each side of the wheel base, using the following (pseudo) code:

Code:
VForward = 40;
omega = dist_from_wall / some_constant + desired_dist_from_wall / some_constant;
wheel_left = VForward + omega;
wheel_right = VForward - omega;
it has gotten us some pretty accurate turns, with some tweaking.

I just was thinking about that once you've posted!

That's one of the options, and it looks like it would make an accurate turn.

I'll play with this tomorrow and see if this would work out for us.

Thanks!
  #3   Spotlight this post!  
Unread 07-04-2008, 02:29
Jay Lundy Jay Lundy is offline
Programmer/Driver 2001-2004
FRC #0254 (The Cheesy Poofs)
Team Role: Alumni
 
Join Date: Jun 2001
Rookie Year: 2001
Location: Berkeley, CA
Posts: 320
Jay Lundy is a name known to allJay Lundy is a name known to allJay Lundy is a name known to allJay Lundy is a name known to allJay Lundy is a name known to allJay Lundy is a name known to all
Re: Accurately "Arcing" in Auton/Hybrid Mode

Hey Kiet. I did some thinking about how to do this earlier but haven't talked to anyone on 254/968 about it, so I'll just tell you here.

Here's some of the math I came up with:

If:
V_L = Velocity of the left wheels
V_R = Velocity of the right wheels
w = Width of robot (distance from left wheels to right wheels)

Then:
Code:
omega = angular speed = (V_R - V_L) / w
r = turning radius = w/2 * (V_R + V_L) / (V_R - V_L)
A turning radius of 5 feet means you are turning around a point 5 feet to the left of the center of the robot.

So if you use Uberbots' code and do V_R = v + x, V_L =v - x, then you can solve for x for a desired r:

Code:
x = w/2 * v/r
Of course I've been talking about velocity all this time, not voltage. You can try to find what PWM outputs give you the right velocities, but like you said that can be a problem. The best thing is a feedback loop for each side, some sort of PID loop.

Using the gyro and encoders like Adam suggested will work too. In that case you can calculate the turning radius from just V_L = left velocity, and omega = gyro output:

Code:
r = V_L / omega + w/2

Last edited by Jay Lundy : 07-04-2008 at 02:32.
  #4   Spotlight this post!  
Unread 07-04-2008, 03:02
Jay Lundy Jay Lundy is offline
Programmer/Driver 2001-2004
FRC #0254 (The Cheesy Poofs)
Team Role: Alumni
 
Join Date: Jun 2001
Rookie Year: 2001
Location: Berkeley, CA
Posts: 320
Jay Lundy is a name known to allJay Lundy is a name known to allJay Lundy is a name known to allJay Lundy is a name known to allJay Lundy is a name known to allJay Lundy is a name known to all
Re: Accurately "Arcing" in Auton/Hybrid Mode

By the way, if you do use a PID loop to control the velocities I think you can improve stability (ie overshooting) and probably even response time by using both feedback and feed-forward control.

Instead of sending this to the motors:

Code:
pwm_out = PID(e) // PID is your PID function, e is the speed error
send this:

Code:
pwm_out = guess(target_velocity) + PID(e)
The guess function takes your PID setpoint, the target velocity, and guesses what PWM output you need to reach that velocity. It doesn't have to be exact, but as long as you're close you can improve the performance of your PID loop. The guess function ideally ends up providing most of the output and the PID loop just makes small corrections.

By the way your straight drive code uses the same idea (both sides are fed throttle and the PID loop just makes small adjustments to keep them at the same speed).

Last edited by Jay Lundy : 07-04-2008 at 03:41.
  #5   Spotlight this post!  
Unread 07-04-2008, 11:07
Jared Russell's Avatar
Jared Russell Jared Russell is offline
Taking a year (mostly) off
FRC #0254 (The Cheesy Poofs), FRC #0341 (Miss Daisy)
Team Role: Engineer
 
Join Date: Nov 2002
Rookie Year: 2001
Location: San Francisco, CA
Posts: 3,077
Jared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond repute
Re: Accurately "Arcing" in Auton/Hybrid Mode

Quote:
Originally Posted by Jay Lundy View Post
By the way, if you do use a PID loop to control the velocities I think you can improve stability (ie overshooting) and probably even response time by using both feedback and feed-forward control.

Instead of sending this to the motors:

Code:
pwm_out = PID(e) // PID is your PID function, e is the speed error
send this:

Code:
pwm_out = guess(target_velocity) + PID(e)
The guess function takes your PID setpoint, the target velocity, and guesses what PWM output you need to reach that velocity. It doesn't have to be exact, but as long as you're close you can improve the performance of your PID loop. The guess function ideally ends up providing most of the output and the PID loop just makes small corrections.

By the way your straight drive code uses the same idea (both sides are fed throttle and the PID loop just makes small adjustments to keep them at the same speed).
The feed forward option is almost always going to have better transient response in velocity control in terms of overshoot and oscillation, although it needs to be well tuned to improve rise time.

I would caution, though, that you probably want to code it like this:

Code:
pwm_out = feed_forward_gain*guess(target_velocity) + (1-feed_forward_gain)*PID(e)
Where "feed_forward_gain" is between 0 and 1 (functionally it will probably be .7+). You will want to do this using integer math, of course.

This clamps your output, and lets you use the same gains as in the pure feedback case.
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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Championship Event - Where the "Random" Match Sorting Really "Shines" Travis Hoffman Championship Event 57 19-04-2007 08:06
2006 game poll #4 (type of "sensing" in autonomous mode) dhitchco Rumor Mill 1 18-11-2005 12:27
New NEMO White Papers! "Creating a Killer Packet" and "25 Ways to Sponsor" Jessica Boucher Team Organization 0 10-08-2005 10:55
"Thunderbirds" Vs. "Team America" Which one will rule the box office? Elgin Clock Chit-Chat 3 07-09-2004 19:53
Why use "Invisible Mode"? Steve Howland CD Forum Support 1 15-08-2004 11:18


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

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