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
Environment Class Reference

Public Member Functions

Construction
 Environment ()
 
 Environment (XMLNode &_node)
 
 Environment (const Environment &_other)
 Copy.
 
 Environment (Environment &&_other)
 Move.
 
virtual ~Environment ()
 
Assignment
Environmentoperator= (const Environment &_other)
 Copy.
 
Environmentoperator= (Environment &&_other)
 Move.
 
I/O
const std::string & GetEnvFileName () const noexcept
 Get the environment file name.
 
void ReadXMLOptions (XMLNode &_node)
 Parse XML options from the Problem XML node.
 
void ReadXML (XMLNode &_node)
 Parse XML environment file.
 
void Read (std::string _filename)
 
void Print (std::ostream &_os) const
 
void Write (std::ostream &_os)
 
Resolutions
void ComputeResolution (const std::vector< std::unique_ptr< Robot > > &_robots)
 
double GetPositionRes () const noexcept
 Get the position resolution.
 
void SetPositionRes (double _res) noexcept
 Set the position resolution.
 
double GetOrientationRes () const noexcept
 Get the orientation resolution.
 
void SetOrientationRes (double _res) noexcept
 Set the orientation resolution.
 
double GetTimeRes () const noexcept
 Get the time resolution.
 
Boundary Functions
BoundaryGetBoundary () const noexcept
 Get the single boundary of the environemnt.
 
void SetBoundary (std::unique_ptr< Boundary > &&_b) noexcept
 
Obstacle Functions
size_t NumObstacles () const noexcept
 Get the number of MultiBodies.
 
MultiBodyGetObstacle (size_t _index) const
 
MultiBodyGetRandomObstacle () const
 
size_t AddObstacle (const std::string &_dir, const std::string &_filename, const mathtool::Transformation &_t=mathtool::Transformation())
 
void RemoveObstacle (const size_t _position)
 
void RemoveObstacle (MultiBody *const _obst)
 
std::map< mathtool::Vector3d, std::vector< size_t > > ComputeObstacleVertexMap () const
 
bool UsingBoundaryObstacle () const noexcept
 Check if the boundary is also modeled as an obstacle.
 
Terrain Functions
const TerrainMap & GetTerrains () const noexcept
 Get environment terrains.
 

Public Types

Local Types
typedef std::unordered_map< std::string, std::vector< Terrain > > TerrainMap
 

Protected Member Functions

Helpers
void InitializeBoundary (std::string _type, const std::string _where)
 
void CreateBoundaryObstacle ()
 Create an obstacle for the boundary.
 

Protected Attributes

File Info
std::string m_filename
 Which file did this environment come from?
 
std::string m_modelDataDir
 Directory where environment file is located.
 
Resolution Info
double m_positionRes {-1.}
 Positional resolution of movement.
 
double m_orientationRes {.05}
 Rotational resolution of movement.
 
double m_timeRes {.05}
 Resolution for time.
 
Models
std::unique_ptr< Boundarym_boundary
 Workspace boundary.
 
std::vector< std::unique_ptr< MultiBody > > m_obstacles
 Obstacle multibodies.
 
bool m_boundaryObstacle {false}
 Use the boundary as an obstacle?
 
Terrains
TerrainMap m_terrains
 Environment terrains.
 
Simulation Properties
mathtool::Transformation m_initialCameraTransform
 Camera starts here.
 

Simulation Functions

std::unique_ptr< Boundarym_originalBoundary
 
const mathtool::Transformation & GetInitialCameraTransformation () const noexcept
 Get the initial transformation for the camera.
 
bool IsolateTerrain (Cfg start, Cfg goal)
 IROS Hacks. More...
 
bool SameTerrain (Cfg _start, Cfg _goal)
 
void RestoreBoundary ()
 Restores original boundary.
 
void SaveBoundary ()
 Saves boundary as original boundary.
 

Physical Properties

double m_frictionCoefficient {0}
 The uniform friction coefficient.
 
mathtool::Vector3d m_gravity
 The gravity direction and magnitude.
 
double GetFrictionCoefficient () const noexcept
 Get the friction coefficient.
 
const mathtool::Vector3d & GetGravity () const noexcept
 Get the gravity 3-vector.
 

Detailed Description

Workspace for the motion planning problem, including a boundary and zero or more obstacles.

Member Function Documentation

◆ Read()

void Environment::Read ( std::string  _filename)

Parse an old-style environment file.

Parameters
_filenameThe name of the file to read.
Note
This is provided only for supporting old environments. Do not make any modifications here - if you need to add features, you must upgrade your env file to the newer XML format.

◆ Print()

void Environment::Print ( std::ostream &  _os) const

Print environment resolutions and boundary information.

Parameters
_osThe output stream to print to.

◆ Write()

void Environment::Write ( std::ostream &  _os)

Output environment to .env file format.

Parameters
_osThe output stream to write to.

◆ ComputeResolution()

void Environment::ComputeResolution ( const std::vector< std::unique_ptr< Robot > > &  _robots)

Automatically compute position resolution when not specified.

Parameters
_robotsRobots to consider when determining resolution

◆ SetBoundary()

void Environment::SetBoundary ( std::unique_ptr< Boundary > &&  _b)
noexcept

Get the single boundary of the environemnt

Parameters
_bThe new boundary

◆ GetObstacle()

MultiBody * Environment::GetObstacle ( size_t  _index) const

Get requested obstacle

Parameters
_indexRequested multibody
Returns
Pointer to static multibody

◆ GetRandomObstacle()

MultiBody * Environment::GetRandomObstacle ( ) const

Get random multiboy

Returns
Pointer to random static multibody

◆ AddObstacle()

size_t Environment::AddObstacle ( const std::string &  _dir,
const std::string &  _filename,
const mathtool::Transformation &  _t = mathtool::Transformation() 
)

Add an obstacle to the environment.

Parameters
_dirDirectory for geometry file
_filenameGeometry filename
_tTransformation of object
Returns
The index of the newly created obstacle.

◆ RemoveObstacle() [1/2]

void Environment::RemoveObstacle ( const size_t  _position)

Remove an obstacle from the environment.

Parameters
_positionIndex in m_obstacleBodies to be removed

◆ RemoveObstacle() [2/2]

void Environment::RemoveObstacle ( MultiBody *const  _obst)

Remove obstacle from environment

Parameters
_obstObstacle to be removed

◆ ComputeObstacleVertexMap()

std::map< Vector3d, std::vector< size_t > > Environment::ComputeObstacleVertexMap ( ) const

Compute a mapping of the obstacle vertices.

Returns
A map from obstacle points to obstacle indexes.

◆ IsolateTerrain()

bool Environment::IsolateTerrain ( Cfg  start,
Cfg  goal 
)

IROS Hacks.

Determine if two configurations are in the same boundary of a terrain and, if so, sets mutual terrain as new boundary

Parameters
_startFirst configuration
_endSecond configuration
Returns
True if _start and _cfg in same terrain boundary,

◆ SameTerrain()

bool Environment::SameTerrain ( Cfg  _start,
Cfg  _goal 
)

Determine if two configurations are in the same terrain

Parameters
_startFirst configuration
_endSecond configuration
Returns
True if _start and _cfg in same terrain

◆ InitializeBoundary()

void Environment::InitializeBoundary ( std::string  _type,
const std::string  _where 
)
protected

Initialize a boundary object of the appropriate type.

Parameters
_typeType of boundary object (box, box2d, sphere, or sphere2d)
_whereString for parse exception

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