1 #ifndef PMPL_ENVIRONMENT_H_
2 #define PMPL_ENVIRONMENT_H_
8 #include "Transformation.h"
9 #include "glutils/color.h"
16 #include <unordered_map>
59 const glutils::color&
Color() const noexcept;
73 bool InTerrain(const Point3d _p) const noexcept;
117 glutils::color m_color{glutils::color::green};
118 std::unique_ptr<Boundary> m_boundary;
120 std::vector<std::unique_ptr<Boundary>> m_boundaries;
122 bool m_virtual{
false};
144 typedef std::unordered_map<std::string, std::vector<Terrain>>
185 void Read(std::
string _filename);
189 void Print(std::ostream& _os) const;
193 void Write(std::ostream& _os);
248 size_t AddObstacle(const std::
string& _dir, const std::
string& _filename,
Definition: Boundary.h:30
Definition: CollisionDetectionMethod.h:19
Definition: Environment.h:137
Environment(Environment &&_other)
Move.
mathtool::Transformation m_initialCameraTransform
Camera starts here.
Definition: Environment.h:369
Environment & operator=(const Environment &_other)
Copy.
Definition: Environment.cpp:299
double m_orientationRes
Rotational resolution of movement.
Definition: Environment.h:341
double m_positionRes
Positional resolution of movement.
Definition: Environment.h:340
std::string m_filename
Which file did this environment come from?
Definition: Environment.h:333
const std::string & GetEnvFileName() const noexcept
Get the environment file name.
Definition: Environment.cpp:332
std::string m_modelDataDir
Directory where environment file is located.
Definition: Environment.h:334
void Read(std::string _filename)
Definition: Environment.cpp:423
std::unique_ptr< Boundary > m_boundary
Workspace boundary.
Definition: Environment.h:348
void ReadXML(XMLNode &_node)
Parse XML environment file.
Definition: Environment.cpp:397
const mathtool::Transformation & GetInitialCameraTransformation() const noexcept
Get the initial transformation for the camera.
Definition: Environment.cpp:769
void InitializeBoundary(std::string _type, const std::string _where)
Definition: Environment.cpp:777
double GetTimeRes() const noexcept
Get the time resolution.
Definition: Environment.cpp:614
bool UsingBoundaryObstacle() const noexcept
Check if the boundary is also modeled as an obstacle.
Definition: Environment.cpp:737
void SetOrientationRes(double _res) noexcept
Set the orientation resolution.
Definition: Environment.cpp:607
std::unordered_map< std::string, std::vector< Terrain > > TerrainMap
Definition: Environment.h:145
void Write(std::ostream &_os)
Definition: Environment.cpp:506
size_t AddObstacle(const std::string &_dir, const std::string &_filename, const mathtool::Transformation &_t=mathtool::Transformation())
Definition: Environment.cpp:664
size_t NumObstacles() const noexcept
Get the number of MultiBodies.
Definition: Environment.cpp:637
bool m_boundaryObstacle
Use the boundary as an obstacle?
Definition: Environment.h:350
bool SameTerrain(Cfg _start, Cfg _goal)
Definition: Environment.cpp:847
void Print(std::ostream &_os) const
Definition: Environment.cpp:488
mathtool::Vector3d m_gravity
The gravity direction and magnitude.
Definition: Environment.h:357
MultiBody * GetObstacle(size_t _index) const
Definition: Environment.cpp:644
double m_timeRes
Resolution for time.
Definition: Environment.h:342
void RestoreBoundary()
Restores original boundary.
Definition: Environment.cpp:860
double GetOrientationRes() const noexcept
Get the orientation resolution.
Definition: Environment.cpp:600
std::unique_ptr< Boundary > m_originalBoundary
Definition: Environment.h:313
std::map< mathtool::Vector3d, std::vector< size_t > > ComputeObstacleVertexMap() const
Definition: Environment.cpp:718
Environment & operator=(Environment &&_other)
Move.
std::vector< std::unique_ptr< MultiBody > > m_obstacles
Obstacle multibodies.
Definition: Environment.h:349
void RemoveObstacle(const size_t _position)
Definition: Environment.cpp:689
const TerrainMap & GetTerrains() const noexcept
Get environment terrains.
Definition: Environment.cpp:761
double GetFrictionCoefficient() const noexcept
Get the friction coefficient.
Definition: Environment.cpp:745
Boundary * GetBoundary() const noexcept
Get the single boundary of the environemnt.
Definition: Environment.cpp:622
double m_frictionCoefficient
The uniform friction coefficient.
Definition: Environment.h:356
void ReadXMLOptions(XMLNode &_node)
Parse XML options from the Problem XML node.
Definition: Environment.cpp:339
void CreateBoundaryObstacle()
Create an obstacle for the boundary.
Definition: Environment.cpp:796
bool IsolateTerrain(Cfg start, Cfg goal)
IROS Hacks.
Definition: Environment.cpp:832
void ComputeResolution(const std::vector< std::unique_ptr< Robot >> &_robots)
Definition: Environment.cpp:522
MultiBody * GetRandomObstacle() const
Definition: Environment.cpp:653
TerrainMap m_terrains
Environment terrains.
Definition: Environment.h:363
void SaveBoundary()
Saves boundary as original boundary.
Definition: Environment.cpp:866
void SetBoundary(std::unique_ptr< Boundary > &&_b) noexcept
Definition: Environment.cpp:629
const mathtool::Vector3d & GetGravity() const noexcept
Get the gravity 3-vector.
Definition: Environment.cpp:752
double GetPositionRes() const noexcept
Get the position resolution.
Definition: Environment.cpp:586
void SetPositionRes(double _res) noexcept
Set the position resolution.
Definition: Environment.cpp:593
Definition: MultiBody.h:65
Workspace representation of terrain within the world.
Definition: Environment.h:29
Boundary * GetBoundary() const noexcept
Get the single enclosing boundary of the terrain.
Definition: Environment.cpp:83
Axis
Definition: Environment.h:36
@ Y
Definition: Environment.h:36
@ Z
Definition: Environment.h:36
@ X
Definition: Environment.h:36
Terrain & operator=(const Terrain &_terrain)
Definition: Environment.cpp:59
double GetPerimeter()
Find the perimeter of all the boundaries.
Definition: Environment.cpp:95
bool IsNeighbor(const Terrain &_terrain)
Definition: Environment.cpp:140
const glutils::color & Color() const noexcept
Get the color for visualization.
Definition: Environment.cpp:76
const std::vector< std::unique_ptr< Boundary > > & GetBoundaries() const noexcept
Get the single enclosing boundaries of the terrain.
Definition: Environment.cpp:89
bool IsVirtual() const noexcept
Definition: Environment.cpp:158
bool InTerrain(const Point3d _p) const noexcept
Definition: Environment.cpp:120
bool IsWired() const noexcept
Definition: Environment.cpp:164
Definition: WorkspaceDecomposition.h:24
Definition: GMSPolyhedron.h:27