39#include <ompl/multilevel/datastructures/projections/SE3RN_R3.h>
40#include <ompl/base/spaces/SE3StateSpace.h>
41#include <ompl/base/spaces/SO3StateSpace.h>
42#include <ompl/base/spaces/RealVectorStateSpace.h>
46Projection_SE3RN_R3::Projection_SE3RN_R3(ompl::base::StateSpacePtr
BundleSpace, ompl::base::StateSpacePtr BaseSpace)
54 const auto *xBundle_SE3 = xBundle->
as<base::CompoundState>()->as<base::SE3StateSpace::StateType>(0);
55 const auto *xBundle_SO3 = &xBundle_SE3->rotation();
56 const auto *xBundle_RN = xBundle->
as<base::CompoundState>()->as<base::RealVectorStateSpace::StateType>(1);
58 auto *xFiber_SO3 = xFiber->
as<base::CompoundState>()->as<base::SO3StateSpace::StateType>(0);
59 auto *xFiber_RN = xFiber->
as<base::CompoundState>()->as<base::RealVectorStateSpace::StateType>(1);
61 xFiber_SO3->x = xBundle_SO3->x;
62 xFiber_SO3->y = xBundle_SO3->y;
63 xFiber_SO3->z = xBundle_SO3->z;
64 xFiber_SO3->w = xBundle_SO3->w;
68 xFiber_RN->values[k] = xBundle_RN->values[k];
72void Projection_SE3RN_R3::project(
const ompl::base::State *xBundle, ompl::base::State *xBase)
const
74 const auto *xBundle_SE3 = xBundle->
as<base::CompoundState>()->as<base::SE3StateSpace::StateType>(0);
77 xBase_R3->values[0] = xBundle_SE3->getX();
78 xBase_R3->values[1] = xBundle_SE3->getY();
79 xBase_R3->values[2] = xBundle_SE3->getZ();
82void Projection_SE3RN_R3::lift(
const ompl::base::State *xBase,
const ompl::base::State *xFiber,
83 ompl::base::State *xBundle)
const
85 auto *xBundle_SE3 = xBundle->
as<base::CompoundState>()->as<base::SE3StateSpace::StateType>(0);
86 auto *xBundle_SO3 = &xBundle_SE3->rotation();
87 auto *xBundle_RN = xBundle->
as<base::CompoundState>()->as<base::RealVectorStateSpace::StateType>(1);
90 const auto *xFiber_SO3 = xFiber->
as<base::CompoundState>()->as<base::SO3StateSpace::StateType>(0);
91 const auto *xFiber_RN = xFiber->
as<base::CompoundState>()->as<base::RealVectorStateSpace::StateType>(1);
93 xBundle_SE3->setXYZ(xBase_R3->values[0], xBase_R3->values[1], xBase_R3->values[2]);
94 xBundle_SO3->x = xFiber_SO3->x;
95 xBundle_SO3->y = xFiber_SO3->y;
96 xBundle_SO3->z = xFiber_SO3->z;
97 xBundle_SO3->w = xFiber_SO3->w;
101 xBundle_RN->values[k] = xFiber_RN->values[k];
105ompl::base::StateSpacePtr Projection_SE3RN_R3::computeFiberSpace()
107 base::CompoundStateSpace *Bundle_compound = getBundle()->
as<base::CompoundStateSpace>();
108 const std::vector<base::StateSpacePtr> Bundle_decomposed = Bundle_compound->
getSubspaces();
109 const std::vector<base::StateSpacePtr> Bundle_SE3_decomposed =
110 Bundle_decomposed.at(0)->as<base::CompoundStateSpace>()->getSubspaces();
112 const auto *Bundle_RN = Bundle_decomposed.at(1)->as<base::RealVectorStateSpace>();
113 unsigned int N = Bundle_RN->getDimension();
115 base::StateSpacePtr SO3(
new base::SO3StateSpace());
116 base::StateSpacePtr RN(
new base::RealVectorStateSpace(N));
117 RN->as<base::RealVectorStateSpace>()->setBounds(Bundle_RN->getBounds());
const std::vector< StateSpacePtr > & getSubspaces() const
Get the list of components.
ompl::base::State StateType
Define the type of state allocated by this space.
Definition of an abstract state.
const T * as() const
Cast this instance to a desired type.
unsigned int getFiberDimension() const
Dimension of Fiber Space.
This namespace contains datastructures and planners to exploit multilevel abstractions,...
@ PROJECTION_SE3RN_R3
SE3RN \rightarrow R3.