PPL API Reference |
|
---|
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 |
GroupCfg & | operator+= (const GroupCfg &_other) |
GroupCfg & | operator-= (const GroupCfg &_other) |
GroupCfg & | operator*= (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. | |
Robot * | GetRobot (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. | |
GroupRoadmapType * | GetGroupRoadmap () 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) |
IndividualCfg & | GetRobotCfg (Robot *const _robot) |
IndividualCfg & | GetRobotCfg (const size_t _index) |
const IndividualCfg & | GetRobotCfg (Robot *const _robot) const |
const IndividualCfg & | GetRobotCfg (const size_t _index) const |
void | ClearLocalCfgs () |
Clear the Local Cfg information in the cfg (for after adding to roadmap) | |
DOF Accessors | |
| |
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< VID > | VIDSet |
A set of VIDs from indiv. Robot roadmaps. | |
typedef Cfg | IndividualCfg |
typedef GroupRoadmap< GroupCfg, GroupLocalPlan< IndividualCfg > > | GroupRoadmapType |
typedef std::vector< size_t > | Formation |
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.
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.
|
explicit |
Construct a group configuration.
_groupMap | The group roadmap to which this configuration belongs, or null if it is not in a map. |
_init | Default-initialize local configurations? |
|
noexcept |
Check if the current and given group configurations are equal.
_other | The given group configuration. |
|
noexcept |
Check if the current and given group configurations are unequal.
_other | The given group configuration. |
Find the sum of the current and a given group configuration, by each degree of freedom.
_other | The group configuration to be added. |
Find the difference of the current and a given group configuration, by each degree of freedom.
_other | The group configuration to be subtracted. |
GroupCfg GroupCfg::operator* | ( | const double & | _other | ) | const |
Find the product of the current and a given group configuration, by each degree of freedom.
_other | The group configuration used to multiply the current. |
Add a given group configuration to the current, by each degree of freedom.
_other | The group configuration to be added. |
Subtract a given group configuration from the current, by each degree of freedom.
_other | The group configuration to be subtracted. |
GroupCfg & GroupCfg::operator*= | ( | const double & | _val | ) |
Multiply the current group configuration by a scalar.
_val | The scalar used to multiply the current. |
Robot * GroupCfg::GetRobot | ( | const size_t | _index | ) | const |
Get the robot pointer for a group member by index.
_index | The desired index. |
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.
|
noexcept |
Get the VID for a particular robot.
_index | The index (within the group) of the robot. |
void GroupCfg::SetRobotCfg | ( | Robot *const | _robot, |
IndividualCfg && | _cfg | ||
) |
Set the individual cfg for a robot to a local copy of an cfg.
_robot | The robot which the cfg refers to. |
_cfg | The cfg. |
void GroupCfg::SetRobotCfg | ( | const size_t | _index, |
IndividualCfg && | _cfg | ||
) |
Set the individual cfg for a robot to a local copy of an cfg.
_index | The robot's group index which the cfg refers to. |
_cfg | The cfg. |
Set the individual cfg for a robot to a roadmap copy of an cfg.
_robot | The robot which the cfg refers to. |
_vid | The cfg descriptor. |
void GroupCfg::SetRobotCfg | ( | const size_t | _index, |
const VID | _vid | ||
) |
Set the individual cfg for a robot to a roadmap copy of an cfg.
_index | The robot's group index which the cfg refers to. |
_vid | The cfg descriptor. |
GroupCfg::IndividualCfg & GroupCfg::GetRobotCfg | ( | Robot *const | _robot | ) |
Get the individual Cfg for a robot in the group.
_robot | The robot which the cfg refers to. |
GroupCfg::IndividualCfg & GroupCfg::GetRobotCfg | ( | const size_t | _index | ) |
Get the individual Cfg for a robot in the group.
_index | The index of the robot. |
const GroupCfg::IndividualCfg & GroupCfg::GetRobotCfg | ( | Robot *const | _robot | ) | const |
Get the individual Cfg for a robot in the group.
_robot | The robot which the cfg refers to. |
const GroupCfg::IndividualCfg & GroupCfg::GetRobotCfg | ( | const size_t | _index | ) | const |
Get the individual Cfg for a robot in the group.
_index | The index of the robot. |
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.
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.
bool GroupCfg::WithinResolution | ( | const GroupCfg & | _cfg, |
const double | _posRes, | ||
const double | _oriRes | ||
) | const |
Check that another GroupCfg is within a resolution as specified.
_cfg | The test configuration. |
_posRes | The position resolution. |
_oriRes | The orientation resolution. |
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).
_robotList | This list of bodies to rotate. First one is leader body. |
_rotation | The change in orientation that should be applied to _cfg. |
_debug | A flag to print to cout (no access to an m_debug flag here). |
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!
_robotList | This list of bodies to rotate. First one is leader body. |
_transform | The 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. |
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.
_dofs | The values to add in to each body. This function assumes each body has #dofs = _dofs.size(). |
_robots | This list of bodies to update. Order doesn't matter. |
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.
_dofs | The positional values to add in to each body. |
_robots | This list of bodies to update. Order doesn't matter. |
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.
_fromCfg | The configuration to take values from. |
_robots | This list of bodies to update. Order doesn't matter. |
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.
_fromCfg | The configuration to take values from. |
_robots | This list of bodies to update. Order doesn't matter. |
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.
_fromCfg | The configuration to take values from. |
_robots | This list of bodies to update. Order doesn't matter. |
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.
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.
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.
_start | The start configuration. |
_goal | The goal configuration. |
_nTicks | The number of steps to take (NOT computed by this method) |
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.
_start | The start configuration. |
_goal | The goal configuration. |
_nTicks | The number of steps to take (computed by this method). |
_positionRes | The position resolution to use. |
_orientationRes | The orientation resolution to use. |
|
noexcept |
Test if a group configuration lies within a boundary and also within the robot's c-space limits.
_boundary | The boundary to check. |
|
noexcept |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.