g2o
Loading...
Searching...
No Matches
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)
 
 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_)
 
 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 ()
 
 SimulatorItem (OptimizableGraph *graph_)
 
OptimizableGraphgraph ()
 
virtual ~SimulatorItem ()
 

Public Attributes

 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
 
Isometry3d _position
 
SensorVector _sensors
 
Vector6 _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 81 of file simulator_3d_line.cpp.

Constructor & Destructor Documentation

◆ Robot() [1/2]

Robot::Robot ( OptimizableGraph graph_)
inline

Definition at line 84 of file simulator_3d_line.cpp.

84 : WorldItem(graph_) {
85 _planarMotion = false;
86 _position = Isometry3d::Identity();
87 }
Isometry3d _position

References _planarMotion, and _position.

◆ Robot() [2/2]

Robot::Robot ( OptimizableGraph graph_)
inline

Definition at line 108 of file simulator_3d_plane.cpp.

108 : WorldItem(graph_) {
109 _planarMotion = false;
110 _position = Isometry3d::Identity();
111 }

References _planarMotion, and _position.

Member Function Documentation

◆ move() [1/2]

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

Definition at line 89 of file simulator_3d_line.cpp.

89 {
90 Isometry3d delta = _position.inverse() * newPosition;
91 _position = newPosition;
92 VertexSE3* v = new VertexSE3();
93 v->setId(id);
94 id++;
95 graph()->addVertex(v);
96 if (_planarMotion) {
97 // add a singleton constraint that locks the position of the robot on the
98 // plane
99 EdgeSE3Prior* planeConstraint = new EdgeSE3Prior();
100 Matrix6 pinfo = Matrix6::Zero();
101 pinfo(2, 2) = 1e9;
102 planeConstraint->setInformation(pinfo);
103 planeConstraint->setMeasurement(Isometry3d::Identity());
104 planeConstraint->vertices()[0] = v;
105 planeConstraint->setParameterId(0, 0);
106 graph()->addEdge(planeConstraint);
107 }
108 if (vertex()) {
109 VertexSE3* oldV = dynamic_cast<VertexSE3*>(vertex());
110 EdgeSE3* e = new EdgeSE3();
111 Isometry3d noise = sample_noise_from_se3(_nmovecov);
112 e->setMeasurement(delta * noise);
113 Matrix6 m = Matrix6::Identity();
114 for (int i = 0; i < 6; ++i) {
115 m(i, i) = 1.0 / (_nmovecov(i));
116 }
117 e->setInformation(m);
118 e->vertices()[0] = vertex();
119 e->vertices()[1] = v;
120 graph()->addEdge(e);
121 v->setEstimate(oldV->estimate() * e->measurement());
122 } else {
123 v->setEstimate(_position);
124 }
125 setVertex(v);
126 }
EIGEN_STRONG_INLINE const Measurement & measurement() const
accessor functions for the measurement represented by the edge
Definition base_edge.h:119
void setInformation(const InformationType &information)
Definition base_edge.h:111
OptimizableGraph * graph() const
Definition simulator.cpp:46
const EstimateType & estimate() const
return the current estimate of the vertex
void setEstimate(const EstimateType &et)
set the estimate for the vertex also calls updateCache()
prior for an SE3 element
virtual void setMeasurement(const Isometry3 &m)
Edge between two 3D pose vertices.
Definition edge_se3.h:44
virtual void setMeasurement(const Isometry3 &m)
Definition edge_se3.h:53
const VertexContainer & vertices() const
bool setParameterId(int argNum, int paramId)
3D pose Vertex, represented as an Isometry3
Definition vertex_se3.h:50
Eigen::Matrix< double, 6, 6 > Matrix6
Definition line3d.h:38
Eigen::Isometry3d sample_noise_from_se3(const Vector6 &cov)
Vector6 _nmovecov
OptimizableGraph::Vertex * vertex()
void setVertex(OptimizableGraph::Vertex *vertex_)
virtual bool addEdge(HyperGraph::Edge *e)
virtual bool addVertex(HyperGraph::Vertex *v, Data *userData)

References _nmovecov, _planarMotion, _position, g2o::OptimizableGraph::addEdge(), g2o::OptimizableGraph::addVertex(), g2o::BaseVertex< D, T >::estimate(), g2o::BaseRobot::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(), WorldItem::setVertex(), WorldItem::vertex(), and g2o::HyperGraph::Edge::vertices().

◆ move() [2/2]

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

Definition at line 113 of file simulator_3d_plane.cpp.

113 {
114 Isometry3d delta = _position.inverse() * newPosition;
115 _position = newPosition;
116 VertexSE3* v = new VertexSE3();
117 v->setId(id);
118 id++;
119 graph()->addVertex(v);
120 if (_planarMotion) {
121 // add a singleton constraint that locks the position of the robot on the
122 // plane
123 EdgeSE3Prior* planeConstraint = new EdgeSE3Prior();
124 Matrix6 pinfo = Matrix6::Zero();
125 pinfo(2, 2) = 1e9;
126 planeConstraint->setInformation(pinfo);
127 planeConstraint->setMeasurement(Isometry3d::Identity());
128 planeConstraint->vertices()[0] = v;
129 planeConstraint->setParameterId(0, 0);
130 graph()->addEdge(planeConstraint);
131 }
132 if (vertex()) {
133 VertexSE3* oldV = dynamic_cast<VertexSE3*>(vertex());
134 EdgeSE3* e = new EdgeSE3();
135 Isometry3d noise = sample_noise_from_se3(_nmovecov);
136 e->setMeasurement(delta * noise);
137 Matrix6 m = Matrix6::Identity();
138 for (int i = 0; i < 6; i++) {
139 m(i, i) = 1. / (_nmovecov(i));
140 }
141 e->setInformation(m);
142 e->vertices()[0] = vertex();
143 e->vertices()[1] = v;
144 graph()->addEdge(e);
145 v->setEstimate(oldV->estimate() * e->measurement());
146 } else {
147 v->setEstimate(_position);
148 }
149 setVertex(v);
150 }

References _nmovecov, _planarMotion, _position, g2o::OptimizableGraph::addEdge(), g2o::OptimizableGraph::addVertex(), g2o::BaseVertex< D, T >::estimate(), g2o::BaseRobot::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(), WorldItem::setVertex(), WorldItem::vertex(), and g2o::HyperGraph::Edge::vertices().

◆ relativeMove() [1/2]

void Robot::relativeMove ( const Isometry3d &  delta,
int &  id 
)
inline

Definition at line 128 of file simulator_3d_line.cpp.

128 {
129 Isometry3d newPosition = _position * delta;
130 move(newPosition, id);
131 }
virtual void move(const PoseType &pose_)
Definition simulator.h:141

References _position, and g2o::Robot< RobotPoseObject >::move().

◆ relativeMove() [2/2]

void Robot::relativeMove ( const Isometry3d &  delta,
int &  id 
)
inline

Definition at line 152 of file simulator_3d_plane.cpp.

152 {
153 Isometry3d newPosition = _position * delta;
154 move(newPosition, id);
155 }

References _position, and g2o::Robot< RobotPoseObject >::move().

◆ sense() [1/2]

void Robot::sense ( WorldItem wi = 0)
inline

Definition at line 133 of file simulator_3d_line.cpp.

133 {
134 for (size_t i = 0; i < _sensors.size(); ++i) {
135 Sensor* s = _sensors[i];
136 s->sense(wi, _position);
137 }
138 }
std::set< BaseSensor * > _sensors
Definition simulator.h:99
virtual bool sense(WorldItem *, const Isometry3d &)

References _position, g2o::BaseRobot::_sensors, and Sensor::sense().

◆ sense() [2/2]

void Robot::sense ( WorldItem wi = 0)
inline

Definition at line 157 of file simulator_3d_plane.cpp.

157 {
158 for (size_t i = 0; i < _sensors.size(); i++) {
159 Sensor* s = _sensors[i];
160 s->sense(wi, _position);
161 }
162 }

References _position, g2o::BaseRobot::_sensors, and Sensor::sense().

Member Data Documentation

◆ _nmovecov

Vector6 Robot::_nmovecov

Definition at line 142 of file simulator_3d_line.cpp.

Referenced by move().

◆ _planarMotion

bool Robot::_planarMotion

Definition at line 143 of file simulator_3d_line.cpp.

Referenced by move(), and Robot().

◆ _position

Isometry3d Robot::_position

Definition at line 140 of file simulator_3d_line.cpp.

Referenced by move(), relativeMove(), Robot(), and sense().

◆ _sensors

SensorVector Robot::_sensors

Definition at line 141 of file simulator_3d_line.cpp.

◆ EIGEN_MAKE_ALIGNED_OPERATOR_NEW

Robot::EIGEN_MAKE_ALIGNED_OPERATOR_NEW

Definition at line 82 of file simulator_3d_line.cpp.


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