27 #ifndef MPBLOCKS_DUBINS_CURVES_CUDA2_SOLUTION_RSR_HPP_
28 #define MPBLOCKS_DUBINS_CURVES_CUDA2_SOLUTION_RSR_HPP_
35 namespace curves_cuda {
41 template <
typename Format_t>
65 template <
typename Format_t>
72 using namespace cuda::linalg2;
74 const Format_t _PI =
static_cast<Format_t
>(M_PI);
75 const Format_t
_2 =
static_cast<Format_t
>(2);
81 v << Dispatch::sin( get<2>(q0) ),
82 -Dispatch::cos( get<2>(q0) );
87 v << Dispatch::sin( get<2>(q1) ),
88 -Dispatch::cos( get<2>(q1) );
100 Format_t
a = Dispatch::atan2( get<1>(v), get<0>(v) );
104 v << Dispatch::cos(
a + (_PI/
_2) ),
105 Dispatch::sin(
a + (_PI/
_2) );
113 l[0] =
cwArc( get<2>(q0),
a );
114 l[1] =
cwArc(
a, get<2>(q1) );
116 return Result_t( r*(l[0] + l[1]) + l[2] );
131 template <
typename Format_t>
139 using namespace cuda::linalg2;
141 const Format_t _PI =
static_cast<Format_t
>(M_PI);
142 const Format_t
_2 =
static_cast<Format_t
>(2);
148 v << Dispatch::sin( get<2>(q0) ),
149 -Dispatch::cos( get<2>(q0) );
154 v << Dispatch::sin( get<2>(q1) ),
155 -Dispatch::cos( get<2>(q1) );
167 Format_t
a = Dispatch::atan2( get<1>(v), get<0>(v) );
171 v << Dispatch::cos(
a + (_PI/
_2) ),
172 Dispatch::sin(
a + (_PI/
_2) );
177 for(
int i=0; i < 2; i++)
179 out.
t[i] = c[i] +
mktmp(r*v);
185 l[0] =
cwArc( get<2>(q0),
a );
186 l[1] =
cwArc(
a, get<2>(q1) );
191 for(
int i=0; i < 3; i++)
194 return Result_t( r*(l[0] + l[1]) + l[2] );
218 #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__ Matrix< Scalar, ROWS, COLS > mktmp(RValue< Scalar, ROWS, COLS, Exp > const &M)
forces the creation of a temporary
empty struct used to template "variant" of three arc primitives
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