g2o
Loading...
Searching...
No Matches
g2o::World Class Reference

#include <simulator.h>

Collaboration diagram for g2o::World:

Public Member Functions

 World (OptimizableGraph *graph_)
OptimizableGraph * graph ()
bool addRobot (BaseRobot *robot)
bool addWorldObject (BaseWorldObject *worldObject)
bool addParameter (Parameter *p)
std::set< BaseWorldObject * > & objects ()
std::set< BaseRobot * > & robots ()

Protected Attributes

std::set< BaseWorldObject * > _objects
std::set< BaseRobot * > _robots
OptimizableGraph * _graph
int _runningId
int _paramId

Detailed Description

Definition at line 103 of file simulator.h.

Constructor & Destructor Documentation

◆ World()

g2o::World::World ( OptimizableGraph * graph_)
inline

Definition at line 105 of file simulator.h.

105 {
106 _graph = graph_;
107 _runningId = 0;
108 _paramId = 0;
109 }
OptimizableGraph * _graph
Definition simulator.h:121
int _runningId
Definition simulator.h:122

References _graph, _paramId, and _runningId.

Member Function Documentation

◆ addParameter()

◆ addRobot()

bool g2o::World::addRobot ( BaseRobot * robot)

Definition at line 82 of file simulator.cpp.

82 {
83 std::pair<std::set<BaseRobot*>::iterator, bool> result =
84 _robots.insert(robot);
85 if (result.second) {
86 robot->setWorld(this);
87 }
88 return result.second;
89}
std::set< BaseRobot * > _robots
Definition simulator.h:120

References _robots, and g2o::BaseRobot::setWorld().

Referenced by main().

◆ addWorldObject()

bool g2o::World::addWorldObject ( BaseWorldObject * worldObject)

Definition at line 91 of file simulator.cpp.

91 {
92 std::pair<std::set<BaseWorldObject*>::iterator, bool> result =
93 _objects.insert(object);
94 if (result.second) {
95 object->setWorld(this);
96 }
97 if (graph() && object->vertex()) {
98 object->vertex()->setId(_runningId++);
99 graph()->addVertex(object->vertex());
100 }
101 return result.second;
102}
std::set< BaseWorldObject * > _objects
Definition simulator.h:119
virtual bool addVertex(HyperGraph::Vertex *v, Data *userData)
Vertex * vertex(int id)
returns the vertex number id appropriately casted

References _objects, _runningId, g2o::OptimizableGraph::addVertex(), graph(), and g2o::BaseWorldObject::vertex().

Referenced by main(), and g2o::Robot< WorldObjectSE2 >::move().

◆ graph()

OptimizableGraph * g2o::World::graph ( )
inline

Definition at line 110 of file simulator.h.

110{ return _graph; }

References _graph.

Referenced by addParameter(), and addWorldObject().

◆ objects()

◆ robots()

std::set< BaseRobot * > & g2o::World::robots ( )
inline

Definition at line 116 of file simulator.h.

116{ return _robots; }

References _robots.

Member Data Documentation

◆ _graph

OptimizableGraph* g2o::World::_graph
protected

Definition at line 121 of file simulator.h.

Referenced by graph(), and World().

◆ _objects

std::set<BaseWorldObject*> g2o::World::_objects
protected

Definition at line 119 of file simulator.h.

Referenced by addWorldObject(), and objects().

◆ _paramId

int g2o::World::_paramId
protected

Definition at line 123 of file simulator.h.

Referenced by addParameter(), and World().

◆ _robots

std::set<BaseRobot*> g2o::World::_robots
protected

Definition at line 120 of file simulator.h.

Referenced by addRobot(), and robots().

◆ _runningId

int g2o::World::_runningId
protected

Definition at line 122 of file simulator.h.

Referenced by addWorldObject(), and World().


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