Loading...
Searching...
No Matches

Definition of a control path. More...

#include <ompl/control/PathControl.h>

Inheritance diagram for ompl::control::PathControl:

Public Member Functions

 PathControl (const base::SpaceInformationPtr &si)
 Constructor.
 
 PathControl (const PathControl &path)
 Copy constructor.
 
PathControloperator= (const PathControl &other)
 Assignment operator.
 
base::Cost cost (const base::OptimizationObjectivePtr &opt) const override
 Not yet implemented.
 
double length () const override
 The path length (sum of control durations)
 
bool check () const override
 Check if the path is valid.
 
void print (std::ostream &out) const override
 Print the path to a stream.
 
virtual void printAsMatrix (std::ostream &out) const
 Print the path as a real-valued matrix where the i-th row represents the i-th state along the path, followed by the control and duration needed to reach this state. For the first state the control and duration are zeroes. The state components printed are those returned by ompl::base::StateSpace::copyToReals, while the control components printed are the discrete components (if any) followed by the real-valued ones as returned by ompl::control::ControlSpace::getValueAddressAtIndex.
 
geometric::PathGeometric asGeometric () const
 Convert this path into a geometric path (interpolation is performed and then states are copied)
 
Path operations
void append (const base::State *state)
 Append state to the end of the path; it is assumed state is the first state, so no control is applied. The memory for state is copied. There are no checks to make sure the number of controls and states make sense.
 
void append (const base::State *state, const Control *control, double duration)
 Append state to the end of the path and assume control is applied for the duration duration. The memory for state and for control is copied. There are no checks to make sure the number of controls and states make sense.
 
void interpolate ()
 Make the path such that all controls are applied for a single time step (computes intermediate states)
 
void random ()
 Set this path to a random segment.
 
bool randomValid (unsigned int attempts)
 Set this path to a random valid segment. Sample attempts times for valid segments. Returns true on success.
 
Functionality for accessing states and controls
std::vector< base::State * > & getStates ()
 Get the states that make up the path (as a reference, so it can be modified, hence the function is not const)
 
std::vector< Control * > & getControls ()
 Get the controls that make up the path (as a reference, so it can be modified, hence the function is not const)
 
std::vector< double > & getControlDurations ()
 Get the control durations used along the path (as a reference, so it can be modified, hence the function is not const)
 
base::StategetState (unsigned int index)
 Get the state located at index along the path.
 
const base::StategetState (unsigned int index) const
 Get the state located at index along the path.
 
ControlgetControl (unsigned int index)
 Get the control located at index along the path. This is the control that gets applied to the state located at index.
 
const ControlgetControl (unsigned int index) const
 Get the control located at index along the path. This is the control that gets applied to the state located at index.
 
double getControlDuration (unsigned int index) const
 Get the duration of the control at index, which gets applied to the state at index.
 
std::size_t getStateCount () const
 Get the number of states (way-points) that make up this path.
 
std::size_t getControlCount () const
 Get the number of controls applied along this path. This should be equal to getStateCount() - 1 unless there are 0 states, in which case the number of controls will also be 0.
 
- Public Member Functions inherited from ompl::base::Path
 Path (const Path &)=delete
 
Pathoperator= (const Path &)=delete
 
 Path (SpaceInformationPtr si)
 Constructor. A path must always know the space information it is part of.
 
virtual ~Path ()=default
 Destructor.
 
const SpaceInformationPtrgetSpaceInformation () const
 Get the space information associated to this class.
 
template<class T >
const T * as () const
 Cast this instance to a desired type.
 
template<class T >
T * as ()
 Cast this instance to a desired type.
 
virtual Cost cost (const OptimizationObjectivePtr &obj) const =0
 Return the cost of the path with respect to a specified optimization objective.
 

Protected Member Functions

void freeMemory ()
 Free the memory allocated by the path.
 
void copyFrom (const PathControl &other)
 Copy the content of a path to this one.
 

Protected Attributes

std::vector< base::State * > states_
 The list of states that make up the path.
 
std::vector< Control * > controls_
 The control applied at each state. This array contains one element less than the list of states.
 
std::vector< double > controlDurations_
 The duration of the control applied at each state. This array contains one element less than the list of states.
 
- Protected Attributes inherited from ompl::base::Path
SpaceInformationPtr si_
 The space information this path is part of.
 

Detailed Description

Definition of a control path.

This is the type of path produced when planning with differential constraints.

Definition at line 60 of file PathControl.h.

Constructor & Destructor Documentation

◆ PathControl() [1/2]

ompl::control::PathControl::PathControl ( const base::SpaceInformationPtr & si)

Constructor.

Definition at line 80 of file PathControl.cpp.

◆ PathControl() [2/2]

ompl::control::PathControl::PathControl ( const PathControl & path)

Copy constructor.

Definition at line 86 of file PathControl.cpp.

◆ ~PathControl()

ompl::control::PathControl::~PathControl ( )
inlineoverride

Definition at line 69 of file PathControl.h.

Member Function Documentation

◆ append() [1/2]

void ompl::control::PathControl::append ( const base::State * state)

Append state to the end of the path; it is assumed state is the first state, so no control is applied. The memory for state is copied. There are no checks to make sure the number of controls and states make sense.

Definition at line 262 of file PathControl.cpp.

◆ append() [2/2]

void ompl::control::PathControl::append ( const base::State * state,
const Control * control,
double duration )

Append state to the end of the path and assume control is applied for the duration duration. The memory for state and for control is copied. There are no checks to make sure the number of controls and states make sense.

Definition at line 267 of file PathControl.cpp.

◆ asGeometric()

ompl::geometric::PathGeometric ompl::control::PathControl::asGeometric ( ) const

Convert this path into a geometric path (interpolation is performed and then states are copied)

Definition at line 91 of file PathControl.cpp.

◆ check()

bool ompl::control::PathControl::check ( ) const
overridevirtual

Check if the path is valid.

Implements ompl::base::Path.

Definition at line 237 of file PathControl.cpp.

◆ copyFrom()

void ompl::control::PathControl::copyFrom ( const PathControl & other)
protected

Copy the content of a path to this one.

Definition at line 108 of file PathControl.cpp.

◆ cost()

ompl::base::Cost ompl::control::PathControl::cost ( const base::OptimizationObjectivePtr & opt) const
override

Not yet implemented.

Definition at line 123 of file PathControl.cpp.

◆ freeMemory()

void ompl::control::PathControl::freeMemory ( )
protected

Free the memory allocated by the path.

Definition at line 335 of file PathControl.cpp.

◆ getControl() [1/2]

Control * ompl::control::PathControl::getControl ( unsigned int index)
inline

Get the control located at index along the path. This is the control that gets applied to the state located at index.

Definition at line 169 of file PathControl.h.

◆ getControl() [2/2]

const Control * ompl::control::PathControl::getControl ( unsigned int index) const
inline

Get the control located at index along the path. This is the control that gets applied to the state located at index.

Definition at line 176 of file PathControl.h.

◆ getControlCount()

std::size_t ompl::control::PathControl::getControlCount ( ) const
inline

Get the number of controls applied along this path. This should be equal to getStateCount() - 1 unless there are 0 states, in which case the number of controls will also be 0.

Definition at line 195 of file PathControl.h.

◆ getControlDuration()

double ompl::control::PathControl::getControlDuration ( unsigned int index) const
inline

Get the duration of the control at index, which gets applied to the state at index.

Definition at line 182 of file PathControl.h.

◆ getControlDurations()

std::vector< double > & ompl::control::PathControl::getControlDurations ( )
inline

Get the control durations used along the path (as a reference, so it can be modified, hence the function is not const)

Definition at line 150 of file PathControl.h.

◆ getControls()

std::vector< Control * > & ompl::control::PathControl::getControls ( )
inline

Get the controls that make up the path (as a reference, so it can be modified, hence the function is not const)

Definition at line 143 of file PathControl.h.

◆ getState() [1/2]

base::State * ompl::control::PathControl::getState ( unsigned int index)
inline

Get the state located at index along the path.

Definition at line 156 of file PathControl.h.

◆ getState() [2/2]

const base::State * ompl::control::PathControl::getState ( unsigned int index) const
inline

Get the state located at index along the path.

Definition at line 162 of file PathControl.h.

◆ getStateCount()

std::size_t ompl::control::PathControl::getStateCount ( ) const
inline

Get the number of states (way-points) that make up this path.

Definition at line 188 of file PathControl.h.

◆ getStates()

std::vector< base::State * > & ompl::control::PathControl::getStates ( )
inline

Get the states that make up the path (as a reference, so it can be modified, hence the function is not const)

Definition at line 136 of file PathControl.h.

◆ interpolate()

void ompl::control::PathControl::interpolate ( )

Make the path such that all controls are applied for a single time step (computes intermediate states)

Definition at line 187 of file PathControl.cpp.

◆ length()

double ompl::control::PathControl::length ( ) const
overridevirtual

The path length (sum of control durations)

Implements ompl::base::Path.

Definition at line 129 of file PathControl.cpp.

◆ operator=()

ompl::control::PathControl & ompl::control::PathControl::operator= ( const PathControl & other)

Assignment operator.

Definition at line 100 of file PathControl.cpp.

◆ print()

void ompl::control::PathControl::print ( std::ostream & out) const
overridevirtual

Print the path to a stream.

Implements ompl::base::Path.

Definition at line 134 of file PathControl.cpp.

◆ printAsMatrix()

void ompl::control::PathControl::printAsMatrix ( std::ostream & out) const
virtual

Print the path as a real-valued matrix where the i-th row represents the i-th state along the path, followed by the control and duration needed to reach this state. For the first state the control and duration are zeroes. The state components printed are those returned by ompl::base::StateSpace::copyToReals, while the control components printed are the discrete components (if any) followed by the real-valued ones as returned by ompl::control::ControlSpace::getValueAddressAtIndex.

Definition at line 152 of file PathControl.cpp.

◆ random()

void ompl::control::PathControl::random ( )

Set this path to a random segment.

Definition at line 275 of file PathControl.cpp.

◆ randomValid()

bool ompl::control::PathControl::randomValid ( unsigned int attempts)

Set this path to a random valid segment. Sample attempts times for valid segments. Returns true on success.

Definition at line 296 of file PathControl.cpp.

Member Data Documentation

◆ controlDurations_

std::vector<double> ompl::control::PathControl::controlDurations_
protected

The duration of the control applied at each state. This array contains one element less than the list of states.

Definition at line 212 of file PathControl.h.

◆ controls_

std::vector<Control *> ompl::control::PathControl::controls_
protected

The control applied at each state. This array contains one element less than the list of states.

Definition at line 208 of file PathControl.h.

◆ states_

std::vector<base::State *> ompl::control::PathControl::states_
protected

The list of states that make up the path.

Definition at line 204 of file PathControl.h.


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