acmerobotics / road-runner

Wheeled mobile robot motion planning library designed for FTC
MIT License
209 stars 75 forks source link

Quick Question: How does RoadRunner approxiate path arc length? #59

Closed hashgupta closed 3 years ago

hashgupta commented 3 years ago

I was looking at the source code for the RoadRunner paths and the document in the doc folder, and I saw an integral for the arc length of a path using numerical integration. Does the code use a specific numerical integration method for path length?

rbrott commented 3 years ago

This post gives a good overview of the method.

hashgupta commented 3 years ago

I was thinking of writing a pull request with Midpoint Formula numerical integration for the arc length, just for the experience. It shouldn't be too hard because the Spline class always calculates x and y derivatives with respect to t, so I can just integrate that. Would that be a good idea? or would I just be wasting my time?

rbrott commented 3 years ago

I think that's a great exercise for personal learning, especially if you want to practice/brush up on your calculus, but I'm hesitant to merge anything unless it's significantly superior to the current arc length method.

hashgupta commented 3 years ago

I was attempting to build a fork of the current repo on AS, but it keeps giving me an error.

Gradle sync failed: Could not find matching constructor for: org.gradle.api.publish.ivy.internal.publisher.IvyDescriptorFileGenerator(org.gradle.api.publish.ivy.internal.publication.DefaultIvyPublicationIdentity)

Any ideas on how to fix this?

rbrott commented 3 years ago

I doubt this repository will open in Android Studio as it doesn't directly depend on Android. I personally use IDEA.

hashgupta commented 3 years ago

I did some testing with arc length integration. It mostly failed, even when I experimented with Midpoint, Trapezoidal, and Simpson's rule. Quite disappointing, but a good practice with my calculus skills. Should also be a good indication that the current method is quite optimal :).