Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   Curve Driving Generator (http://www.chiefdelphi.com/forums/showthread.php?t=105211)

theNerd 02-04-2012 14:48

Re: Curve Driving Generator
 
Quote:

Originally Posted by MICHAELABICK (Post 1152423)
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.

Ether 03-04-2012 00:04

Re: Curve Driving Generator
 
Quote:

Originally Posted by theNerd (Post 1152975)
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



dbeckwith 03-04-2012 07:24

Re: Curve Driving Generator
 
Quote:

Originally Posted by theNerd (Post 1152975)
How would I go about working with bezier curves as I have never worked with them in my life :) .

Bezier curves are defined by a formula that can be generalized for any degree, but for the most common, degree 3, the equation for any point along the curve is: B(t) = (1 - t)^3 * P0 + 3 * (1 - t)^2 * t * P1 + 3 * (1 - t) * t^2 * P2 + t^3 * P3 for any t between 0 and 1, inclusive. So you have four control points in a degree 3 curve which you can use to define the shape of the curve, its endpoints, and its tangents at the endpoints (the applet Ether linked to are great for seeing how these affect the curve). I'm not a math genius like Ether so I'm not really sure exactly how to implement them into your question, but in my experience with computer graphics I've found that Bezier splines are easier to control in a way that makes sense than cubic splines.

The Wikipedia article on Bezier curves has a lot of cool information on them: http://en.wikipedia.org/wiki/Bezier_curves

Also if you needed to get the slope of a Bezier curve at some point for your pathing algorithm, I found this: http://www.cs.mtu.edu/~shene/COURSES...ezier-der.html

theNerd 03-04-2012 14:08

Re: Curve Driving Generator
 
Quote:

Originally Posted by Ether (Post 1153317)
... 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.

PTC_Chris 13-09-2012 12:46

Re: Curve Driving Generator
 
1 Attachment(s)
I have been conducting Mathcad webinars for FIRST teams. A search turned up this conversation and I have implemented the Matrix Solution as a Mathcad worksheet. The attached .zip folder contains both a Mathcad Prime 2.0 and a .pdf version of the worksheet.

PTC is once again offering Mathcad Prime for free to participants in FIRST Robotics programs. Contact FIRSTsupport@ptc.com if you are interested in obtaining a copy of Mathcad Prime.

You can learn how to create Mathcad worksheets like this on our Wednesday Night Robotalk Webinars (7 pm EST). This Wednesday night (Sept 19 2012) we will focus on the tools used in the attached worksheet. To register for the webinar click here.

Chris

Ether 13-09-2012 13:16

Re: Curve Driving Generator
 
3 Attachment(s)
Quote:

Originally Posted by PTC_Chris (Post 1185465)
I have implemented the Matrix Solution as a Mathcad worksheet.

Thanks for posting this Chris. Unfortunately, the example you picked is a case where a cubic polynomial is surely not what you'd want. A Bezier curve would give a much more desirable curve for the robot to follow. Does Mathcad support Bezier curves?


Attached is a Bezier curve for the example you gave.

Also, there's an Excel spreadsheet here for those who don't have Maxima* installed:

http://www.chiefdelphi.com/media/papers/2713


* Maxima is a free open-source Computer Algebra System, available for download at the link below. Highly recommended:

http://maxima.sourceforge.net/





PTC_Chris 14-09-2012 08:39

Re: Curve Driving Generator
 
@Ether: The example in the .pdf was more deliberate than unfortunate. I chose a tangent line slope that would exagerate the effect and help high school students to make connections to their work in schools. (I am an educator, not an engineer.)

I included the .pdf more to show what a Mathcad worksheet looks like. I think it is more transparent than either Excel or Maxima because Mathcad uses standard math notation. The .pdf was not meant to be the primary contribution.

The Mathcad worksheet is a computational document, so it is possible to change the parameters. The worksheet is therefore a general method for calculating a cubic polynomial given the endpoints and tangent slopes. As you observed in your post, there are some examples where the solution is efficient, others where it is not. With the Mathcad worksheet, it is possible to quickly derive and plot a path and determine whether or not it is a solution worth implementing.

It is certainly possible to build a Mathcad worksheet to generate the Bezier Curve. I will add this to my "Want to Do" list and post it to the Thread when I cross it off. Thanks for the suggestion and the Excel worksheet. I'll probably convert your Excel spreadsheet to Mathcad.

Ether 14-09-2012 10:42

Re: Curve Driving Generator
 
Quote:

Originally Posted by PTC_Chris (Post 1185564)
@Ether: The example in the .pdf was more deliberate than unfortunate. I chose a tangent line slope that would exagerate the effect and help high school students to make connections to their work in schools. (I am an educator, not an engineer.)

Ah. Thanks for that clarification. In that context, I think your example is excellent.

I'm both an engineer (now retired after 33 years) and an educator. I share your passion about teaching.




All times are GMT -5. The time now is 11:22.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi