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

#include <simulator.h>

Inheritance diagram for g2o::BaseRobot:
Inheritance graph
[legend]
Collaboration diagram for g2o::BaseRobot:
Collaboration graph
[legend]

Public Member Functions

 BaseRobot (World *world_, const std::string &name_)
 
void setWorld (World *world_)
 
Worldworld ()
 
const std::string & name () const
 
OptimizableGraphgraph ()
 
bool addSensor (BaseSensor *sensor)
 
const std::set< BaseSensor * > sensors ()
 
virtual void sense ()
 

Protected Attributes

World_world
 
std::set< BaseSensor * > _sensors
 
std::string _name
 

Detailed Description

Definition at line 78 of file simulator.h.

Constructor & Destructor Documentation

g2o::BaseRobot::BaseRobot ( World world_,
const std::string &  name_ 
)
inline

Definition at line 80 of file simulator.h.

80 {_world = world_; _name = name_; }
std::string _name
Definition: simulator.h:91
World * _world
Definition: simulator.h:89

Member Function Documentation

bool g2o::BaseRobot::addSensor ( BaseSensor sensor)

Definition at line 51 of file simulator.cpp.

References g2o::BaseSensor::addParameters(), graph, and g2o::BaseSensor::setRobot().

Referenced by main().

51  {
52  assert (graph());
53  std::pair<std::set<BaseSensor*>::iterator, bool> result=_sensors.insert(sensor);
54  if(result.second){
55  sensor->setRobot(this);
56  sensor->addParameters();
57  }
58  return result.second;
59  }
std::set< BaseSensor * > _sensors
Definition: simulator.h:90
OptimizableGraph * graph()
Definition: simulator.cpp:45
OptimizableGraph * g2o::BaseRobot::graph ( )

Definition at line 45 of file simulator.cpp.

References graph.

45  {
46  if (_world)
47  return _world-> graph();
48  return 0;
49  }
World * _world
Definition: simulator.h:89
OptimizableGraph * graph()
Definition: simulator.cpp:45
const std::string& g2o::BaseRobot::name ( ) const
inline

Definition at line 83 of file simulator.h.

References graph.

83 {return _name;}
std::string _name
Definition: simulator.h:91
void g2o::BaseRobot::sense ( )
virtual

Definition at line 61 of file simulator.cpp.

References g2o::BaseSensor::sense().

Referenced by main(), and Simulator::sense().

61  {
62  for (std::set<BaseSensor*>::iterator it=_sensors.begin(); it!=_sensors.end(); it++){
63  BaseSensor* s=*it;
64  s->sense();
65  }
66  }
std::set< BaseSensor * > _sensors
Definition: simulator.h:90
const std::set<BaseSensor*> g2o::BaseRobot::sensors ( )
inline

Definition at line 86 of file simulator.h.

86 {return _sensors;}
std::set< BaseSensor * > _sensors
Definition: simulator.h:90
void g2o::BaseRobot::setWorld ( World world_)
inline

Definition at line 81 of file simulator.h.

Referenced by g2o::World::addRobot().

81 {_world = world_;}
World * _world
Definition: simulator.h:89
World* g2o::BaseRobot::world ( )
inline

Definition at line 82 of file simulator.h.

82 {return _world;}
World * _world
Definition: simulator.h:89

Member Data Documentation

std::string g2o::BaseRobot::_name
protected

Definition at line 91 of file simulator.h.

std::set<BaseSensor*> g2o::BaseRobot::_sensors
protected

Definition at line 90 of file simulator.h.

Referenced by main().

World* g2o::BaseRobot::_world
protected

Definition at line 89 of file simulator.h.


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