How would I generate a trajectory (e.g. minimum snap/jerk/acceleration) for a quad rotor between GPS coordinates? In all the examples that I have seen, they assume that the x,y positions are in meters relative to a starting point (0,0). Is it as simple as calculating the distance of a straight line between the 2 points and dividing that up into segments to create a continuous path?

By the way I'm ignoring the z/altitude value as that value will be a constant value throughout in my case.

A sample trajectory for reference that I have seen when applying boundary conditions to a quin-tic polynomial to generate velocity and acceleration polynomials.

time,   x,                  y
0.0,    0.0,                0.0
0.1,    0.00350070021007,   0.00350070021007
0.2,    0.0105021006302,    0.0105021006302
0.3,    0.0210042012604,    0.0210042012604
0.4,    0.0350070021007,    0.0350070021007
0.5,    0.0525105031511,    0.0525105031511
0.6,    0.0735147044115,    0.0735147044115
0.7,    0.098019605882,     0.098019605882
0.8,    0.126025207563,     0.126025207563
0.9,    0.157531509453,     0.157531509453
1.0,    0.231046213865,     0.231046213865
1.1,    0.273054616385,     0.273054616385
1.2,    0.318563719116,     0.318563719116
1.3,    0.367573522057,     0.367573522057
1.4,    0.420084025208,     0.420084025208
1.5,    0.47609522857,      0.47609522857
1.6,    0.535607132141,     0.535607132141
1.7,    0.598619735922,     0.598619735922
1.8,    0.665133039913,     0.665133039913
1.9,    0.735147044115,     0.735147044115
2.0,    0.808661748526,     0.808661748526

As reported for example in https://robotics.stackexchange.com/a/21571/6941, a minimum-jerk trajectory in one dimension is coded with respect to time $t$ as: $$ x(t) = x_i + (x_f-x_i) \cdot \left( 10\left(\frac{t}{t_f}\right)^3 -15\left(\frac{t}{t_f}\right)^4 +6\left(\frac{t}{t_f}\right)^5\right), $$ where $t_f$ is the final time ($2\, \text{s}$ in your case), $t \in \left[0, t_f\right]$, and $x_i$ and $x_f$ are the initial and final position, respectively.

You can easily extend this to the two-dimensional case.

  • $\begingroup$ Thank you, that makes a lot of sense! Also is there a good way to tie the generated trajectory to a GPS start and end location for reasonable accuracy? $\endgroup$ – Brien Crean Jan 11 at 18:18
  • $\begingroup$ Given your GPS locations in a convenient 2D representation, you ought to apply the above formula that is responsible for generating a trajectory linking the start to the end point with the desired timing. So, you'll have $[x_i, x_f]$ as well as $[y_i, y_f]$. $\endgroup$ – Ugo Pattacini Jan 11 at 18:54

Extending the previous answer which describes how to compute a minimum-jerk trajectory given a consistent distance coordinate system. A simple way to do this is to treat the first coordinate as your origin then convert each other GPS point to meter distances from your first coordinate using one of the latitude and longitude equations here

  • $\begingroup$ Thanks! I ended up using a North East Down coordinate system by converting from GPS to UTM and then using the first coordinate in that frame as my origin (0,0,0) for the NED frame and calculating meter distances from that $\endgroup$ – Brien Crean Jan 19 at 5:08
  • $\begingroup$ That's what I do in almost all my projects (except I'm an ENU fan); just beware that UTM meters are not exactly equal to real-life meters. $\endgroup$ – Octopuscabbage Jan 20 at 0:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.