Go to Post "Why even bother building a robot if we're not gonna win?". The answer? To learn and grow. - MrBydlon [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 30-03-2012, 21:01
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: Curve Driving Generator

Quote:
Originally Posted by theNerd View Post
what if the current heading angle was a slope of infinity?
Pick a coordinate system whose origin is the starting point and whose positive X axis aligns with the starting direction of motion.

Compute the ending point (X2,Y2) and slope m2 in that coordinate system.

Then the cubic becomes simply Y = aX3 + bX2

and the formulas for a and b are simply

a = (m2X2 - 2Y2)/X23

b = (3Y2 - m2X2)/X22
  #2   Spotlight this post!  
Unread 30-03-2012, 21:09
Whippet's Avatar
Whippet Whippet is offline
MIT Class of 2020
AKA: Luis Trueba
FRC #4301 (New Tech Narcissists)
Team Role: Alumni
 
Join Date: Feb 2011
Rookie Year: 2011
Location: Cambridge, MA
Posts: 1,187
Whippet has a reputation beyond reputeWhippet has a reputation beyond reputeWhippet has a reputation beyond reputeWhippet has a reputation beyond reputeWhippet has a reputation beyond reputeWhippet has a reputation beyond reputeWhippet has a reputation beyond reputeWhippet has a reputation beyond reputeWhippet has a reputation beyond reputeWhippet has a reputation beyond reputeWhippet has a reputation beyond repute
Send a message via Yahoo to Whippet
Re: Curve Driving Generator

Why not use tank control mode? That way, you can drive curves, but it takes a little more practice to use. It's just a matter of willingness to learn, but will save a lot of time programming. So it's kind of a double-edged sword.

Last edited by Whippet : 30-03-2012 at 21:38.
  #3   Spotlight this post!  
Unread 30-03-2012, 21:45
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: Curve Driving Generator

Quote:
Originally Posted by Whippet View Post
Why not use tank control mode? That way, you can drive curves, but it takes a little more practice to use. It's just a matter of willingness to learn, but will save a lot of time programming.
That's not what the OP wants to discuss:

Quote:
Originally Posted by theNerd View Post
Lets not discuss why we would or would not do this but instead, focus on how. Thanks!
  #4   Spotlight this post!  
Unread 30-03-2012, 22:06
MichaelBick MichaelBick is offline
Registered User
FRC #1836 (MilkenKnights)
Team Role: Alumni
 
Join Date: Oct 2011
Rookie Year: 2010
Location: Los Angeles
Posts: 733
MichaelBick has a brilliant futureMichaelBick has a brilliant futureMichaelBick has a brilliant futureMichaelBick has a brilliant futureMichaelBick has a brilliant futureMichaelBick has a brilliant futureMichaelBick has a brilliant futureMichaelBick has a brilliant futureMichaelBick has a brilliant futureMichaelBick has a brilliant futureMichaelBick has a brilliant future
Re: Curve Driving Generator

Quote:
Originally Posted by Whippet View Post
Why not use tank control mode? That way, you can drive curves, but it takes a little more practice to use. It's just a matter of willingness to learn, but tank mode can do curves, and will save a lot of time programming. So it's kind of a double-edged sword.
I agree. One of the reasons that a lowered center drive(I'm assuming not 4 wheel or treads, as I would not try these maneuvers with those drivetrains) is so competitive, is because it needs very little programming. Sure, some teams have more complex code(I'm thinking 254 with their physics engine for turn radius) that is really nice, it is not worth the effort for the negligible gain, unless you have extra time(like maybe getting a camera working and shooting accurately).
__________________
Team 1836 - The Milken Knights
2013 LA Regional Champions with 1717 and 973
2012 LA Regional Finalists with 294 and 973
To follow Team 1836 on Facebook, go to http://www.facebook.com/MilkenKnights
To go to our website, go to http://milkenknights.com/index.html
  #5   Spotlight this post!  
Unread 31-03-2012, 20:37
dcherba dcherba is offline
Registered User
FRC #3234 (Red Arrow Robotics)
Team Role: Programmer
 
Join Date: Dec 2009
Rookie Year: 2000
Location: ada, mi
Posts: 32
dcherba has a spectacular aura aboutdcherba has a spectacular aura aboutdcherba has a spectacular aura about
Re: Curve Driving Generator

The real problem you have is one of reference frame. The curve it self is not important as it represents some path on the playing field frame of reference. The incremental control of the robot is based on its frame of reference to the center of the robot for example.
This is a common problem for aircraft, satellites and just about any navigation problem.
The solution is to use a series of translations and rotations. The best way to do that is with quaternions as they do the rotation without ambiquity.

http://en.wikipedia.org/wiki/Quatern...atial_rotation
has a good primer on the subject. This is commonly used for computer graphics and simulations.

Have fun
__________________
Dave Cherba
Mentor Team 3234
WZ8T
  #6   Spotlight this post!  
Unread 31-03-2012, 22:09
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: Curve Driving Generator


This is not a 3D problem. It's a problem in a 2D flat plane, and a skid-steer vehicle has only 2 degrees of freedom (rotation and fwd/reverse translation) in that plane.

To execute a smooth* path from an arbitrary point A (starting with heading angle Alpha) to point B (ending with heading angle Beta) the vehicle's instantaneous translation and/or rotation rates must continuously change over time in order to follow that path and arrive at the destination with the proper heading.

So the problem is:

1) given the starting and ending points and headings, what criteria are to be used to define the desired path? smoothest* curve? Shortest distance* ? Shortest time? radius of curvature* never less than some specified minimum value?

2) how to compute the curve defined by those specifications

3) how to use the curve to determine the required instantaneous vehicle rotation and translation at any point along the curve

4) how to use the answer to #3 to determine the left and right wheel speeds (for skid steer) at each point along the curve

5) is the path to be computed once (at the start) and then executed to completion without feedback, or is the path periodically re-computed to minimize accumulated drift errors

For a subset of the possible starting and ending points and headings, it is possible, as explained in earlier posts in this thread, to compute a cubic polynomial which defines a smooth path. For a given vehicle forward speed, this polynomial can be used to determine the required instantaneous vehicle rotation rate at each point along the path.

In another earlier post, dbeckwith suggested a Bezier curve. I believe the instantaneous vehicle rotation rate for a given vehicle forward speed can also be computed from the parametric Bezier equations, but I haven't actually done it yet.

The bottom line here is that the OP stated a problem without much context and asked that the discussion be limited to "how" and not "why". It makes for an interesting academic discussion, but I suspect that if we had greater insight into what was trying to be accomplished the solution might be different.



*notes:

smooth path: perhaps for esthetic reasons? the OP did not specify why

shortest distance: rotate-in-place at point A, drive straight to point B, rotate-in-place. probably not what the OP would consider a "smooth" curve

limited minimum radius of curvature: many skid-steer vehicles don't like a small turning radius. they hop and jerk.



Last edited by Ether : 31-03-2012 at 22:11.
  #7   Spotlight this post!  
Unread 01-04-2012, 14:11
theNerd's Avatar
theNerd theNerd is offline
Registered User
FRC #3329 (Cam Bots)
Team Role: Programmer
 
Join Date: Jan 2011
Rookie Year: 2110
Location: St. Marys
Posts: 51
theNerd is an unknown quantity at this point
Re: Curve Driving Generator

Quote:
Originally Posted by Ether View Post
[smooth path: perhaps for esthetic reasons? the OP did not specify why
Sorry for the confusion guys,

The reason for this problem is in aiding the drive in autonomous and teleop - more so autonomous. Also, this is just an exercise for the future programmers of our team. I had noticed that although the rotate in place is the "shortest distance" method it is not always the fastest - especially for a very smooth control - as that the robot must slow down, rotate, and then speed back up. While if the robot drove in a curve it would never need to stop, only change wheel speeds. So then, I'm looking for the fastest route possible. (The reason I did not want to discuss why is because most times I post a thread there always seems to be a discussion as to why not or why and completely turn away from the answer I wanted. I apologize for not being more specific).

I am planning on integrating this with distance PID loops to control the drive. Essentially this is an add-on to a drive system I am creating that pulls from a list of coordinates that I want to go to, sets the left and right wheel distances that the robot must travel to get to that point, and then feeds those distances into a PID loop. Once the error in the pid loop reaches around 0-5% it then pulls the next coordinate to go to. I also, figured that a coordinate system relative to the robots current position would be more beneficial than a coordinate system that is fixed for what I am trying to do.

The equations that the robot uses to determine left and right distances use the arc length of the path, and the angle through which the robot will turn while it is driving along that path. If the angle is 0 then it drives in a straight line, if the distance is 0 then it rotates in place. The equations are thus:

double rightDistance = ((wheelWidth*angle) + (2*distance))/2;
double leftDistance = ((2*distance) - (wheelWidth*angle))/2;

The advantage of this is that I only need one set of equations to drive curves, or perform the traditional rotate and drive.

I am also planning on working with trapezoidal motion profiling in this. I am using these equations:

x = x0 +dx(P(u));
P(u) = -2u^3+3u^2;
u = currentTime - startTime/delta_time;

Where x is the distance travelled in 1 dimension and dx is delta_x and x0 is the startingX --> which is normally 0. P(u) is a function with these properties: f(0)=0, f'(0) =0; f(1)=1, f'(1)=0 and P(u)=[0,1] and u=[0,1].
There is a second set of equations I plan on replacing the above with that include max acceleration and max velocity, I just haven't yet because I'm not sure how to go about testing for those due to a very very small workspace - and running the robot on blocks is inaccurate for our heavy bot.

Last edited by theNerd : 01-04-2012 at 14:49.
  #8   Spotlight this post!  
Unread 01-04-2012, 18:22
MichaelBick MichaelBick is offline
Registered User
FRC #1836 (MilkenKnights)
Team Role: Alumni
 
Join Date: Oct 2011
Rookie Year: 2010
Location: Los Angeles
Posts: 733
MichaelBick has a brilliant futureMichaelBick has a brilliant futureMichaelBick has a brilliant futureMichaelBick has a brilliant futureMichaelBick has a brilliant futureMichaelBick has a brilliant futureMichaelBick has a brilliant futureMichaelBick has a brilliant futureMichaelBick has a brilliant futureMichaelBick has a brilliant futureMichaelBick has a brilliant future
Re: Curve Driving Generator

254 has something like this build into their drive code, though as I said before, I believe it also integrates the current speed of the robot(faster speed, bigger arc, slower speed, smaller arc). I would check their code, as they have made it public, and it is very refined.
__________________
Team 1836 - The Milken Knights
2013 LA Regional Champions with 1717 and 973
2012 LA Regional Finalists with 294 and 973
To follow Team 1836 on Facebook, go to http://www.facebook.com/MilkenKnights
To go to our website, go to http://milkenknights.com/index.html
  #9   Spotlight this post!  
Unread 01-04-2012, 19:12
Tom Line's Avatar
Tom Line Tom Line is offline
Raptors can't turn doorknobs.
FRC #1718 (The Fighting Pi)
Team Role: Mentor
 
Join Date: Jan 2007
Rookie Year: 1999
Location: Armada, Michigan
Posts: 2,513
Tom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond repute
Re: Curve Driving Generator

Is this for teleop or autonmous?

In autonmous, getting a robot to drive an accurate curve is fairly early.

Have a PID loop for distance connected to each side of your drive train, and another PID loop based on a desired angle and the gyro that is added into to your final drivetrain output values. The robot will then drive curves to reach the endpoints, assuming gains are set correctly.
  #10   Spotlight this post!  
Unread 02-04-2012, 14:48
theNerd's Avatar
theNerd theNerd is offline
Registered User
FRC #3329 (Cam Bots)
Team Role: Programmer
 
Join Date: Jan 2011
Rookie Year: 2110
Location: St. Marys
Posts: 51
theNerd is an unknown quantity at this point
Re: Curve Driving Generator

Quote:
Originally Posted by MICHAELABICK View Post
254 has something like this build into their drive code, though as I said before, I believe it also integrates the current speed of the robot(faster speed, bigger arc, slower speed, smaller arc). I would check their code, as they have made it public, and it is very refined.
I have checked their code and the sections that I have seen are not well documented and I am confused on the logic behind their code.
  #11   Spotlight this post!  
Unread 02-04-2012, 00:59
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: Curve Driving Generator


Food for thought

See attached graph.

There's a Segway with a 2-foot wheelbase sitting at the origin.

Its heading is aligned with the +X axis.

I drive the Segway so that the center of its axle follows the black Bezier curve.

At the end of the path, the Segway's heading is parallel to the X axis and its coordinates are x=10 y=3.

The red curve shows the track of its left wheel, and the green curve shows the track of its right wheel.

The red, black, and green curves all have the SAME LENGTH (~10.6807 feet), but they are three DIFFERENT SHAPES.

If I were to command the left and right sides of a skid-steer vehicle to each travel exactly 10.6807 feet, the chances that the vehicle would follow the black curve are pretty slim. In fact, if the left and right sides were controlled identically and perfectly, it would travel in a straight line and end up on the X axis with coordinates x=10 y=0.


Attached Thumbnails
Click image for larger version

Name:	tracksGraph.png
Views:	102
Size:	8.1 KB
ID:	12505  Click image for larger version

Name:	shapes.png
Views:	87
Size:	7.3 KB
ID:	12507  
Attached Files
File Type: pdf tracks equations.pdf (16.1 KB, 55 views)
  #12   Spotlight this post!  
Unread 02-04-2012, 01:06
Andrew Lawrence
 
Posts: n/a
Re: Curve Driving Generator

Wow. All I have to say is Ether = Genius.

I'll email my programmers this thread, since it will put them to good use for the next 9 months or so.
  #13   Spotlight this post!  
Unread 02-04-2012, 14:40
theNerd's Avatar
theNerd theNerd is offline
Registered User
FRC #3329 (Cam Bots)
Team Role: Programmer
 
Join Date: Jan 2011
Rookie Year: 2110
Location: St. Marys
Posts: 51
theNerd is an unknown quantity at this point
Re: Curve Driving Generator

Quote:
Originally Posted by Ether View Post

Food for thought

See attached graph.

There's a Segway with a 2-foot wheelbase sitting at the origin.

Its heading is aligned with the +X axis.

I drive the Segway so that the center of its axle follows the black Bezier curve.

At the end of the path, the Segway's heading is parallel to the X axis and its coordinates are x=10 y=3.

The red curve shows the track of its left wheel, and the green curve shows the track of its right wheel.

The red, black, and green curves all have the SAME LENGTH (~10.6807 feet), but they are three DIFFERENT SHAPES.

If I were to command the left and right sides of a skid-steer vehicle to each travel exactly 10.6807 feet, the chances that the vehicle would follow the black curve are pretty slim. In fact, if the left and right sides were controlled identically and perfectly, it would travel in a straight line and end up on the X axis with coordinates x=10 y=0.


Ok, so arc length would not bee what I am looking for but left and right wheel speeds? (Since the integrals of the three curves are different?)
Also, I noticed with the 3rd degree polynomial solution I can not compute a curve for a pi/2 rotation for the robot at the destination point.
How would I go about working with bezier curves as I have never worked with them in my life .
  #14   Spotlight this post!  
Unread 03-04-2012, 00:04
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: Curve Driving Generator

Quote:
Originally Posted by theNerd View Post
How would I go about working with bezier curves as I have never worked with them in my life .
First play around with these Java applets to get a feel for what a Bezier curve is:

http://www.math.ucla.edu/~baker/java/hoefer/Bezier.htm

http://www.math.ubc.ca/~cass/gfx/bezier.html

... then I will try to answer your questions


  #15   Spotlight this post!  
Unread 03-04-2012, 14:08
theNerd's Avatar
theNerd theNerd is offline
Registered User
FRC #3329 (Cam Bots)
Team Role: Programmer
 
Join Date: Jan 2011
Rookie Year: 2110
Location: St. Marys
Posts: 51
theNerd is an unknown quantity at this point
Re: Curve Driving Generator

Quote:
Originally Posted by Ether View Post
... then I will try to answer your questions
]
Ok, I am ready. I have quite a good feel for Bezier curves now....which is great timing since my Calc class just hit parametric equations.
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 21:14.

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