g2o
Public Member Functions | Public Attributes | List of all members
Robot Struct Reference
Inheritance diagram for Robot:
Inheritance graph
[legend]
Collaboration diagram for Robot:
Collaboration graph
[legend]

Public Member Functions

 Robot (OptimizableGraph *graph_)
 
void move (const Isometry3d &newPosition, int &id)
 
void relativeMove (const Isometry3d &delta, int &id)
 
void sense (WorldItem *wi=0)
 
- Public Member Functions inherited from WorldItem
 WorldItem (OptimizableGraph *graph_, OptimizableGraph::Vertex *vertex_=0)
 
OptimizableGraph::Vertexvertex ()
 
void setVertex (OptimizableGraph::Vertex *vertex_)
 
- Public Member Functions inherited from SimulatorItem
 SimulatorItem (OptimizableGraph *graph_)
 
OptimizableGraphgraph ()
 
virtual ~SimulatorItem ()
 

Public Attributes

Isometry3d _position
 
SensorVector _sensors
 
Vector6d _nmovecov
 
bool _planarMotion
 

Additional Inherited Members

- Protected Attributes inherited from WorldItem
OptimizableGraph::Vertex_vertex
 
- Protected Attributes inherited from SimulatorItem
OptimizableGraph_graph
 

Detailed Description

Definition at line 94 of file simulator_3d_plane.cpp.

Constructor & Destructor Documentation

Robot::Robot ( OptimizableGraph graph_)
inline

Definition at line 96 of file simulator_3d_plane.cpp.

96  : WorldItem(graph_) {
97  _planarMotion=false;
98  _position = Isometry3d::Identity();
99  }
Isometry3d _position
WorldItem(OptimizableGraph *graph_, OptimizableGraph::Vertex *vertex_=0)

Member Function Documentation

void Robot::move ( const Isometry3d &  newPosition,
int &  id 
)
inline

Definition at line 102 of file simulator_3d_plane.cpp.

References g2o::BaseVertex< D, T >::estimate(), graph, g2o::BaseEdge< D, E >::measurement(), sample_noise_from_se3(), g2o::BaseVertex< D, T >::setEstimate(), g2o::OptimizableGraph::Vertex::setId(), g2o::BaseEdge< D, E >::setInformation(), g2o::EdgeSE3::setMeasurement(), g2o::EdgeSE3Prior::setMeasurement(), g2o::OptimizableGraph::Edge::setParameterId(), and g2o::HyperGraph::Edge::vertices().

102  {
103  Isometry3d delta = _position.inverse()*newPosition;
104  _position = newPosition;
105  VertexSE3* v=new VertexSE3();
106  v->setId(id);
107  id++;
108  graph()->addVertex(v);
109  if (_planarMotion){
110  // add a singleton constraint that locks the position of the robot on the plane
111  EdgeSE3Prior* planeConstraint=new EdgeSE3Prior();
112  Matrix6d pinfo = Matrix6d::Zero();
113  pinfo(2,2)=1e9;
114  planeConstraint->setInformation(pinfo);
115  planeConstraint->setMeasurement(Isometry3d::Identity());
116  planeConstraint->vertices()[0]=v;
117  planeConstraint->setParameterId(0,0);
118  graph()->addEdge(planeConstraint);
119  }
120  if (vertex()){
121  VertexSE3* oldV=dynamic_cast<VertexSE3*>(vertex());
122  EdgeSE3* e=new EdgeSE3();
123  Isometry3d noise=sample_noise_from_se3(_nmovecov);
124  e->setMeasurement(delta*noise);
125  Matrix6d m=Matrix6d::Identity();
126  for (int i=0; i<6; i++){
127  m(i,i)=1./(_nmovecov(i));
128  }
129  e->setInformation(m);
130  e->vertices()[0]=vertex();
131  e->vertices()[1]=v;
132  graph()->addEdge(e);
133  v->setEstimate(oldV->estimate()*e->measurement());
134  } else {
136  }
137  setVertex(v);
138  }
Vector6d _nmovecov
void setVertex(OptimizableGraph::Vertex *vertex_)
Isometry3d _position
Edge between two 3D pose vertices.
Definition: edge_se3.h:18
virtual void setId(int id)
sets the id of the node in the graph be sure that the graph keeps consistent after changing the id ...
Eigen::Matrix< double, 6, 6 > Matrix6d
bool setParameterId(int argNum, int paramId)
const VertexContainer & vertices() const
Definition: hyper_graph.h:178
virtual void setMeasurement(const Isometry3D &m)
Definition: edge_se3.h:27
EIGEN_STRONG_INLINE void setInformation(const InformationType &information)
Definition: base_edge.h:69
void setEstimate(const EstimateType &et)
set the estimate for the vertex also calls updateCache()
Definition: base_vertex.h:101
const EstimateType & estimate() const
return the current estimate of the vertex
Definition: base_vertex.h:99
Eigen::Isometry3d sample_noise_from_se3(const Vector6d &cov)
3D pose Vertex, represented as an Isometry3D
Definition: vertex_se3.h:50
virtual void setMeasurement(const Isometry3D &m)
OptimizableGraph::Vertex * vertex()
virtual bool addEdge(HyperGraph::Edge *e)
virtual bool addVertex(HyperGraph::Vertex *v, Data *userData)
prior for an SE3 element
EIGEN_STRONG_INLINE const Measurement & measurement() const
accessor functions for the measurement represented by the edge
Definition: base_edge.h:75
OptimizableGraph * graph()
void Robot::relativeMove ( const Isometry3d &  delta,
int &  id 
)
inline

Definition at line 140 of file simulator_3d_plane.cpp.

140  {
141  Isometry3d newPosition = _position*delta;
142  move(newPosition, id);
143  }
Isometry3d _position
void move(const Isometry3d &newPosition, int &id)
void Robot::sense ( WorldItem wi = 0)
inline

Definition at line 145 of file simulator_3d_plane.cpp.

References Sensor::sense().

145  {
146  for (size_t i=0; i<_sensors.size(); i++){
147  Sensor* s=_sensors[i];
148  s->sense(wi, _position);
149  }
150  }
SensorVector _sensors
Isometry3d _position
virtual bool sense(WorldItem *, const Isometry3d &)

Member Data Documentation

Vector6d Robot::_nmovecov

Definition at line 154 of file simulator_3d_plane.cpp.

bool Robot::_planarMotion

Definition at line 155 of file simulator_3d_plane.cpp.

Isometry3d Robot::_position

Definition at line 152 of file simulator_3d_plane.cpp.

SensorVector Robot::_sensors

Definition at line 153 of file simulator_3d_plane.cpp.


The documentation for this struct was generated from the following file: