PlannerDataVertexAnnotated.h
1 /*********************************************************************
2  * Software License Agreement (BSD License)
3  *
4  * Copyright (c) 2019, University of Stuttgart
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  *
11  * * Redistributions of source code must retain the above copyright
12  * notice, this list of conditions and the following disclaimer.
13  * * Redistributions in binary form must reproduce the above
14  * copyright notice, this list of conditions and the following
15  * disclaimer in the documentation and/or other materials provided
16  * with the distribution.
17  * * Neither the name of the University of Stuttgart nor the names
18  * of its contributors may be used to endorse or promote products
19  * derived from this software without specific prior written
20  * permission.
21  *
22  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
25  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
26  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
27  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
28  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
30  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
32  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33  * POSSIBILITY OF SUCH DAMAGE.
34  *********************************************************************/
35 
36 /* Author: Andreas Orthey */
37 
38 #ifndef OMPL_MULTILEVEL_PLANNERS_BUNDLESPACE_SRC_VERTEX_ANNOTATED_
39 #define OMPL_MULTILEVEL_PLANNERS_BUNDLESPACE_SRC_VERTEX_ANNOTATED_
40 
41 #include <ompl/base/PlannerData.h>
42 #include <boost/serialization/export.hpp>
43 
44 namespace ompl
45 {
46  namespace multilevel
47  {
55  class PlannerDataVertexAnnotated : public ompl::base::PlannerDataVertex
56  {
57  // If new elements are added,
58  // you need to update the clone/getstate functions!
59  public:
62 
64  virtual ~PlannerDataVertexAnnotated() override;
65  virtual PlannerDataVertex *clone() const override;
66 
68  void setLevel(unsigned int level_);
69  unsigned int getLevel() const;
70 
72  void setMaxLevel(unsigned int level_);
73  unsigned int getMaxLevel() const;
74 
77  void setComponent(unsigned int component_);
78  unsigned int getComponent() const;
79 
87 
89  void setBaseState(const ompl::base::State *s);
90 
94  virtual const ompl::base::State *getState() const override;
95 
98 
100  const ompl::base::State *getBaseState() const;
101 
102  ompl::base::SpaceInformationPtr getSpaceInformationPtr() const;
103 
106  virtual bool operator==(const PlannerDataVertex &rhs) const override;
107 
108  friend std::ostream &operator<<(std::ostream &, const PlannerDataVertexAnnotated &);
109 
110  protected:
112  unsigned int level_{0};
113 
115  unsigned int maxLevel_{1};
116 
119  unsigned int component_{0};
120 
130  bool totalStateIsSet{false};
131 
134  const ompl::base::State *stateBase_{nullptr};
135 
137  ompl::base::State *stateTotal_{nullptr};
138 
142  };
143 
144  } // namespace multilevel
145 } // namespace ompl
146 #endif
void setMaxLevel(unsigned int level_)
The maximum level in the bundle space hierarchy.
A shared pointer wrapper for ompl::base::SpaceInformation.
const ompl::base::State * getBaseState() const
Returns base state, indepent of mode.
virtual bool operator==(const PlannerDataVertex &rhs) const override
Verifies equality by checking level and base state (mode independent)
Definition of an abstract state.
Definition: State.h:113
bool totalStateIsSet
There are two modes. Mode 1 is the normal mode where this class contains a reference to the base stat...
void setComponent(unsigned int component_)
The component of vertex in the graph (start, goal or other component)
ompl::base::State * stateTotal_
Storage of total state.
virtual const ompl::base::State * getState() const override
Returns base state in baseMode and total state in totalMode. The total space here is the last element...
unsigned int level_
The level for the base state.
void setTotalState(ompl::base::State *s, ompl::base::SpaceInformationPtr si)
Set total state, i.e. the lift of the base state to the total space (last Spaceinformationptr in sequ...
const ompl::base::State * stateBase_
Internal reference to base state. Same as state_ in normal Mode to avoid confusion.
PlannerDataVertex(const State *st, int tag=0)
Constructor. Takes a state pointer and an optional integer tag.
Definition: PlannerData.h:158
unsigned int maxLevel_
How many spaces exists in the multilevel structure.
unsigned int component_
(Optional:) which component in roadmap does vertex belong to
void setLevel(unsigned int level_)
The level of vertex in the bundle space hierarchy.
ompl::base::State * getStateNonConst() const
Same as getState(), but state can be changed.
ompl::base::SpaceInformationPtr si_
Pointer to total space (to free total space element upon deletion)
virtual PlannerDataVertex * clone() const override
Return a clone of this object, allocated from the heap.
PlannerDataVertexAnnotated(const ompl::base::State *state)
Constructor for base state. Set mode to baseMode.
Base class for a vertex in the PlannerData structure. All derived classes must implement the clone an...
Definition: PlannerData.h:122
void setBaseState(const ompl::base::State *s)
Explicitly changes base state (does not change mode)
Main namespace. Contains everything in this library.
Definition: AppBase.h:21