g2o
Public Member Functions | Protected Attributes | List of all members
g2o::World Class Reference

#include <simulator.h>

Collaboration diagram for g2o::World:
Collaboration graph
[legend]

Public Member Functions

 World (OptimizableGraph *graph_)
 
OptimizableGraphgraph ()
 
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 275 of file simulator.h.

Constructor & Destructor Documentation

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

Definition at line 278 of file simulator.h.

278 {_graph = graph_; _runningId=0; _paramId=0;}
int _paramId
Definition: simulator.h:291
int _runningId
Definition: simulator.h:290
OptimizableGraph * _graph
Definition: simulator.h:289

Member Function Documentation

bool g2o::World::addParameter ( Parameter p)

Definition at line 102 of file simulator.cpp.

References graph, and g2o::Parameter::setId().

Referenced by g2o::SensorPointXYZ::addParameters(), g2o::SensorSE3Prior::addParameters(), g2o::SensorPointXYZDepth::addParameters(), g2o::SensorPointXYZDisparity::addParameters(), g2o::SensorPose3DOffset::addParameters(), and g2o::SensorPointXYOffset::addParameters().

102  {
103  if ( !graph())
104  return false;
105  param->setId(_paramId);
106  graph()->addParameter(param);
107  _paramId++;
108  return true;
109  }
OptimizableGraph * graph()
Definition: simulator.h:279
bool addParameter(Parameter *p)
int _paramId
Definition: simulator.h:291
bool g2o::World::addRobot ( BaseRobot robot)

Definition at line 82 of file simulator.cpp.

References g2o::BaseRobot::setWorld().

Referenced by main().

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

Definition at line 90 of file simulator.cpp.

References graph, and g2o::BaseWorldObject::vertex().

Referenced by main().

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

Definition at line 279 of file simulator.h.

279 {return _graph;}
OptimizableGraph * _graph
Definition: simulator.h:289
std::set<BaseWorldObject*>& g2o::World::objects ( )
inline
std::set<BaseRobot*>& g2o::World::robots ( )
inline

Definition at line 285 of file simulator.h.

285 {return _robots; }
std::set< BaseRobot * > _robots
Definition: simulator.h:288

Member Data Documentation

OptimizableGraph* g2o::World::_graph
protected

Definition at line 289 of file simulator.h.

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

Definition at line 287 of file simulator.h.

int g2o::World::_paramId
protected

Definition at line 291 of file simulator.h.

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

Definition at line 288 of file simulator.h.

int g2o::World::_runningId
protected

Definition at line 290 of file simulator.h.


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