Robowflex  v0.1
Making MoveIt Easy
robowflex::darts::ConstraintExtractor Class Reference

Helper class to manage extracting states from a possibly constrained state space. More...

#include <planning.h>

+ Inheritance diagram for robowflex::darts::ConstraintExtractor:

Public Member Functions

 ConstraintExtractor ()=default
 Constructor. More...
 
 ConstraintExtractor (const ompl::base::SpaceInformationPtr &si)
 Constructor. More...
 
const StateSpacegetSpace () const
 Gets the underlying state space from the space information. More...
 
void setSpaceInformation (const ompl::base::SpaceInformationPtr &si)
 Set space information used for constraint extraction. More...
 
State Access
StateSpace::StateTypetoState (ompl::base::State *state) const
 Extract underlying state from a base state. More...
 
const StateSpace::StateTypetoStateConst (const ompl::base::State *state) const
 Extract underlying state from a base state. More...
 
StateSpace::StateTypefromConstrainedState (ompl::base::State *state) const
 Access the underlying state from a constrained OMPL state. More...
 
const StateSpace::StateTypefromConstrainedStateConst (const ompl::base::State *state) const
 Access the underlying state from a constrained OMPL state. More...
 
StateSpace::StateTypefromUnconstrainedState (ompl::base::State *state) const
 Access the underlying state from an unconstrained OMPL state. More...
 
const StateSpace::StateTypefromUnconstrainedStateConst (const ompl::base::State *state) const
 Access the underlying state from an unconstrained OMPL state. More...
 

Private Attributes

ompl::base::SpaceInformationPtr space_info_
 Space Information. More...
 
bool is_constrained_ {false}
 Is the underlying space constrained? More...
 

Detailed Description

Helper class to manage extracting states from a possibly constrained state space.

Definition at line 49 of file robowflex_dart/include/robowflex_dart/planning.h.

Constructor & Destructor Documentation

◆ ConstraintExtractor() [1/2]

robowflex::darts::ConstraintExtractor::ConstraintExtractor ( )
default

Constructor.

◆ ConstraintExtractor() [2/2]

ConstraintExtractor::ConstraintExtractor ( const ompl::base::SpaceInformationPtr &  si)

Constructor.

Parameters
[in]siThe space information.

ConstraintExtractor

Definition at line 24 of file robowflex_dart/src/planning.cpp.

25 {
27 }
void setSpaceInformation(const ompl::base::SpaceInformationPtr &si)
Set space information used for constraint extraction.

Member Function Documentation

◆ fromConstrainedState()

StateSpace::StateType * ConstraintExtractor::fromConstrainedState ( ompl::base::State *  state) const

Access the underlying state from a constrained OMPL state.

Parameters
[in]stateConstrained state to access.
Returns
The underlying state.

Definition at line 48 of file robowflex_dart/src/planning.cpp.

49 {
50  return state->as<ompl::base::ConstrainedStateSpace::StateType>()->getState()->as<StateSpace::StateType>();
51 }
State type for the robowflex::darts::StateSpace.
Definition: space.h:69

◆ fromConstrainedStateConst()

const StateSpace::StateType * ConstraintExtractor::fromConstrainedStateConst ( const ompl::base::State *  state) const

Access the underlying state from a constrained OMPL state.

Parameters
[in]stateConstrained state to access.
Returns
The underlying state.

Definition at line 54 of file robowflex_dart/src/planning.cpp.

55 {
56  return fromConstrainedState(const_cast<ompl::base::State *>(state));
57 }
StateSpace::StateType * fromConstrainedState(ompl::base::State *state) const
Access the underlying state from a constrained OMPL state.

◆ fromUnconstrainedState()

StateSpace::StateType * ConstraintExtractor::fromUnconstrainedState ( ompl::base::State *  state) const

Access the underlying state from an unconstrained OMPL state.

Parameters
[in]stateUnconstrained state to access.
Returns
The underlying state.

Definition at line 59 of file robowflex_dart/src/planning.cpp.

60 {
61  return state->as<StateSpace::StateType>();
62 }

◆ fromUnconstrainedStateConst()

const StateSpace::StateType * ConstraintExtractor::fromUnconstrainedStateConst ( const ompl::base::State *  state) const

Access the underlying state from an unconstrained OMPL state.

Parameters
[in]stateUnconstrained state to access.
Returns
The underlying state.

Definition at line 65 of file robowflex_dart/src/planning.cpp.

66 {
67  return fromUnconstrainedState(const_cast<ompl::base::State *>(state));
68 }
StateSpace::StateType * fromUnconstrainedState(ompl::base::State *state) const
Access the underlying state from an unconstrained OMPL state.

◆ getSpace()

const StateSpace * ConstraintExtractor::getSpace ( ) const

Gets the underlying state space from the space information.

Returns
State space.

Definition at line 70 of file robowflex_dart/src/planning.cpp.

71 {
72  return (is_constrained_ ?
73  space_info_->getStateSpace()->as<ompl::base::ConstrainedStateSpace>()->getSpace() :
74  space_info_->getStateSpace())
75  ->as<StateSpace>();
76 }
ompl::base::SpaceInformationPtr space_info_
Space Information.
An OMPL state space for robowflex::darts::World. Can do motion planning for any of the robots or stru...
Definition: space.h:31

◆ setSpaceInformation()

void ConstraintExtractor::setSpaceInformation ( const ompl::base::SpaceInformationPtr &  si)

Set space information used for constraint extraction.

Parameters
[in]siThe space information.

Definition at line 29 of file robowflex_dart/src/planning.cpp.

30 {
31  space_info_ = si;
32  is_constrained_ = std::dynamic_pointer_cast<ompl::base::ConstrainedSpaceInformation>(si) != nullptr;
33 }

◆ toState()

StateSpace::StateType * ConstraintExtractor::toState ( ompl::base::State *  state) const

Extract underlying state from a base state.

Parameters
[in]stateState.
Returns
Underlying robot state.

Definition at line 35 of file robowflex_dart/src/planning.cpp.

36 {
37  if (is_constrained_)
38  return fromConstrainedState(state);
39 
40  return fromUnconstrainedState(state);
41 }

◆ toStateConst()

const StateSpace::StateType * ConstraintExtractor::toStateConst ( const ompl::base::State *  state) const

Extract underlying state from a base state.

Parameters
[in]stateState.
Returns
Underlying robot state.

Definition at line 43 of file robowflex_dart/src/planning.cpp.

44 {
45  return toState(const_cast<ompl::base::State *>(state));
46 }
StateSpace::StateType * toState(ompl::base::State *state) const
Extract underlying state from a base state.

Member Data Documentation

◆ is_constrained_

bool robowflex::darts::ConstraintExtractor::is_constrained_ {false}
private

Is the underlying space constrained?

Definition at line 114 of file robowflex_dart/include/robowflex_dart/planning.h.

◆ space_info_

ompl::base::SpaceInformationPtr robowflex::darts::ConstraintExtractor::space_info_
private

Space Information.

Definition at line 113 of file robowflex_dart/include/robowflex_dart/planning.h.


The documentation for this class was generated from the following files: