37#include "ompl/base/spaces/TrochoidStateSpace.h"
38#include "ompl/base/SpaceInformation.h"
39#include "ompl/util/Exception.h"
41#include <boost/math/constants/constants.hpp>
47 constexpr double twopi = 2. * boost::math::constants::pi<double>();
48 const double TROCHOID_EPS = 1e-6;
50 double trochoid_delx(
double omega,
double dir,
double delt,
double phi0,
double wind_ratio)
52 return .0 / (dir * omega) * (std::sin(dir * omega * delt + phi0) - std::sin(phi0)) + wind_ratio * delt;
55 double straight_delx(
double wind_ratio,
double delt,
double hInitRad)
57 return (std::cos(hInitRad) + wind_ratio) * delt;
60 double straight_dely(
double delt,
double hInitRad)
62 return std::sin(hInitRad) * delt;
65 double trochoid_dely(
double omega,
double dir,
double delt,
double hInitRad)
67 return 1.0 / (dir * omega) * (-std::cos(dir * omega * delt + hInitRad) + std::cos(hInitRad));
70 double trochoid_delh(
double omega,
double dir,
double delt)
72 return dir * omega * delt;
90 void computeEndpointBSB(
double delta_1,
double delta_2,
double tA,
double tBeta,
double T,
double phi0,
91 double radius,
double wind_ratio,
double &xf,
double &yf,
double &phif)
94 double x0 = 0.0, y0 = 0.0;
95 double omega = (1.0 / radius);
96 double xBinit = x0 + trochoid_delx(omega, delta_1, tA, phi0, wind_ratio);
97 double yBinit = y0 + trochoid_dely(omega, delta_1, tA, phi0);
98 double hBinit = phi0 + trochoid_delh(omega, delta_1, tA);
100 double xBfinal, yBfinal, hBfinal;
101 xBfinal = xBinit + straight_delx(wind_ratio, tBeta - tA, hBinit);
102 yBfinal = yBinit + straight_dely(tBeta - tA, hBinit);
106 xf = xBfinal + trochoid_delx(omega, delta_2, T - tBeta, hBfinal, wind_ratio);
107 yf = yBfinal + trochoid_dely(omega, delta_2, T - tBeta, hBfinal);
108 phif = hBfinal + trochoid_delh(omega, delta_2, T - tBeta);
109 phif = fmod(phif, twopi);
139 bool checkConditionsBSB(
double delta_1,
double delta_2,
double tA,
double tB,
double xt10,
double yt10,
double phi0,
140 double phit1,
double xt20,
double yt20,
double phit2,
double xf,
double yf,
double radius,
144 if (std::isnan(tA) || std::isnan(tB))
149 double xtAdot = cos(delta_1 * (1. / radius) * tA + phit1) + wind_ratio;
150 double ytAdot = sin(delta_1 * (1. / radius) * tA + phit1);
151 double xtBdot = cos(delta_2 * (1. / radius) * tB + phit2) + wind_ratio;
152 double ytBdot = sin(delta_2 * (1. / radius) * tB + phit2);
154 double xtA = (radius / delta_1) * sin(delta_1 * (1. / radius) * tA + phit1) + wind_ratio * tA + xt10;
155 double ytA = (-radius / delta_1) * cos(delta_1 * (1. / radius) * tA + phit1) + yt10;
156 double xtB = (radius / delta_2) * sin(delta_2 * (1. / radius) * tB + phit2) + wind_ratio * tB + xt20;
157 double ytB = (-radius / delta_2) * cos(delta_2 * (1. / radius) * tB + phit2) + yt20;
160 double t2pi = twopi * radius;
162 if (tB < -t2pi || tB > t2pi)
166 if (tA < 0 || tA > 2 * t2pi)
170 if ((xtB - xtA) * xtAdot < -eps)
174 if ((ytB - ytA) * ytAdot < -eps)
178 if ((xtB - xtA) * xtBdot < -eps)
182 if ((ytB - ytA) * ytBdot < -eps)
187 if (fabs(ytB - ytA) > eps && fabs(ytAdot) > eps && fabs((xtB - xtA) / (ytB - ytA) - xtAdot / ytAdot) >= eps)
191 if (fabs(ytB - ytA) > eps && fabs(ytBdot) > eps && fabs((xtB - xtA) / (ytB - ytA) - xtBdot / ytBdot) >= eps)
197 sqrt((xtB - xtA) * (xtB - xtA) + (ytB - ytA) * (ytB - ytA)) / sqrt(xtBdot * xtBdot + ytBdot * ytBdot);
198 double T = tA + p + (t2pi - tB);
202 double tBeta = tA + p;
203 double endpoint_x, endpoint_y, endoint_phi;
204 computeEndpointBSB(delta_1, delta_2, tA, tBeta, T, phi0, radius, wind_ratio, endpoint_x, endpoint_y,
206 if (fabs(endpoint_x - xf) > eps && fabs(endpoint_y - yf) > eps)
213 if (T < trochoid_path.length())
217 trochoid_path.
length_[2] = t2pi - tB;
223 if (T < trochoid_path.length() && T > 0.1)
227 trochoid_path.
length_[2] = t2pi - tB;
255 double fixedPointBSB(
double p0,
double delta_1,
double delta_2,
double k,
double xt10,
double yt10,
double phit1,
256 double xt20,
double yt20,
double phit2,
double radius,
double wind_ratio)
258 constexpr double tol = 0.0001;
259 constexpr int N = 50;
260 std::array<double, N> pvec;
263 double omega = 1. / radius;
266 double p = pvec[i - 1];
267 double E = (delta_1 - delta_2) / (delta_2 * delta_1 * omega) - (yt20 - yt10) / wind_ratio;
268 double F = (xt20 - xt10) / wind_ratio + (delta_1 / delta_2 - 1) * p +
269 (phit1 - phit2 + k * twopi) / (delta_2 * omega);
270 double G = (yt20 - yt10) + 1.0 / wind_ratio * (delta_2 - delta_1) / (delta_1 * delta_2 * omega);
271 double f = E * cos(delta_1 * omega * p + phit1) + F * sin(delta_1 * omega * p + phit1) - G;
272 double fBar = -E * sin(delta_1 * omega * p + phit1) * delta_1 * omega +
273 F * cos(delta_1 * omega * p + phit1) * delta_1 * omega +
274 sin(delta_1 * omega * p + phit1) * (delta_1 / delta_2 - 1);
275 pvec[i] = p - f / fBar;
276 if (fabs(pvec[i] - pvec[i - 1]) < tol)
282 return std::numeric_limits<double>::quiet_NaN();
301 void trochoidBSB(
double x0,
double y0,
double phi0,
double xf,
double yf,
double phif,
double delta_1,
302 double delta_2,
double radius,
double wind_ratio,
bool periodic,
305 double V_w = wind_ratio;
306 double omega = 1.0 / radius;
307 double t2pi = twopi * radius;
309 double phit1 = fmod(phi0, twopi);
310 double xt10 = x0 - delta_1 * radius * std::sin(phit1);
311 double yt10 = y0 + delta_1 * radius * std::cos(phit1);
313 double phit2 = fmod(phif - delta_2 * omega * t2pi, twopi);
314 double xt20 = xf - delta_2 * radius * std::sin(delta_2 * omega * t2pi + phit2) - V_w * t2pi;
315 double yt20 = yf + delta_2 * radius * cos(delta_2 * omega * t2pi + phit2);
317 if (delta_1 == delta_2)
319 for (
int k_int = -2; k_int < 2; k_int++)
321 double k = (double)k_int;
322 double alpha = std::atan2(
323 yt20 - yt10, xt20 - xt10 + V_w * (fmod(phit1 - phit2, twopi) - k * twopi) / (delta_1 * omega));
324 double tA = t2pi / (delta_1 * twopi) * (std::asin(V_w * std::sin(alpha)) + alpha - phit1);
325 if (tA > t2pi || tA < 0)
327 tA = tA - t2pi * floor(tA / t2pi);
329 double tB = tA + (fmod(phit1 - phit2, twopi) - k * twopi) / (delta_1 * twopi) * t2pi;
330 checkConditionsBSB(delta_1, delta_2, tA, tB, xt10, yt10, phi0, phit1, xt20, yt20, phit2, xf, yf, radius,
331 wind_ratio, periodic, path);
336 for (
int k_int = -2; k_int < 2; k_int++)
338 double k = (double)k_int;
339 constexpr int numTestPts = 10;
340 std::array<double, numTestPts> rootsComputed;
341 constexpr double sameRootEpsilon = 0.001;
342 for (
int l = 0; l < numTestPts; l++)
344 bool rootAlreadyfound =
false;
346 double p0 = (double)(l + 1) * t2pi / (double)numTestPts;
348 double tA = fixedPointBSB(p0, delta_1, delta_2, k, xt10, yt10, phit1, xt20, yt20, phit2, radius,
351 if (tA < 0 && fabs(tA) < TROCHOID_EPS)
355 if (tA > t2pi || tA < 0)
357 tA = tA - t2pi * floor(tA / t2pi);
362 for (
int i = 0; i < l; i++)
364 if (fabs(rootsComputed[i] - tA) <= sameRootEpsilon)
366 rootAlreadyfound =
true;
371 rootsComputed[l] = tA;
373 if (!rootAlreadyfound)
375 double tB = delta_1 / delta_2 * tA + (phit1 - phit2 + k * twopi) / (delta_2 * omega);
376 checkConditionsBSB(delta_1, delta_2, tA, tB, xt10, yt10, phi0, phit1, xt20, yt20, phit2, xf, yf,
377 radius, wind_ratio, periodic, path);
406 bool checkConditionsBBB(
double delta_1,
double tA,
double tB,
double T,
double xt10,
double yt10,
double phit1,
407 double xf,
double yf,
double phif,
double radius,
double wind_ratio,
bool periodic,
410 if (std::isnan(tA) || std::isnan(tB) || std::isnan(T))
414 double omega = 1. / radius;
415 double t2pi = twopi * radius;
416 double d2 = -delta_1;
419 double phit3 = fmod(phif - d3 * omega * T, twopi);
420 double xt30 = xf - 1.0 / (d3 * omega) * sin(phif) - wind_ratio * T;
421 double yt30 = yf + 1.0 / (d3 * omega) * cos(phif);
423 double phit2 = 2 * delta_1 * omega * tA + phit1;
424 double xt20 = xt30 - 2 * 1.0 / (d2 * omega) * sin(d2 * omega * tB + phit2);
425 double yt20 = yt30 + 2 * 1.0 / (d2 * omega) * cos(d2 * omega * tB + phit2);
427 double xt1tA = 1.0 / (delta_1 * omega) * sin(delta_1 * omega * tA + phit1) + wind_ratio * tA + xt10;
428 double yt1tA = -1.0 / (delta_1 * omega) * cos(delta_1 * omega * tA + phit1) + yt10;
430 double xt2tA = 1.0 / (d2 * omega) * sin(d2 * omega * tA + phit2) + wind_ratio * tA + xt20;
431 double yt2tA = -1.0 / (d2 * omega) * cos(d2 * omega * tA + phit2) + yt20;
433 double xt2tB = 1.0 / (d2 * omega) * sin(d2 * omega * tB + phit2) + wind_ratio * tB + xt20;
434 double yt2tB = -1.0 / (d2 * omega) * cos(d2 * omega * tB + phit2) + yt20;
435 double xt3tB = 1.0 / (d3 * omega) * sin(d3 * omega * tB + phit3) + wind_ratio * tB + xt30;
436 double yt3tB = -1.0 / (d3 * omega) * cos(d3 * omega * tB + phit3) + yt30;
438 double xt1dottA = 1.0 * cos(delta_1 * omega * tA + phit1) + wind_ratio;
439 double yt1dottA = 1.0 * sin(delta_1 * omega * tA + phit1);
440 double xt2dottA = 1.0 * cos(d2 * omega * tA + phit2) + wind_ratio;
441 double yt2dottA = 1.0 * sin(d2 * omega * tA + phit2);
443 double xt2dottB = 1.0 * cos(d2 * omega * tB + phit2) + wind_ratio;
444 double yt2dottB = 1.0 * sin(d2 * omega * tB + phit2);
445 double xt3dottB = 1.0 * cos(d3 * omega * tB + phit3) + wind_ratio;
446 double yt3dottB = 1.0 * sin(d3 * omega * tB + phit3);
451 if (tA < 0 || tB < tA || T < tB || T > 4.0 * t2pi)
455 if (fabs(xt1tA - xt2tA) >= eps)
459 if (fabs(yt1tA - yt2tA) >= eps)
463 if (fabs(xt2tB - xt3tB) >= eps)
467 if (fabs(yt2tB - yt3tB) >= eps)
471 if (fabs(xt1dottA - xt2dottA) >= eps)
475 if (fabs(yt1dottA - yt2dottA) >= eps)
479 if (fabs(xt2dottB - xt3dottB) >= eps)
483 if (fabs(yt2dottB - yt3dottB) >= eps)
490 if (T < trochoid_path.length())
493 trochoid_path.
length_[1] = tB - tA;
494 trochoid_path.
length_[2] = T - tB;
500 if (T < trochoid_path.length() && T > 0.1)
503 trochoid_path.
length_[1] = tB - tA;
504 trochoid_path.
length_[2] = T - tB;
531 std::pair<double, double> fixedpointBBB(
double p0,
double p1,
double delta_1,
double k,
double xt10,
double yt10,
532 double phit1,
double xf,
double yf,
double phif,
double radius,
536 constexpr double tol = 0.0001;
537 constexpr int N = 50;
538 double d2 = -delta_1;
540 double omega = 1.0 / radius;
541 std::array<double, N> pvec1;
542 std::array<double, N> pvec2;
548 double tA = pvec1[i - 1];
549 double T = pvec2[i - 1];
552 2. / (delta_1 * omega) * sin(delta_1 * omega * tA + phit1) + wind_ratio * T + xt10 - xf +
553 1.0 / (d3 * omega) * sin(phif) +
554 2 / (d2 * omega) * sin(d2 * omega * T / 2 + (phif + phit1 + k * twopi) / 2 + delta_1 * omega * tA);
555 double f2 = -2 * 1.0 / (delta_1 * omega) * cos(delta_1 * omega * tA + phit1) + yt10 - yf -
556 1.0 / (d3 * omega) * cos(phif) -
557 2 * 1.0 / (d2 * omega) *
558 cos(d2 * omega * T / 2 + (phif + phit1 + k * twopi) / 2 + delta_1 * omega * tA);
561 (cos(delta_1 * omega * tA + phit1) -
562 cos(d2 * omega * T / 2 + (phif + phit1 + k * twopi) / 2 + delta_1 * omega * tA));
564 wind_ratio + 1.0 * cos(d2 * omega * T / 2 + (phif + phit1 + k * twopi) / 2 + delta_1 * omega * tA);
566 (sin(delta_1 * omega * tA + phit1) -
567 sin(d2 * omega * T / 2 + (phif + phit1 + k * twopi) / 2 + delta_1 * omega * tA));
568 double d = 1.0 * sin(d2 * omega * T / 2 + (phif + phit1 + k * twopi) / 2 + delta_1 * omega * tA);
569 double det = a * d - b * c;
571 pvec1[i] = pvec1[i - 1] - (d / det * f1 - b / det * f2);
572 pvec2[i] = pvec2[i - 1] - (-c / det * f1 + a / det * f2);
574 if ((pvec1[i] - pvec1[i - 1]) * (pvec1[i] - pvec1[i - 1]) +
575 (pvec2[i] - pvec2[i - 1]) * (pvec2[i] - pvec2[i - 1]) <
578 return {pvec1[i], pvec2[i]};
582 return {std::numeric_limits<double>::quiet_NaN(), std::numeric_limits<double>::quiet_NaN()};
600 void trochoidBBB(
double x0,
double y0,
double phit1,
double xf,
double yf,
double phif,
double delta_1,
603 double omega = (1 / radius);
604 double t2pi = twopi * radius;
606 double xt10 = x0 - 1.0 / (delta_1 * omega) * sin(phit1);
607 double yt10 = y0 + 1.0 / (delta_1 * omega) * cos(phit1);
609 double delta_2 = -delta_1;
612 constexpr int numTestPts = 10;
613 std::array<std::array<double, 3>, numTestPts * numTestPts> rootsComputed;
614 double sameRootEpsilon = 0.001;
615 for (
int kint = -2; kint < 3; kint++)
617 double k = (double)kint;
618 for (
int l = 0; l < numTestPts; l++)
620 for (
int n = 0; n < numTestPts; n++)
622 bool rootAlreadyfound =
false;
624 double tA_test = (double)(l + 1) * t2pi / numTestPts;
625 double T_test = (double)(n + 1) * 3 * t2pi / numTestPts;
627 fixedpointBBB(tA_test, T_test, delta_1, k, xt10, yt10, phit1, xf, yf, phif, radius, wind_ratio);
628 double tB = tA + T / 2 + (phif - phit1 + k * twopi) / (2 * delta_2 * omega);
630 int curRow = (l)*numTestPts + (n);
634 for (
int i = 0; i < curRow; i++)
636 if (fabs(rootsComputed[i][0] - tA) <= sameRootEpsilon &&
637 fabs(rootsComputed[i][1] - tB) <= sameRootEpsilon &&
638 fabs(rootsComputed[i][2] - T) <= sameRootEpsilon)
640 rootAlreadyfound =
true;
645 rootsComputed[curRow] = {tA, tB, T};
648 if (!rootAlreadyfound)
650 checkConditionsBBB(delta_1, tA, tB, T, xt10, yt10, phit1, xf, yf, phif, radius, wind_ratio,
658 bool isLongPathCase(
double x0,
double y0,
double phi0,
double xf,
double yf,
double phif,
double radius,
661 double dx = (xf - x0) / radius, dy = (yf - y0) / radius;
662 double d = sqrt(dx * dx + dy * dy), theta = atan2(dy, dx);
663 double alpha = phi0 - theta, beta = phif - theta;
664 bool is_geometric_long_path = (std::abs(std::sin(alpha)) + std::abs(std::sin(beta)) +
665 std::sqrt(4 - std::pow(std::cos(alpha) + std::cos(beta), 2)) - d) < 0;
666 bool is_wind_blowingaway = dx < 0;
667 return is_geometric_long_path && is_wind_blowingaway;
671 double radius,
double wind_ratio,
bool periodic)
674 trochoidBSB(x0, y0, phi0, xf, yf, phif, -1, -1, radius, wind_ratio, periodic, path);
679 double radius,
double wind_ratio,
bool periodic)
682 trochoidBSB(x0, y0, phi0, xf, yf, phif, 1, 1, radius, wind_ratio, periodic, path);
687 double radius,
double wind_ratio,
bool periodic)
690 trochoidBSB(x0, y0, phi0, xf, yf, phif, -1, 1, radius, wind_ratio, periodic, path);
695 double radius,
double wind_ratio,
bool periodic)
698 trochoidBSB(x0, y0, phi0, xf, yf, phif, 1, -1, radius, wind_ratio, periodic, path);
703 double radius,
double wind_ratio,
bool periodic)
706 trochoidBBB(x0, y0, phi0, xf, yf, phif, 1, radius, wind_ratio, periodic, path);
711 double radius,
double wind_ratio,
bool periodic)
714 trochoidBBB(x0, y0, phi0, xf, yf, phif, -1, radius, wind_ratio, periodic, path);
719 const double yf,
const double phif,
double radius,
double wind_ratio,
722 if (fabs(x0 - xf) < TROCHOID_EPS && fabs(y0 - yf) < TROCHOID_EPS && fabs(phi0 - phif) < TROCHOID_EPS &&
727 tmp(trochoidRSR(x0, y0, phi0, xf, yf, phif, radius, wind_ratio, periodic));
728 double len, minLength = path.length();
730 if ((len = tmp.length()) < minLength)
735 tmp = trochoidRSL(x0, y0, phi0, xf, yf, phif, radius, wind_ratio, periodic);
736 if ((len = tmp.length()) < minLength)
741 tmp = trochoidLSR(x0, y0, phi0, xf, yf, phif, radius, wind_ratio, periodic);
742 if ((len = tmp.length()) < minLength)
747 if (!isLongPathCase(x0, y0, phi0, xf, yf, phif, radius, wind_ratio))
749 tmp = trochoidRLR(x0, y0, phi0, xf, yf, phif, radius, wind_ratio, periodic);
750 if ((len = tmp.length()) < minLength)
755 tmp = trochoidLRL(x0, y0, phi0, xf, yf, phif, radius, wind_ratio, periodic);
756 if ((len = tmp.length()) < minLength)
768 os <<
"TrochoidPath[ type=";
769 for (
unsigned i = 0; i < 3; ++i)
770 if (path.type_->at(i) == TrochoidStateSpace::TROCHOID_LEFT)
772 else if (path.type_->at(i) == TrochoidStateSpace::TROCHOID_STRAIGHT)
776 os <<
", length=" << path.length_[0] <<
'+' << path.length_[1] <<
'+' << path.length_[2] <<
'=' << path.length()
777 <<
", reverse=" << path.reverse_ <<
" ]";
784 static const std::vector<std::vector<TrochoidStateSpace::TrochoidPathSegmentType>> *pathType =
785 new std::vector<std::vector<TrochoidStateSpace::TrochoidPathSegmentType>>(
786 {{{TROCHOID_LEFT, TROCHOID_STRAIGHT, TROCHOID_LEFT},
787 {TROCHOID_RIGHT, TROCHOID_STRAIGHT, TROCHOID_RIGHT},
788 {TROCHOID_RIGHT, TROCHOID_STRAIGHT, TROCHOID_LEFT},
789 {TROCHOID_LEFT, TROCHOID_STRAIGHT, TROCHOID_RIGHT},
790 {TROCHOID_RIGHT, TROCHOID_LEFT, TROCHOID_RIGHT},
791 {TROCHOID_LEFT, TROCHOID_RIGHT, TROCHOID_LEFT}}});
803 return getPath(state1, state2, radius, wind_ratio, wind_heading).length();
805double TrochoidStateSpace::symmetricDistance(
const State *state1,
const State *state2,
double radius,
double wind_ratio,
808 return std::min(
getPath(state1, state2, radius, wind_ratio, wind_heading).length(),
809 getPath(state2, state1, radius, wind_ratio, wind_heading).length());
814 bool firstTime =
true;
820 PathType &path,
State *state)
const
847 if (path2.length() < path.length())
849 path2.reverse_ =
true;
859 double wind_ratio,
double wind_heading)
const
862 double seg = t * path.length(), phi, v, x_t10, y_t10, delta;
867 for (
unsigned int i = 0; i < 3 && seg > 0; ++i)
869 v = std::min(seg, path.length_[i]);
872 switch (path.type_->at(i))
876 x_t10 = s->getX() - (radius * delta) * sin(phi);
877 y_t10 = s->getY() + (radius * delta) * cos(phi);
878 s->setXY(x_t10 + (radius * delta) * sin(delta * (1.0 / radius) * v + phi) + wind_ratio * v,
879 y_t10 - (radius * delta) * cos(delta * (1.0 / radius) * v + phi));
880 s->setYaw(phi + delta * (1.0 / radius) * v);
884 x_t10 = s->getX() - (radius * delta) * sin(phi);
885 y_t10 = s->getY() + (radius * delta) * cos(phi);
886 s->setXY(x_t10 + (radius * delta) * sin(delta * (1.0 / radius) * v + phi) + wind_ratio * v,
887 y_t10 - (radius * delta) * cos(delta * (1.0 / radius) * v + phi));
888 s->setYaw(phi + delta * (1.0 / radius) * v);
890 case TROCHOID_STRAIGHT:
891 s->setXY(s->getX() + v * cos(phi) + v * wind_ratio, s->getY() + v * sin(phi));
897 state->
as<
StateType>()->setX(s->getX() * std::cos(wind_heading) - s->getY() * std::sin(wind_heading) +
899 state->
as<
StateType>()->setY(s->getX() * std::sin(wind_heading) + s->getY() * std::cos(wind_heading) +
902 state->
as<
StateType>()->setYaw(s->getYaw() + wind_heading);
917 double wind_ratio,
double wind_heading,
bool periodic)
921 double x0 = s1->
getX(), y0 = s1->getY(), psi_0 = s1->getYaw();
922 double xf = s2->getX(), yf = s2->getY(), psi_f = s2->getYaw();
924 double phi0 = psi_0 - wind_heading;
925 double phif = psi_f - wind_heading;
928 double x_trochoid = (xf - x0) * std::cos(wind_heading) + (yf - y0) * std::sin(wind_heading);
929 double y_trochoid = -(xf - x0) * std::sin(wind_heading) + (yf - y0) * std::cos(wind_heading);
931 return ::getPath(0.0, 0.0, phi0, x_trochoid, y_trochoid, phif, radius, wind_ratio, periodic);
const StateSpacePtr & getSubspace(unsigned int index) const
Get a specific subspace from the compound state space.
bool equalStates(const State *state1, const State *state2) const override
Checks whether two states are equal.
void copyState(State *destination, const State *source) const override
Copy a state to another. The memory of source and destination should NOT overlap.
A state in SE(2): (x, y, yaw).
double getYaw() const
Get the yaw component of the state. This is the rotation in plane, with respect to the Z axis.
double getY() const
Get the Y component of the state.
double getX() const
Get the X component of the state.
State * allocState() const override
Allocate a state that can store a point in the described space.
void freeState(State *state) const override
Free the memory of the allocated state.
ompl::base::State StateType
Define the type of state allocated by this space.
virtual unsigned int validSegmentCount(const State *state1, const State *state2) const
Count how many segments of the "longest valid length" fit on the motion from state1 to state2.
Definition of an abstract state.
const T * as() const
Cast this instance to a desired type.
Complete description of a Dubins path.
double distance(const State *state1, const State *state2) const override
Computes distance between two states. This function satisfies the properties of a metric if isMetricS...
static const std::vector< std::vector< TrochoidPathSegmentType > > & dubinsPathType()
Dubins path types.
bool isSymmetric_
Whether the distance is "symmetrized".
double psi_w_
Wind direction [0, 2pi].
double rho_
Turning radius.
PathType getPath(const State *state1, const State *state2, bool periodic=false) const
Return a shortest Dubins path from SE(2) state state1 to SE(2) state state2.
unsigned int validSegmentCount(const State *state1, const State *state2) const override
Count how many segments of the "longest valid length" fit on the motion from state1 to state2....
void interpolate(const State *from, const State *to, double t, State *state) const override
Computes the state that lies at time t in [0, 1] on the segment that connects from state to to state....
This namespace contains sampling based planning routines shared by both planning under geometric cons...
std::ostream & operator<<(std::ostream &stream, Cost c)
Output operator for Cost.