27 #ifndef MPBLOCKS_DUBINS_CURVES_CUDA2_SOLUTION_LSR_HPP_
28 #define MPBLOCKS_DUBINS_CURVES_CUDA2_SOLUTION_LSR_HPP_
40 template<
typename Format_t>
63 template <
typename Format_t>
70 using namespace cuda::linalg2;
72 const Format_t _PI =
static_cast<Format_t
>(M_PI);
73 const Format_t
_2 =
static_cast<Format_t
>(2);
79 v << -Dispatch::sin( get<2>(q0) ),
80 Dispatch::cos( get<2>(q0) );
85 v << Dispatch::sin( get<2>(q1) ),
86 -Dispatch::cos( get<2>(q1) );
103 Format_t
a = -Dispatch::acos(
_2*r / d );
111 t[0] = c[0] +
mktmp(n*r);
112 t[1] = c[1] -
mktmp(n*r);
120 a = Dispatch::atan2( get<1>(n) , get<0>(n) );
129 l[2] =
norm(t[0]-t[1]);
131 return Result_t( r*(l[0] + l[1]) + l[2] );
147 template <
typename Format_t>
155 using namespace cuda::linalg2;
157 const Format_t _PI =
static_cast<Format_t
>(M_PI);
158 const Format_t
_2 =
static_cast<Format_t
>(2);
164 v << -Dispatch::sin( get<2>(q0) ),
165 Dispatch::cos( get<2>(q0) );
170 v << Dispatch::sin( get<2>(q1) ),
171 -Dispatch::cos( get<2>(q1) );
178 Format_t d =
norm(v);
188 Format_t
a = -Dispatch::acos(
_2*r / d );
196 t[0] = c[0] +
mktmp(n*r);
197 t[1] = c[1] -
mktmp(n*r);
205 a = Dispatch::atan2( get<1>(n) , get<0>(n) );
214 l[2] =
norm(t[0]-t[1]);
219 for(
int i=0; i < 2; i++)
228 for(
int i=0; i < 3; i++)
231 return Result_t( r*(l[0] + l[1]) + l[2] );
251 #endif // SOLUTIONLRLA_H_
__host__ __device__ Format_t cwArc(Format_t a, Format_t b)
returns the clockwise (right) distance from a to b
__device__ __host__ Normalize< Scalar, Exp > normalize(RValue< Scalar, Exp > const &A)
empty struct used to template "variant" of three arc primitives
__device__ __host__ Matrix< Scalar, ROWS, COLS > mktmp(RValue< Scalar, ROWS, COLS, Exp > const &M)
forces the creation of a temporary
__host__ __device__ Format_t ccwArc(Format_t a, Format_t b)
returns the counter clockwise (left) distance from a to b
empty struct used to template "variant" of three arc primitives
empty struct used to template "right turn" primitive
Encapsulates the solution distance along with a feasibility bit for a particular primitive solution...
__host__ __device__ Format_t clampRadian(Format_t a)
wraps the input onto [-pi,pi]
__device__ __host__ Scalar norm(const RValue< Scalar, ROWS, COLS, Exp > &M)
compute the norm
static Result< Format_t > solve(const Vector3d_t &q0, const Vector3d_t &q1, const Format_t r)
basic interface returns only the total distance
interface for different solutions