PPL API Reference
Overview Core Algorithm Abstractions Utilities Parallel Methods
Modules Class Hierarchy Classes Functions
Todo List Bug List Dead Code
List of all members
GroupCfg Class Referencefinal

Public Member Functions

Construction
 GroupCfg (GroupRoadmapType *const _groupMap=nullptr, const bool _init=false)
 
Equality
bool operator== (const GroupCfg &_other) const noexcept
 
bool operator!= (const GroupCfg &_other) const noexcept
 
Arithmetic
GroupCfg operator+ (const GroupCfg &_other) const
 
GroupCfg operator- (const GroupCfg &_other) const
 
GroupCfg operator* (const double &_other) const
 
GroupCfgoperator+= (const GroupCfg &_other)
 
GroupCfgoperator-= (const GroupCfg &_other)
 
GroupCfgoperator*= (const double &_val)
 
Robots

Access the robots within this group configuration.

size_t GetNumRobots () const noexcept
 Get the number of robots.
 
const std::vector< Robot * > & GetRobots () const noexcept
 Get the full vector of robot pointers.
 
RobotGetRobot (const size_t _index) const
 
Roadmap Accessors

These functions provide access to the related group map (if any) and descriptors for non-local individual configurations.

GroupRoadmapTypeGetGroupRoadmap () const noexcept
 Get the group roadmap this group cfg is with respect to.
 
GroupCfg SetGroupRoadmap (GroupRoadmapType *const _newRoadmap) const
 
VID GetVID (const size_t _index) const noexcept
 
Individual Configurations

These functions manage the individual configurations that comprise this group configuration.

void SetRobotCfg (Robot *const _robot, IndividualCfg &&_cfg)
 
void SetRobotCfg (const size_t _index, IndividualCfg &&_cfg)
 
void SetRobotCfg (Robot *const _robot, const VID _vid)
 
void SetRobotCfg (const size_t _index, const VID _vid)
 
IndividualCfgGetRobotCfg (Robot *const _robot)
 
IndividualCfgGetRobotCfg (const size_t _index)
 
const IndividualCfgGetRobotCfg (Robot *const _robot) const
 
const IndividualCfgGetRobotCfg (const size_t _index) const
 
void ClearLocalCfgs ()
 Clear the Local Cfg information in the cfg (for after adding to roadmap)
 
DOF Accessors
Todo:
These should not return any single-robot values, which can always be obtained by accessing the relevant robot.
size_t PosDOF (const size_t _index=0) const
 
size_t OriDOF (const size_t _index=0) const
 
size_t DOF (const size_t _index=0) const
 
bool IsNonholonomic () const noexcept
 Check if there is a nonholonomic robot in the group.
 
size_t CompositeDOF () const
 Compute the total DOF for this robot group.
 
double Magnitude () const
 Compute the composite magnitude.
 
double PositionMagnitude () const
 Compute the composite manitude of the positional components.
 
double OrientationMagnitude () const
 Compute the composite magnitude of the orientation components.
 
Configuration Helpers
void ConfigureRobot () const
 
bool WithinResolution (const GroupCfg &_cfg, const double _posRes, const double _oriRes) const
 
DOF Modifiers
void RotateFormationAboutLeader (const Formation &_robotList, const mathtool::Orientation &_rotation, const bool _debug=false)
 
void ApplyTransformationForRobots (const Formation &_robotList, const mathtool::Transformation &_transform, const mathtool::Transformation &_relativeTransform=mathtool::Transformation())
 
void AddDofsForRobots (const std::vector< double > &_dofs, const Formation &_robots)
 
void AddDofsForRobots (const mathtool::Vector3d &_dofs, const Formation &_robots)
 
void OverwriteDofsForRobots (const std::vector< double > &_dofs, const Formation &_robots)
 
void OverwriteDofsForRobots (const mathtool::Vector3d &_dofs, const Formation &_robots)
 
void OverwriteDofsForRobots (const GroupCfg &_fromCfg, const Formation &_robots)
 
void OverwriteDofsForRobots (const GroupCfg &_fromCfg, const std::vector< Robot * > &_robots)
 
void SetData (const std::vector< double > &_dofs)
 
void FindIncrement (const GroupCfg &_start, const GroupCfg &_goal, const int _nTicks)
 
void FindIncrement (const GroupCfg &_start, const GroupCfg &_goal, int *const _nTicks, const double _positionRes, const double _orientationRes)
 
bool InBounds (const Boundary *const _b) const noexcept
 
bool InBounds (const Environment *const _env) const noexcept
 
virtual void NormalizeOrientation (const Formation &_robots=Formation()) noexcept
 Normalize Orientation DOFs for a Group Cfg.
 
Output Utilities
std::string PrettyPrint (const size_t _precision=4) const
 

Public Types

Local Types
typedef size_t VID
 A VID in an individual Robot roadmap.
 
typedef std::vector< VIDVIDSet
 A set of VIDs from indiv. Robot roadmaps.
 
typedef Cfg IndividualCfg
 
typedef GroupRoadmap< GroupCfg, GroupLocalPlan< IndividualCfg > > GroupRoadmapType
 
typedef std::vector< size_t > Formation
 

Detailed Description

An aggregate configuration which represents a configuration for each robot in a robot group.

The main point of group cfg is to take advantage of everything implemented for individual robots. This means that we use VIDs from individual roadmaps to keep track of the robot cfgs referred to in a group cfg. In the case that a group cfg is modified or new in some way, there is a temporary local storage (m_localCfgs) which stores individual cfgs not yet in a roadmap. When adding a group cfg to a group roadmap, the VID is used in place after adding the individual cfg to the individual roadmap.

Note
Do not use 'SetRobotCfg' on a roadmap configuration with a non-VID: The 'set' configuration will be lost since it is not in the individual roadmap.
Todo:
Rework so that we only need a robot group to construct this, in which case it will have all local cfgs. It should only get tied to a roadmap with SetGroupRoadmap after it has been added to one.

Member Typedef Documentation

◆ Formation

typedef std::vector<size_t> GroupCfg::Formation

A formation represents a group of robots which are maintaining their configurations relative to a leader, such as maintaining a square or V-shape while moving. The values are robot indexes (within the group, not problem) with the first index denoting the leader robot. These are not stored in configurations but may be required for edges.

Constructor & Destructor Documentation

◆ GroupCfg()

GroupCfg::GroupCfg ( GroupRoadmapType *const  _groupMap = nullptr,
const bool  _init = false 
)
explicit

Construct a group configuration.

Parameters
_groupMapThe group roadmap to which this configuration belongs, or null if it is not in a map.
_initDefault-initialize local configurations?
Todo:
This object does not work at all without a group map. We should throw relevant exceptions if needed.

Member Function Documentation

◆ operator==()

bool GroupCfg::operator== ( const GroupCfg _other) const
noexcept

Check if the current and given group configurations are equal.

Parameters
_otherThe given group configuration.
Returns
True if equal, false otherwise.

◆ operator!=()

bool GroupCfg::operator!= ( const GroupCfg _other) const
noexcept

Check if the current and given group configurations are unequal.

Parameters
_otherThe given group configuration.
Returns
True if unequal, false otherwise.

◆ operator+()

GroupCfg GroupCfg::operator+ ( const GroupCfg _other) const

Find the sum of the current and a given group configuration, by each degree of freedom.

Parameters
_otherThe group configuration to be added.
Returns
The sum of the group configurations.

◆ operator-()

GroupCfg GroupCfg::operator- ( const GroupCfg _other) const

Find the difference of the current and a given group configuration, by each degree of freedom.

Parameters
_otherThe group configuration to be subtracted.
Returns
The difference of the group configurations.

◆ operator*()

GroupCfg GroupCfg::operator* ( const double &  _other) const

Find the product of the current and a given group configuration, by each degree of freedom.

Parameters
_otherThe group configuration used to multiply the current.
Returns
The product of the group configurations.

◆ operator+=()

GroupCfg & GroupCfg::operator+= ( const GroupCfg _other)

Add a given group configuration to the current, by each degree of freedom.

Parameters
_otherThe group configuration to be added.

◆ operator-=()

GroupCfg & GroupCfg::operator-= ( const GroupCfg _other)

Subtract a given group configuration from the current, by each degree of freedom.

Parameters
_otherThe group configuration to be subtracted.

◆ operator*=()

GroupCfg & GroupCfg::operator*= ( const double &  _val)

Multiply the current group configuration by a scalar.

Parameters
_valThe scalar used to multiply the current.

◆ GetRobot()

Robot * GroupCfg::GetRobot ( const size_t  _index) const

Get the robot pointer for a group member by index.

Parameters
_indexThe desired index.

◆ SetGroupRoadmap()

GroupCfg GroupCfg::SetGroupRoadmap ( GroupRoadmapType *const  _newRoadmap) const

Change the roadmap that this group is using/in reference to. Also performs compatibility/verification tests to see if it's possible. Note: Does NOT add this new cfg to any roadmap, but makes all cfg info local (everything will be in m_localCfgs) so that there are no issues when adding to the roadmap later.

Todo:
Fix this, it looks like it was meant to be a copy-constructor with a different roadmap. We will still need a roadmap setter in case the roadmap moves.

◆ GetVID()

GroupCfg::VID GroupCfg::GetVID ( const size_t  _index) const
noexcept

Get the VID for a particular robot.

Parameters
_indexThe index (within the group) of the robot.
Returns
The VID of the robot's individual configuration, or INVALID_VID if it is a local configuration.

◆ SetRobotCfg() [1/4]

void GroupCfg::SetRobotCfg ( Robot *const  _robot,
IndividualCfg &&  _cfg 
)

Set the individual cfg for a robot to a local copy of an cfg.

Parameters
_robotThe robot which the cfg refers to.
_cfgThe cfg.

◆ SetRobotCfg() [2/4]

void GroupCfg::SetRobotCfg ( const size_t  _index,
IndividualCfg &&  _cfg 
)

Set the individual cfg for a robot to a local copy of an cfg.

Parameters
_indexThe robot's group index which the cfg refers to.
_cfgThe cfg.

◆ SetRobotCfg() [3/4]

void GroupCfg::SetRobotCfg ( Robot *const  _robot,
const VID  _vid 
)

Set the individual cfg for a robot to a roadmap copy of an cfg.

Parameters
_robotThe robot which the cfg refers to.
_vidThe cfg descriptor.

◆ SetRobotCfg() [4/4]

void GroupCfg::SetRobotCfg ( const size_t  _index,
const VID  _vid 
)

Set the individual cfg for a robot to a roadmap copy of an cfg.

Parameters
_indexThe robot's group index which the cfg refers to.
_vidThe cfg descriptor.

◆ GetRobotCfg() [1/4]

GroupCfg::IndividualCfg & GroupCfg::GetRobotCfg ( Robot *const  _robot)

Get the individual Cfg for a robot in the group.

Parameters
_robotThe robot which the cfg refers to.
Returns
The individual configuration for the indexed robot.

◆ GetRobotCfg() [2/4]

GroupCfg::IndividualCfg & GroupCfg::GetRobotCfg ( const size_t  _index)

Get the individual Cfg for a robot in the group.

Parameters
_indexThe index of the robot.
Returns
The individual configuration for the indexed robot.

◆ GetRobotCfg() [3/4]

const GroupCfg::IndividualCfg & GroupCfg::GetRobotCfg ( Robot *const  _robot) const

Get the individual Cfg for a robot in the group.

Parameters
_robotThe robot which the cfg refers to.
Returns
The individual configuration for the indexed robot.

◆ GetRobotCfg() [4/4]

const GroupCfg::IndividualCfg & GroupCfg::GetRobotCfg ( const size_t  _index) const

Get the individual Cfg for a robot in the group.

Parameters
_indexThe index of the robot.
Returns
The individual configuration for the indexed robot.

◆ PosDOF()

size_t GroupCfg::PosDOF ( const size_t  _index = 0) const

We assume homogeneous robots right now, so the default argument finds the values for the first one.

◆ ConfigureRobot()

void GroupCfg::ConfigureRobot ( ) const

Configure each individual cfg that this group cfg represents. This is for template cooperation and is also a needed function before dealing with CD calls and such. Note this will throw an exception if no cfg is present for any robot.

◆ WithinResolution()

bool GroupCfg::WithinResolution ( const GroupCfg _cfg,
const double  _posRes,
const double  _oriRes 
) const

Check that another GroupCfg is within a resolution as specified.

Parameters
_cfgThe test configuration.
_posResThe position resolution.
_oriResThe orientation resolution.
Returns
True if each individual configuration in this is within a resolution distance of _cfg.

◆ RotateFormationAboutLeader()

void GroupCfg::RotateFormationAboutLeader ( const Formation _robotList,
const mathtool::Orientation &  _rotation,
const bool  _debug = false 
)

Given this GroupCfg as the starting configuration, this function applies a rotation to all the robots that are listed, assuming the first one is the formation's leader. Note: Currently assumes all robots just have ONE body. The case of multi- bodied robots would need to be specially handled (right now it should just be split into multiple robots if a group is needed).

Parameters
_robotListThis list of bodies to rotate. First one is leader body.
_rotationThe change in orientation that should be applied to _cfg.
_debugA flag to print to cout (no access to an m_debug flag here).

◆ ApplyTransformationForRobots()

void GroupCfg::ApplyTransformationForRobots ( const Formation _robotList,
const mathtool::Transformation &  _transform,
const mathtool::Transformation &  _relativeTransform = mathtool::Transformation() 
)

Given this GroupCfg as the starting configuration, this function applies a transformation uniformly over all robots listed. Note: Currently assumes all robots just have ONE body. The case of multi- bodied robots would need to be specially handled (right now it should just be split into multiple robots if a group is needed). Note: This is assuming 6 DOFs!

Parameters
_robotListThis list of bodies to rotate. First one is leader body.
_transformThe change in orientation that should be applied to _cfg.
_relativeTransform(Optional) The transformation to "undo" before applying _transform. If default, it will be a simple transform application. See RotateFormationAboutLeader for usage example.

◆ AddDofsForRobots() [1/2]

void GroupCfg::AddDofsForRobots ( const std::vector< double > &  _dofs,
const Formation _robots 
)

Given this configuration, add in the same DOF values to each body given. It assumes that all robots in the formation given have the same DOFs. This is a common thing to do in assembly planning/composite C-Spaces.

Parameters
_dofsThe values to add in to each body. This function assumes each body has #dofs = _dofs.size().
_robotsThis list of bodies to update. Order doesn't matter.

◆ AddDofsForRobots() [2/2]

void GroupCfg::AddDofsForRobots ( const mathtool::Vector3d &  _dofs,
const Formation _robots 
)

This function adds all positional dofs in _dofs. It will handle 1-3 dofs based on each IndividualCfg's PosDof value. Does not add in orientation. Note: This function is slightly more efficient than the std::vector version, as we do not need to check the size of _dofs.

Parameters
_dofsThe positional values to add in to each body.
_robotsThis list of bodies to update. Order doesn't matter.

◆ OverwriteDofsForRobots() [1/4]

void GroupCfg::OverwriteDofsForRobots ( const std::vector< double > &  _dofs,
const Formation _robots 
)

Given new DOF values, overwrite the existing values for each individual cfg in this group cfg that is listed in _robots. Note that _dofs needs to be the same number of DOFs as each individual cfg in the group.

Parameters
_fromCfgThe configuration to take values from.
_robotsThis list of bodies to update. Order doesn't matter.

◆ OverwriteDofsForRobots() [2/4]

void GroupCfg::OverwriteDofsForRobots ( const mathtool::Vector3d &  _dofs,
const Formation _robots 
)

Given new DOF values, overwrite the existing values for each individual cfg in this group cfg that is listed in _robots. Note that _dofs needs to be the same number of DOFs as each individual cfg in the group.

Parameters
_fromCfgThe configuration to take values from.
_robotsThis list of bodies to update. Order doesn't matter.

◆ OverwriteDofsForRobots() [3/4]

void GroupCfg::OverwriteDofsForRobots ( const GroupCfg _fromCfg,
const Formation _robots 
)

Given this and another configuration, copy the DOF values from the other to the DOF values in this one, but only for each given robot indexed.

Parameters
_fromCfgThe configuration to take values from.
_robotsThis list of bodies to update. Order doesn't matter.

◆ OverwriteDofsForRobots() [4/4]

void GroupCfg::OverwriteDofsForRobots ( const GroupCfg _fromCfg,
const std::vector< Robot * > &  _robots 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ SetData()

void GroupCfg::SetData ( const std::vector< double > &  _dofs)

Overwrites all data in this cfg, assumes the length of _dofs is the same as CompositeDOF(). Basically just converts a composite C-Space vector into its individual pieces for a Group Cfg.

◆ FindIncrement() [1/2]

void GroupCfg::FindIncrement ( const GroupCfg _start,
const GroupCfg _goal,
const int  _nTicks 
)

Find the c-space increment and number of steps needed to move from a start to a goal, taking steps no larger than the designated resolutions.

Parameters
_startThe start configuration.
_goalThe goal configuration.
_nTicksThe number of steps to take (NOT computed by this method)

◆ FindIncrement() [2/2]

void GroupCfg::FindIncrement ( const GroupCfg _start,
const GroupCfg _goal,
int *const  _nTicks,
const double  _positionRes,
const double  _orientationRes 
)

Find the c-space increment and number of steps needed to move from a start to a goal, taking steps no larger than the designated resolutions.

Parameters
_startThe start configuration.
_goalThe goal configuration.
_nTicksThe number of steps to take (computed by this method).
_positionResThe position resolution to use.
_orientationResThe orientation resolution to use.

◆ InBounds() [1/2]

bool GroupCfg::InBounds ( const Boundary *const  _b) const
noexcept

Test if a group configuration lies within a boundary and also within the robot's c-space limits.

Parameters
_boundaryThe boundary to check.
Returns
True if the configuration places the robot inside both the boundary and its DOF limits.

◆ InBounds() [2/2]

bool GroupCfg::InBounds ( const Environment *const  _env) const
noexcept

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.


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