Head.h
1 /*********************************************************************
2  * Software License Agreement (BSD License)
3  *
4  * Copyright (c) 2020,
5  * Max Planck Institute for Intelligent Systems (MPI-IS).
6  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  *
12  * * Redistributions of source code must retain the above copyright
13  * notice, this list of conditions and the following disclaimer.
14  * * Redistributions in binary form must reproduce the above
15  * copyright notice, this list of conditions and the following
16  * disclaimer in the documentation and/or other materials provided
17  * with the distribution.
18  * * Neither the name of the MPI-IS nor the names
19  * of its contributors may be used to endorse or promote products
20  * derived from this software without specific prior written
21  * permission.
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
26  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
27  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
28  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
29  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
30  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
31  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
33  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34  * POSSIBILITY OF SUCH DAMAGE.
35  *********************************************************************/
36 
37 /* Author: Andreas Orthey */
38 
39 #ifndef OMPL_MULTILEVEL_PLANNERS_BUNDLESPACE_PATH_RESTRICTION_BASEPATHHEAD__
40 #define OMPL_MULTILEVEL_PLANNERS_BUNDLESPACE_PATH_RESTRICTION_BASEPATHHEAD__
41 #include <ompl/multilevel/datastructures/BundleSpaceGraph.h>
42 
43 namespace ompl
44 {
45  namespace multilevel
46  {
47  OMPL_CLASS_FORWARD(BundleSpaceGraph);
48  OMPL_CLASS_FORWARD(PathRestriction);
49  OMPL_CLASS_FORWARD(FiberedProjection);
50 
52 
63  class Head
64  {
65  public:
66  Head(PathRestriction *restriction, Configuration *const xCurrent, Configuration *const xTarget);
67 
68  Head(const Head &rhs);
69 
70  ~Head();
71 
73  const base::State *getState() const;
75  const base::State *getStateFiber() const;
77  const base::State *getStateBase() const;
78 
80  base::State *getStateFiberNonConst() const;
82  base::State *getStateBaseNonConst() const;
85 
87  void setCurrent(Configuration *, double);
88 
92  const base::State *getStateTargetFiber() const;
94  base::State *getStateTargetFiberNonConst() const;
95 
99 
101  const base::State *getBaseStateAt(int k) const;
103  int getBaseStateIndexAt(int k) const;
104 
106  double getLocationOnBasePath() const;
108  void setLocationOnBasePath(double d);
109 
111  int getNextValidBasePathIndex() const;
113  int getLastValidBasePathIndex() const;
114  void setLastValidBasePathIndex(int k);
115 
117  friend std::ostream &operator<<(std::ostream &, const Head &);
118 
119  void print(std::ostream &) const;
120 
122  PathRestriction *getRestriction() const;
123 
124  private:
125  double locationOnBasePath_{0.0};
126  int lastValidIndexOnBasePath_{0};
127 
128  PathRestriction *restriction_{nullptr};
129 
130  Configuration *xCurrent_{nullptr};
131  base::State *xBaseCurrent_{nullptr};
132  base::State *xFiberCurrent_{nullptr};
133 
134  Configuration *xTarget_{nullptr};
135  base::State *xFiberTarget_{nullptr};
136  };
137  }
138 }
139 
140 #endif
double getLocationOnBasePath() const
Get location in [0,1] on base path to which head points.
Definition: Head.cpp:193
Definition of an abstract state.
Definition: State.h:113
const base::State * getStateBase() const
Get projection of state onto base space.
Definition: Head.cpp:123
base::State * getStateFiberNonConst() const
Get projection of state onto fiber space (non const)
Definition: Head.cpp:128
int getLastValidBasePathIndex() const
Get last base path index (before head)
Definition: Head.cpp:175
int getNextValidBasePathIndex() const
Get next base path index (after head)
Definition: Head.cpp:180
Configuration * getTargetConfiguration() const
Get target configuration.
Definition: Head.cpp:138
const base::State * getStateTargetFiber() const
Get target configuration projected onto fiber.
Definition: Head.cpp:143
const base::State * getBaseStateAt(int k) const
Get target configuration projected onto fiber (non const)
Definition: Head.cpp:223
void setCurrent(Configuration *, double)
Setter for current configuration/state.
Definition: Head.cpp:153
base::State * getStateBaseNonConst() const
Get projection of state onto base space (non const)
Definition: Head.cpp:133
const base::State * getStateFiber() const
Get projection of state onto fiber space.
Definition: Head.cpp:118
base::State * getStateTargetFiberNonConst() const
Get target configuration projected onto fiber (non const)
Definition: Head.cpp:148
friend std::ostream & operator<<(std::ostream &, const Head &)
Pipe head to stream.
Definition: Head.cpp:275
const base::State * getState() const
Get state to which head points.
Definition: Head.cpp:113
void setLocationOnBasePath(double d)
Set location of head along base path.
Definition: Head.cpp:213
int getNumberOfRemainingStates()
Remaining discrete states starting at head (including head) and relative to the head.
Definition: Head.cpp:198
Configuration * getConfiguration() const
Get state as configuration.
Definition: Head.cpp:108
int getBaseStateIndexAt(int k) const
Get base state at base path index.
Definition: Head.cpp:238
PathRestriction * getRestriction() const
Get underlying path restriction.
Definition: Head.cpp:103
Main namespace. Contains everything in this library.
Definition: AppBase.h:21