Path Planner Cubic

This path planner takes precalculated cubic splines from a file and outputs the resulting values for jerk, acceleration, velocity and position onto its outputs. All these values are given for one dimension. The file must contain piecewise information about the jerk within a given interval together with the start conditions for acceleration, velocity and position at the beginning of the interval. You must make sure, that these initial values are the results from the last interval. Let's make an example with the following four intervals:

//time          //jerk          //acceleration  //velocity      //position
8.0000000e-02   0.0000000e+00   0.0000000e+00   0.0000000e+00   0.0000000e+00
2.4000000e-01   1.0000000e+04   0.0000000e+00   0.0000000e+00   0.0000000e+00
8.0000000e-02   0.0000000e+00   2.4000000e+03   2.8800000e+02   2.3040000e+01
2.4000000e-01  -1.0000000e+04   2.4000000e+03   4.8000000e+02   5.3760000e+01

The jerk within the second interval is 1e4 while the acceleration, velocity and position are all zero at the beginning of this interval. The jerk is set to zero in the third interval. The acceleration, velocity and position must be set to the values they reached at the end of interval two in order not to cause any discontinuities. You have to calculate these values with an external tool.

Path planner output for a given path

The trajectory file is loaded with

  init(filename);

where filename denotes a file containing the new trajectory.
When calling

  move(startPos);

you dispatch a new trajectory. The trajectory is taken from the path file, no scaling is made. The trajectory starts from startPos and moves the distance given in the trajectory path file within the time given in the same file.
You can also call

  move(time, startPos, deltaPos);

This will take the trajectory from the file and scale it so that it starts at startPos and moves the distance given by deltaPos within the desired time.