Parasol Planning Library (PPL)
MPProblem Class Reference

#include <MPProblem.h>

Collaboration diagram for MPProblem:
Collaboration graph
[legend]

Public Member Functions

Construction
 MPProblem ()
 Instantiate an empty MPProblem. More...
 
 MPProblem (const std::string &_filename)
 
 MPProblem (XMLNode _mpNode, XMLNode _input)
 
 MPProblem (const MPProblem &_other)
 Copy. More...
 
 MPProblem (MPProblem &&_other)=delete
 
virtual ~MPProblem ()
 
Assignment
MPProblemoperator= (const MPProblem &_other)
 Copy. More...
 
MPProblemoperator= (MPProblem &&_other)=delete
 
XML File Parsing
const std::string & GetXMLFilename () const
 Get the XML filename from which this object was parsed. More...
 
void ReadXMLFile (const std::string &_filename)
 
void ProcessXML (XMLNode mpNode, XMLNode input)
 
Environment Accessors
EnvironmentGetEnvironment ()
 Get the environment object. More...
 
void SetEnvironment (std::unique_ptr< Environment > &&_e)
 
Robot Accessors
size_t NumRobots () const noexcept
 Get the number of robots in our problem. More...
 
RobotGetRobot (const size_t _index) const noexcept
 
RobotGetRobot (const std::string &_label) const noexcept
 
const std::vector< std::unique_ptr< Robot > > & GetRobots () const noexcept
 Get all robots in this problem. More...
 
const std::vector< Robot * > GetRobotsOfType (std::string _type) const noexcept
 
size_t NumRobotGroups () const noexcept
 
RobotGroupGetRobotGroup (const size_t _index) const noexcept
 
RobotGroupGetRobotGroup (const std::string &_label) const noexcept
 
const std::vector< std::unique_ptr< RobotGroup > > & GetRobotGroups () const noexcept
 
Cfg GetInitialCfg (Robot *_r)
 
void SetInitialCfg (Robot *_r, Cfg _cfg)
 
Task Accessors
MPTaskGetTask (std::string _label)
 
std::vector< std::shared_ptr< MPTask > > GetTasks (Robot *const _robot) const noexcept
 
std::vector< std::shared_ptr< GroupTask > > GetTasks (RobotGroup *const _group) const noexcept
 
void AddTask (std::unique_ptr< MPTask > &&_task)
 
void ReassignTask (MPTask *const _task, Robot *const _newOwner)
 
void AddDecomposition (Robot *_coordinator, std::unique_ptr< Decomposition > &&_decomp)
 
const std::vector< std::unique_ptr< Decomposition > > & GetDecompositions (Robot *_coordinator)
 
const std::unordered_map< Robot *, std::vector< std::unique_ptr< Decomposition > > > & GetDecompositions ()
 Get map of robots to decompositions. More...
 
Dynamic Obstacle Accessors
const std::vector< DynamicObstacle > & GetDynamicObstacles () const noexcept
 Get all of the dynamic obstacles in this problem. More...
 
void AddDynamicObstacle (DynamicObstacle &&_obstacle)
 
void ClearDynamicObstacles ()
 Remove all of the dynamic obstacles in this problem. More...
 
Debugging
virtual void Print (std::ostream &_os) const
 
File Path Accessors
const std::string & GetBaseFilename () const
 Get the base filename for output files. More...
 
void SetBaseFilename (const std::string &_s)
 
std::string GetPath (const std::string &_filename="")
 
void SetPath (const std::string &_filename)
 
Handoff Template Accessors
std::vector< std::unique_ptr< InteractionInformation > > & GetInteractionInformations ()
 

Protected Member Functions

Construction Helpers
void ParseChild (XMLNode &_node)
 
void MakePointRobot ()
 Create a pseudo-point robot. More...
 

Protected Attributes

Core Properties
std::unique_ptr< Environmentm_environment
 The planning environment. More...
 
std::vector< std::unique_ptr< Robot > > m_robots
 The robots in our problem. More...
 
std::vector< std::unique_ptr< RobotGroup > > m_robotGroups
 Robot groups. More...
 
std::unique_ptr< Robotm_pointRobot
 A pseudo point-robot. More...
 
std::unordered_map< std::string, std::vector< Robot * > > m_robotCapabilityMap
 Map of robot type to set of robots. More...
 
std::unordered_map< Robot *, Cfgm_initialCfgs
 Map of robot initial locations. More...
 
std::vector< DynamicObstaclem_dynamicObstacles
 The dynamic obstacles in our problem. More...
 
std::vector< std::unique_ptr< InteractionInformation > > m_interactionInformations
 All handoff templates for a problem. More...
 
std::unordered_map< Robot *, std::list< std::shared_ptr< MPTask > > > m_taskMap
 Map the tasks assigned to each robot. More...
 
std::unordered_map< RobotGroup *, std::list< std::shared_ptr< GroupTask > > > m_groupTaskMap
 Map the group tasks assigned to each robot group. More...
 
std::unordered_map< std::string, MPTask * > m_taskLabelMap
 Map task labels to tasks. More...
 
std::unordered_map< Robot *, std::vector< std::unique_ptr< Decomposition > > > m_taskDecompositions
 Map robots to task decompositions. More...
 
Files
std::string m_xmlFilename
 The XML file name. More...
 
std::string m_baseFilename
 The base name for output files. More...
 
std::string m_filePath
 The relative path for the problem XML. More...
 

Detailed Description

Representation of a motion planning problem, including an environment, tasks, and robots.

Examples
MPLibrary_UseCase.cpp.

Constructor & Destructor Documentation

◆ MPProblem() [1/5]

MPProblem::MPProblem ( )
default

Instantiate an empty MPProblem.

◆ MPProblem() [2/5]

MPProblem::MPProblem ( const std::string &  _filename)
explicit

Instantiate an MPProblem from an XML file.

Parameters
_filenameThe name of the XML file.

◆ MPProblem() [3/5]

MPProblem::MPProblem ( XMLNode  _mpNode,
XMLNode  _input 
)
explicit

Instantiate an MPProblem from an XML strings.

Parameters
_mpNode,_inputStrings containing the XML to be parsed.

◆ MPProblem() [4/5]

MPProblem::MPProblem ( const MPProblem _other)

Copy.

◆ MPProblem() [5/5]

MPProblem::MPProblem ( MPProblem &&  _other)
delete

◆ ~MPProblem()

MPProblem::~MPProblem ( )
virtualdefault

Member Function Documentation

◆ AddDecomposition()

void MPProblem::AddDecomposition ( Robot _coordinator,
std::unique_ptr< Decomposition > &&  _decomp 
)

Assign task decomposition to a robot

Parameters
_coordinatorRobot to assign task to
_decompThe decomposition task to assign

◆ AddDynamicObstacle()

void MPProblem::AddDynamicObstacle ( DynamicObstacle &&  _obstacle)

Add dynamic obstacle to this problem

Parameters
Dynamicobstacle to add

◆ AddTask()

void MPProblem::AddTask ( std::unique_ptr< MPTask > &&  _task)

Add a task to the problem. The assigned robot will be taken from the task object.

Parameters
_taskThe new task.

◆ ClearDynamicObstacles()

void MPProblem::ClearDynamicObstacles ( )

Remove all of the dynamic obstacles in this problem.

◆ GetBaseFilename()

const std::string & MPProblem::GetBaseFilename ( ) const

Get the base filename for output files.

◆ GetDecompositions() [1/2]

const std::unordered_map< Robot *, std::vector< std::unique_ptr< Decomposition > > > & MPProblem::GetDecompositions ( )

Get map of robots to decompositions.

◆ GetDecompositions() [2/2]

const std::vector< std::unique_ptr< Decomposition > > & MPProblem::GetDecompositions ( Robot _coordinator)

Get set of decomposition tasks for given robot

Parameters
_coordinatorRobot to return task decompositions for

◆ GetDynamicObstacles()

const std::vector< DynamicObstacle > & MPProblem::GetDynamicObstacles ( ) const
noexcept

Get all of the dynamic obstacles in this problem.

◆ GetEnvironment()

Environment * MPProblem::GetEnvironment ( )

Get the environment object.

◆ GetInitialCfg()

Cfg MPProblem::GetInitialCfg ( Robot _r)

Get initial configuration of a robot

Parameters
_rRobot whose configuration to retrieve

◆ GetInteractionInformations()

std::vector< std::unique_ptr< InteractionInformation > > & MPProblem::GetInteractionInformations ( )

Return the list of handoff templates defined in the problem

Returns
vector of handoff templates

◆ GetPath()

string MPProblem::GetPath ( const std::string &  _filename = "")

Get the base path for input files to a file name.

Parameters
_filenameThe filename to modify.
Returns
The base path + filename, or just the path if no name is given.

◆ GetRobot() [1/2]

Robot * MPProblem::GetRobot ( const size_t  _index) const
noexcept

Get a specific robot by index.

Parameters
_indexIndex of robot to get

◆ GetRobot() [2/2]

Robot * MPProblem::GetRobot ( const std::string &  _label) const
noexcept

Get a specific robot by label.

Parameters
_labelLabel of robot to get

◆ GetRobotGroup() [1/2]

RobotGroup * MPProblem::GetRobotGroup ( const size_t  _index) const
noexcept

Get a specific robot group by index.

Parameters
_indexIndex of robot group to retrieve

◆ GetRobotGroup() [2/2]

RobotGroup * MPProblem::GetRobotGroup ( const std::string &  _label) const
noexcept

Get a specific robot group by group's label.

Parameters
_labelLabel of robot group to retrieve

◆ GetRobotGroups()

const std::vector< std::unique_ptr< RobotGroup > > & MPProblem::GetRobotGroups ( ) const
noexcept

Get all robot groups in this problem.

Returns
List of robot groups

◆ GetRobots()

const std::vector< std::unique_ptr< Robot > > & MPProblem::GetRobots ( ) const
noexcept

Get all robots in this problem.

◆ GetRobotsOfType()

const std::vector< Robot * > MPProblem::GetRobotsOfType ( std::string  _type) const
noexcept

Get all robots of a specified type.

Parameters
_typeType of robots to retrieve
Returns
List of robots of type _type

◆ GetTask()

MPTask * MPProblem::GetTask ( std::string  _label)

Get task by label

Parameters
_labelLabel of task to retrieve

◆ GetTasks() [1/2]

std::vector< std::shared_ptr< MPTask > > MPProblem::GetTasks ( Robot *const  _robot) const
noexcept

Get the unfinished tasks currently assigned to a given robot.

Parameters
_robotThe robot to retrieve tasks for.
Returns
The set of tasks currently assigned to _robot.

◆ GetTasks() [2/2]

std::vector< std::shared_ptr< GroupTask > > MPProblem::GetTasks ( RobotGroup *const  _group) const
noexcept

Group overload Get the unfinished tasks currently assigned to a group of robots.

Parameters
_groupThe robot group to retrieve tasks for.
Returns
The set of group tasks currently assigned to _group.

◆ GetXMLFilename()

const std::string & MPProblem::GetXMLFilename ( ) const

Get the XML filename from which this object was parsed.

◆ MakePointRobot()

void MPProblem::MakePointRobot ( )
protected

Create a pseudo-point robot.

◆ NumRobotGroups()

size_t MPProblem::NumRobotGroups ( ) const
noexcept

Group versions: Get the number of robot groups in our problem.

◆ NumRobots()

size_t MPProblem::NumRobots ( ) const
noexcept

Get the number of robots in our problem.

◆ operator=() [1/2]

MPProblem & MPProblem::operator= ( const MPProblem _other)

Copy.

◆ operator=() [2/2]

MPProblem& MPProblem::operator= ( MPProblem &&  _other)
delete

◆ ParseChild()

void MPProblem::ParseChild ( XMLNode _node)
protected

Helper for parsing XML nodes of various types.

Parameters
_nodeThe child node to be parsed.
Todo:
We currently assume that the environment is parsed first. Need to make sure this always happens regardless of the XML file ordering.
Todo:
Add check that tasks have unique labels

◆ Print()

void MPProblem::Print ( std::ostream &  _os) const
virtual

Print the environment, robot, and task information.

Parameters
_osStream to print to
Todo:
Print robot and task information.

◆ ProcessXML()

void MPProblem::ProcessXML ( XMLNode  mpNode,
XMLNode  input 
)

Initialize MPProblem based on XMLNodes.

Parameters
_filenameThe XML file name.

◆ ReadXMLFile()

void MPProblem::ReadXMLFile ( const std::string &  _filename)

Read an XML file.

Parameters
_filenameThe XML file name.

◆ ReassignTask()

void MPProblem::ReassignTask ( MPTask *const  _task,
Robot *const  _newOwner 
)

Reassign a task to another robot.

Parameters
_taskThe task to reassign.
_newOwnerThe new robot assigned to _task.

◆ SetBaseFilename()

void MPProblem::SetBaseFilename ( const std::string &  _s)

Set the base filename for output files.

Parameters
_sNew base filename

◆ SetEnvironment()

void MPProblem::SetEnvironment ( std::unique_ptr< Environment > &&  _e)

Set the environment object.

Parameters
_eEnvironment to set to

◆ SetInitialCfg()

void MPProblem::SetInitialCfg ( Robot _r,
Cfg  _cfg 
)

Get initial configuration of a robot

Parameters
_rRobot whose configuration to retrieve
_cfgConfiguration to set for _r

◆ SetPath()

void MPProblem::SetPath ( const std::string &  _filename)

Set the base path for input files.

Parameters
_fileNameFile path to set

Field Documentation

◆ m_baseFilename

std::string MPProblem::m_baseFilename
protected

The base name for output files.

◆ m_dynamicObstacles

std::vector<DynamicObstacle> MPProblem::m_dynamicObstacles
protected

The dynamic obstacles in our problem.

◆ m_environment

std::unique_ptr<Environment> MPProblem::m_environment
protected

The planning environment.

◆ m_filePath

std::string MPProblem::m_filePath
protected

The relative path for the problem XML.

◆ m_groupTaskMap

std::unordered_map<RobotGroup*, std::list<std::shared_ptr<GroupTask> > > MPProblem::m_groupTaskMap
protected

Map the group tasks assigned to each robot group.

◆ m_initialCfgs

std::unordered_map<Robot*,Cfg> MPProblem::m_initialCfgs
protected

Map of robot initial locations.

◆ m_interactionInformations

std::vector<std::unique_ptr<InteractionInformation> > MPProblem::m_interactionInformations
protected

All handoff templates for a problem.

◆ m_pointRobot

std::unique_ptr<Robot> MPProblem::m_pointRobot
protected

A pseudo point-robot.

◆ m_robotCapabilityMap

std::unordered_map<std::string,std::vector<Robot*> > MPProblem::m_robotCapabilityMap
protected

Map of robot type to set of robots.

◆ m_robotGroups

std::vector<std::unique_ptr<RobotGroup> > MPProblem::m_robotGroups
protected

Robot groups.

◆ m_robots

std::vector<std::unique_ptr<Robot> > MPProblem::m_robots
protected

The robots in our problem.

◆ m_taskDecompositions

std::unordered_map<Robot*,std::vector<std::unique_ptr<Decomposition> > > MPProblem::m_taskDecompositions
protected

Map robots to task decompositions.

◆ m_taskLabelMap

std::unordered_map<std::string, MPTask*> MPProblem::m_taskLabelMap
protected

Map task labels to tasks.

◆ m_taskMap

std::unordered_map<Robot*, std::list<std::shared_ptr<MPTask> > > MPProblem::m_taskMap
protected

Map the tasks assigned to each robot.

◆ m_xmlFilename

std::string MPProblem::m_xmlFilename
protected

The XML file name.


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