cheshirekow  v0.1.0
one_theta.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012 Josh Bialkowski (jbialk@mit.edu)
3  *
4  * This file is part of mpblocks.
5  *
6  * mpblocks is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * mpblocks is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with mpblocks. If not, see <http://www.gnu.org/licenses/>.
18  */
26 #ifndef MPBLOCKS_DUBINS_CURVES_EIGEN_HYPER_ONE_THETA_H_
27 #define MPBLOCKS_DUBINS_CURVES_EIGEN_HYPER_ONE_THETA_H_
28 
29 namespace mpblocks {
30 namespace dubins {
31 namespace curves_eigen {
32 namespace hyper {
33 
35 template <int tSpec, typename Format_t>
36 struct Solver<OFF, OFF, tSpec, Format_t> {
37  typedef Eigen::Matrix<Format_t, 3, 1> Vector3d_t;
38  typedef Eigen::Matrix<Format_t, 2, 1> Vector2d_t;
41 
42  static const unsigned int SPEC = SpecPack<OFF, OFF, tSpec>::Result;
43 
45  static Result_t solveL(const Vector3d_t& q0, const Hyper_t& h,
46  const Format_t r) {
47  Format_t arc0 =
48  ccwArc(clampRadian(q0[2]), clampRadian(get_constraint<tSpec, 2>(h)));
49  Result_t out(LRLa);
50  out = Vector3d_t(arc0, 0, 0);
51  return out;
52  };
53 
54  static Result_t solveR(const Vector3d_t& q0, const Hyper_t& h,
55  const Format_t r) {
56  Format_t arc0 =
57  cwArc(clampRadian(q0[2]), clampRadian(get_constraint<tSpec, 2>(h)));
58  Result_t out(RLRa);
59  out = Vector3d_t(arc0, 0, 0);
60 
61  return out;
62  };
63 
64  static Result_t solve(const Vector3d_t& q0, const Hyper_t& h,
65  const Format_t r) {
66  return bestOf(solveL(q0, h, r), solveR(q0, h, r), r);
67  };
68 };
69 
70 } // namespace hyper
71 } // namespace curves_eigen
72 } // namespace dubins
73 } // namespace mpblocks
74 
75 #endif // MPBLOCKS_DUBINS_CURVES_EIGEN_HYPER_ONE_THETA_H_
__host__ __device__ Format_t cwArc(Format_t a, Format_t b)
returns the clockwise (right) distance from a to b
Definition: funcs.hpp:72
the default solver is instantated when not all three constraints are active and it simply dispatches ...
Definition: Solver.hpp:95
__host__ __device__ Format_t ccwArc(Format_t a, Format_t b)
returns the counter clockwise (left) distance from a to b
Definition: funcs.hpp:51
Eigen::Matrix< Format_t, 3, 1 > Vector3d_t
Definition: Solver.hpp:96
A hyper-rectangle in dubins space: A rectangular prism in R^3.
Definition: hyper_rect.h:44
__host__ __device__ Format_t clampRadian(Format_t a)
wraps the input onto [-pi,pi]
Definition: funcs.hpp:37
static Result_t solveR(const Vector3d_t &q0, const Hyper_t &h, const Format_t r)
Definition: one_theta.hpp:54
static Result_t solve(const Vector3d_t &q0, const Hyper_t &h, const Format_t r)
Definition: one_theta.hpp:64
Encodes a dubins path primitive, which is three connected arc segments.
Definition: path.h:42
static Result_t solveL(const Vector3d_t &q0, const Hyper_t &h, const Format_t r)
get the distance for a left turn
Definition: one_theta.hpp:45
Path< Format_t > bestOf(const Path< Format_t > &r0, const Path< Format_t > &r1, const Format_t r)
Definition: path.h:96