Closed qsctr closed 5 years ago
See MATLAB
directory for updated MATLAB code.
Currently using SplineInterpolator from Apache Commons Math. It says that it is a natural cubic spline interpolation.
I tested the spline algorithm on some sample data and compared it to the output of spline
in Octave, but the points seem to be off very slightly (average of about 2%).
cc @bayntun @Kof223
Since we do not need equal time intervals now, the code can be made simpler.
Calculations are now done, I just need to clean up the code and get it to output the correct things.
Code is done, now we are testing it on the robot.
Motion profile executes the path successfully when the time duration is not given. However, the robot motion becomes inconsistent with non-zero time duration.
Future improvements:
Findings so far: 0 works the same way as before. Difference is slightly faster.
Currently trying to increase the time duration until it doesn't work.
What do you mean by difference is slightly faster
I will be testing Cubic Hermite Spline using Apache Commons Math's HermiteInterpolator. This is useful in some circumstances in that instead of providing 4 waypoints, you can provide 2 waypoints (endpoints essentially) and provide the first derivative desired at the 2 endpoints (essentially the angle). See this Desmos thing I made for reference.
Hermite spline test successful! How should I upload the code?
Can you commit to the onboard-pathing branch, swapping out SplineInterpolator
for HermiteInterpolator
? For the angles you can just take them as parameters to the method.
The way I have it written you can choose between HermiteInterpolator and SplineInterpolator with a boolean flag.
Should I keep only HermiteInterpolator?
Yes, unless you can think of a good reason to keep the old spline around.
I see, Hermite is probably better indeed. Also, an updated Desmos that shows x and y being splined separately.
Average execution time of the generatePath
method is 48.2 milliseconds.
Moved hermite spline improvements to #24.
Should a new issue/branch be made specifically to integrate MotionProfile code into the repo?
Yes
Ok, created #28
Path fitting through waypoints at runtime in robot code. This is useful if we want to adjust the waypoints through vision/lidar inputs as we run the autonomous. Probably will be written in Java along with the rest of the robot code.