ProjectionFactory.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_BUNDLE_SUBSPACE_FACTORY__
40 #define OMPL_MULTILEVEL_PLANNERS_BUNDLESPACE_BUNDLE_SUBSPACE_FACTORY__
41 #include <ompl/multilevel/datastructures/ProjectionTypes.h>
42 #include <ompl/base/State.h>
43 #include <ompl/base/StateSpace.h>
44 #include <ompl/base/SpaceInformation.h>
45 
46 namespace ompl
47 {
48  namespace multilevel
49  {
51 
52  OMPL_CLASS_FORWARD(Projection);
54  }
55  namespace multilevel
56  {
57  /* \brief If no projection operator is provided, you can invoke this
58  * projection component factory, which tries to guess the projection
59  * mapping. For example, if you specify SE3 and R3 as bundle and base,
60  * this factory would return the projection onto the R3 subspace in SE3. */
61  class ProjectionFactory
62  {
63  public:
64  ProjectionFactory() = default;
65 
67  // std::vector<ProjectionPtr> MakeProjections(const base::SpaceInformationPtr &Bundle,
68  // const base::SpaceInformationPtr &Base);
69 
70  // std::vector<ProjectionPtr> MakeProjections(const base::SpaceInformationPtr &Bundle);
71 
72  ProjectionPtr makeProjection(const base::SpaceInformationPtr &Bundle,
73  const base::SpaceInformationPtr &Base);
74 
75  ProjectionPtr makeProjection(const base::SpaceInformationPtr &Bundle);
76 
77  // ProjectionPtr MakeProjections(const base::SpaceInformationPtr &Bundle);
78 
79  protected:
80  ProjectionPtr makeProjection(const base::StateSpacePtr &BundleSpace, const base::StateSpacePtr &BaseSpace,
81  bool areValidityCheckersEquivalent);
82 
83  ProjectionPtr makeProjection(const base::StateSpacePtr &BundleSpace);
84 
87  ProjectionType identifyProjectionType(const base::StateSpacePtr &BundleSpace,
88  const base::StateSpacePtr &BaseSpace);
89 
91  bool isMapping_Identity(const base::StateSpacePtr &, const base::StateSpacePtr &);
93  bool isMapping_EmptyProjection(const base::StateSpacePtr &, const base::StateSpacePtr &);
96  bool isMapping_RN_to_RM(const base::StateSpacePtr &, const base::StateSpacePtr &);
99  bool isMapping_SE2_to_R2(const base::StateSpacePtr &, const base::StateSpacePtr &);
102  bool isMapping_SE2RN_to_R2(const base::StateSpacePtr &, const base::StateSpacePtr &);
105  bool isMapping_SE2RN_to_SE2(const base::StateSpacePtr &, const base::StateSpacePtr &);
108  bool isMapping_SE2RN_to_SE2RM(const base::StateSpacePtr &, const base::StateSpacePtr &);
111  bool isMapping_SE3_to_R3(const base::StateSpacePtr &, const base::StateSpacePtr &);
114  bool isMapping_SE3RN_to_R3(const base::StateSpacePtr &, const base::StateSpacePtr &);
117  bool isMapping_SE3RN_to_SE3(const base::StateSpacePtr &, const base::StateSpacePtr &);
120  bool isMapping_SE3RN_to_SE3RM(const base::StateSpacePtr &, const base::StateSpacePtr &);
123  bool isMapping_SO2RN_to_SO2(const base::StateSpacePtr &, const base::StateSpacePtr &);
126  bool isMapping_SO2RN_to_SO2RM(const base::StateSpacePtr &, const base::StateSpacePtr &);
129  bool isMapping_SO2N_to_SO2M(const base::StateSpacePtr &, const base::StateSpacePtr &);
132  bool isMapping_SO3RN_to_SO3(const base::StateSpacePtr &, const base::StateSpacePtr &);
135  bool isMapping_SO3RN_to_SO3RM(const base::StateSpacePtr &, const base::StateSpacePtr &);
138  bool isMapping_RNSO2_to_RN(const base::StateSpacePtr &, const base::StateSpacePtr &);
139 
143  bool isMapping_XRN_to_XRM(const base::StateSpacePtr &, const base::StateSpacePtr &,
144  const base::StateSpaceType);
145 
149  bool isMapping_XRN_to_X(const base::StateSpacePtr &, const base::StateSpacePtr &,
150  const base::StateSpaceType);
151 
153  int GetNumberOfComponents(const base::StateSpacePtr &space);
154  };
155  }
156 }
157 #endif
bool isMapping_SO2RN_to_SO2(const base::StateSpacePtr &, const base::StateSpacePtr &)
Check if mapping is to .
ProjectionType identifyProjectionType(const base::StateSpacePtr &BundleSpace, const base::StateSpacePtr &BaseSpace)
Guess the projection type from the list of projections in ompl::multilevel::ProjectionTypes.
bool isMapping_SE2RN_to_SE2(const base::StateSpacePtr &, const base::StateSpacePtr &)
Check if mapping is to .
bool isMapping_RN_to_RM(const base::StateSpacePtr &, const base::StateSpacePtr &)
Check if mapping is to .
bool isMapping_SE3_to_R3(const base::StateSpacePtr &, const base::StateSpacePtr &)
Check if mapping is to .
int GetNumberOfComponents(const base::StateSpacePtr &space)
Estimate number of components on state space.
bool isMapping_SE2RN_to_SE2RM(const base::StateSpacePtr &, const base::StateSpacePtr &)
Check if mapping is to .
bool isMapping_RNSO2_to_RN(const base::StateSpacePtr &, const base::StateSpacePtr &)
Check if mapping is to .
bool isMapping_SE3RN_to_SE3(const base::StateSpacePtr &, const base::StateSpacePtr &)
Check if mapping is to .
bool isMapping_SO2RN_to_SO2RM(const base::StateSpacePtr &, const base::StateSpacePtr &)
Check if mapping is to .
bool isMapping_XRN_to_XRM(const base::StateSpacePtr &, const base::StateSpacePtr &, const base::StateSpaceType)
Check if mapping is to whereby .
bool isMapping_SE3RN_to_SE3RM(const base::StateSpacePtr &, const base::StateSpacePtr &)
Check if mapping is to .
bool isMapping_SO2N_to_SO2M(const base::StateSpacePtr &, const base::StateSpacePtr &)
Check if mapping is to .
bool isMapping_XRN_to_X(const base::StateSpacePtr &, const base::StateSpacePtr &, const base::StateSpaceType)
Check if mapping is to whereby .
bool isMapping_SO3RN_to_SO3RM(const base::StateSpacePtr &, const base::StateSpacePtr &)
Check if mapping is to .
bool isMapping_SE2_to_R2(const base::StateSpacePtr &, const base::StateSpacePtr &)
Check if mapping is to .
ProjectionPtr makeProjection(const base::SpaceInformationPtr &Bundle, const base::SpaceInformationPtr &Base)
Guess projection(s) between two SpaceInformationPtr Bundle and Base.
bool isMapping_Identity(const base::StateSpacePtr &, const base::StateSpacePtr &)
Check if the mapping is an identity mapping.
StateSpaceType
The type of a state space.
bool isMapping_SO3RN_to_SO3(const base::StateSpacePtr &, const base::StateSpacePtr &)
Check if mapping is to .
bool isMapping_EmptyProjection(const base::StateSpacePtr &, const base::StateSpacePtr &)
Check if the mapping is an empty projection.
bool isMapping_SE3RN_to_R3(const base::StateSpacePtr &, const base::StateSpacePtr &)
Check if mapping is to .
bool isMapping_SE2RN_to_R2(const base::StateSpacePtr &, const base::StateSpacePtr &)
Check if mapping is to .
Main namespace. Contains everything in this library.