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

Public Member Functions

 PlaneSensor (Robot *r, int offsetId, const Isometry3d &offset_)
 
virtual bool isVisible (const WorldItem *wi) const
 
virtual bool sense (WorldItem *wi, const Isometry3d &position)
 
- Public Member Functions inherited from Sensor
 Sensor (Robot *robot_)
 
Robotrobot ()
 
virtual ~Sensor ()
 

Public Attributes

VertexSE3_offsetVertex
 
Vector3d _nplane
 

Additional Inherited Members

- Protected Attributes inherited from Sensor
Robot_robot
 

Detailed Description

Definition at line 194 of file simulator_3d_plane.cpp.

Constructor & Destructor Documentation

PlaneSensor::PlaneSensor ( Robot r,
int  offsetId,
const Isometry3d &  offset_ 
)
inline

Definition at line 195 of file simulator_3d_plane.cpp.

195  : Sensor(r){
196  _offsetVertex = new VertexSE3();
197  _offsetVertex->setId(offsetId);
198  _offsetVertex->setEstimate(offset_);
200  };
Robot * robot()
VertexSE3 * _offsetVertex
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 ...
Sensor(Robot *robot_)
OptimizableGraph * graph()
Definition: simulator.cpp:45
void setEstimate(const EstimateType &et)
set the estimate for the vertex also calls updateCache()
Definition: base_vertex.h:101
3D pose Vertex, represented as an Isometry3D
Definition: vertex_se3.h:50
virtual bool addVertex(HyperGraph::Vertex *v, Data *userData)

Member Function Documentation

virtual bool PlaneSensor::isVisible ( const WorldItem wi) const
inlinevirtual

Reimplemented from Sensor.

Definition at line 202 of file simulator_3d_plane.cpp.

202  {
203  if (! wi)
204  return false;
205  const PlaneItem* pi=dynamic_cast<const PlaneItem*>(wi);
206  if (! pi)
207  return false;
208  return true;
209  }
virtual bool PlaneSensor::sense ( WorldItem wi,
const Isometry3d &  position 
)
inlinevirtual

Reimplemented from Sensor.

Definition at line 211 of file simulator_3d_plane.cpp.

References g2o::BaseVertex< D, T >::estimate(), g2o::Plane3D::oplus(), sample_noise_from_plane(), g2o::BaseEdge< D, E >::setInformation(), g2o::EdgeSE3PlaneSensorCalib::setMeasurement(), WorldItem::vertex(), and g2o::HyperGraph::Edge::vertices().

211  {
212  if (! wi)
213  return false;
214  PlaneItem* pi=dynamic_cast<PlaneItem*>(wi);
215  if (! pi)
216  return false;
217  OptimizableGraph::Vertex* rv = robot()->vertex();
218  if (! rv) {
219  return false;
220  }
221  VertexSE3* robotVertex = dynamic_cast<VertexSE3*>(rv);
222  if (! robotVertex){
223  return false;
224  }
225  const Isometry3d& robotPose=position;
226  Isometry3d sensorPose=robotPose*_offsetVertex->estimate();
227  VertexPlane* planeVertex=dynamic_cast<VertexPlane*>(pi->vertex());
228  Plane3D worldPlane=planeVertex->estimate();
229 
230  Plane3D measuredPlane=sensorPose.inverse()*worldPlane;
231 
233  e->vertices()[0]=robotVertex;
234  e->vertices()[1]=planeVertex;
235  e->vertices()[2]=_offsetVertex;
236  Vector3d noise = sample_noise_from_plane(_nplane);
237  measuredPlane.oplus(noise);
238  e->setMeasurement(measuredPlane);
239  Matrix3d m=Matrix3d::Zero();
240  m(0,0)=1./(_nplane(0));
241  m(1,1)=1./(_nplane(1));
242  m(2,2)=1./(_nplane(2));
243  e->setInformation(m);
244  robot()->graph()->addEdge(e);
245  return true;
246  }
void oplus(const Eigen::Vector3d &v)
Definition: plane3d.h:87
Robot * robot()
VertexSE3 * _offsetVertex
const VertexContainer & vertices() const
Definition: hyper_graph.h:178
EIGEN_STRONG_INLINE void setInformation(const InformationType &information)
Definition: base_edge.h:69
plane measurement that also calibrates an offset for the sensor
OptimizableGraph * graph()
Definition: simulator.cpp:45
A general case Vertex for optimization.
void setMeasurement(const Plane3D &m)
Vector3d sample_noise_from_plane(const Vector3d &cov)
const EstimateType & estimate() const
return the current estimate of the vertex
Definition: base_vertex.h:99
3D pose Vertex, represented as an Isometry3D
Definition: vertex_se3.h:50
OptimizableGraph::Vertex * vertex()
virtual bool addEdge(HyperGraph::Edge *e)

Member Data Documentation

Vector3d PlaneSensor::_nplane

Definition at line 249 of file simulator_3d_plane.cpp.

Referenced by main().

VertexSE3* PlaneSensor::_offsetVertex

Definition at line 248 of file simulator_3d_plane.cpp.

Referenced by main().


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