cheshirekow  v0.1.0
two_theta_x.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  */
27 #ifndef MPBLOCKS_DUBINS_CURVES_EIGEN_HYPER_TWO_THETA_X_H_
28 #define MPBLOCKS_DUBINS_CURVES_EIGEN_HYPER_TWO_THETA_X_H_
29 
37 
38 namespace mpblocks {
39 namespace dubins {
40 namespace curves_eigen {
41 namespace hyper {
42 namespace two_theta_x {
43 
45 template <int xSpec, int tSpec, typename Format_t>
46 struct HelperWrap {
48  template <int... List>
49  struct SolverIterator {};
50 
51  template <int First, int... List>
52  struct SolverIterator<First, List...> {
53  typedef Eigen::Matrix<Format_t, 3, 1> Vector3d_t;
54  typedef Eigen::Matrix<Format_t, 2, 1> Vector2d_t;
57 
59 
60  static Result_t solve(const Vector3d_t& q0, const Hyper_t& h,
61  const Format_t r) {
62  return bestOf(Solver_t::solve(q0, h, r),
63  SolverIterator<List...>::solve(q0, h, r), r);
64  };
65  };
66 
67  template <int Last>
68  struct SolverIterator<Last> {
69  typedef Eigen::Matrix<Format_t, 3, 1> Vector3d_t;
70  typedef Eigen::Matrix<Format_t, 2, 1> Vector2d_t;
73 
75 
76  static Result_t solve(const Vector3d_t& q0, const Hyper_t& h,
77  const Format_t r) {
78  return Solver_t::solve(q0, h, r);
79  };
80  };
81 
83 };
84 
85 } // namespace two_theta_x
86 
88 template <int xSpec, int tSpec, typename Format_t>
89 struct Solver<xSpec, OFF, tSpec, Format_t> {
90  typedef Eigen::Matrix<Format_t, 3, 1> Vector3d_t;
91  typedef Eigen::Matrix<Format_t, 2, 1> Vector2d_t;
94 
97 
98  static Result_t solve(const Vector3d_t& q0, const Hyper_t& h,
99  const Format_t r) {
100  return Iterator::solve(q0, h, r);
101  };
102 };
103 
104 } // namespace hyper
105 } // namespace curves_eigen
106 } // namespace dubins
107 } // namespace mpblocks
108 
109 #endif // MPBLOCKS_DUBINS_CURVES_EIGEN_HYPER_TWO_THETA_X_H_
static Result_t solve(const Vector3d_t &q0, const Hyper_t &h, const Format_t r)
Definition: two_theta_x.hpp:76
the default solver is instantated when not all three constraints are active and it simply dispatches ...
Definition: Solver.hpp:95
wraps structures and accessors for the specific xSpec and tSpec
Definition: two_theta_x.hpp:46
interface for variants of solvers, default template is never instantiated
Definition: Solver.hpp:37
two_theta_x::HelperWrap< xSpec, tSpec, Format_t > Helper
Definition: two_theta_x.hpp:95
A hyper-rectangle in dubins space: A rectangular prism in R^3.
Definition: hyper_rect.h:44
static Result_t solve(const Vector3d_t &q0, const Hyper_t &h, const Format_t r)
Definition: two_theta_x.hpp:98
SolverIterator< LSL, LSR, RSL, RSR, LRLa, RLRa > SolverIterator_t
Definition: two_theta_x.hpp:82
Encodes a dubins path primitive, which is three connected arc segments.
Definition: path.h:42
Path< Format_t > bestOf(const Path< Format_t > &r0, const Path< Format_t > &r1, const Format_t r)
Definition: path.h:96
static Result_t solve(const Vector3d_t &q0, const Hyper_t &h, const Format_t r)
Definition: two_theta_x.hpp:60
Path< Format_t > solve(const Eigen::Matrix< Format_t, 3, 1 > &q0, const HyperRect< Format_t > &h, const Format_t r)