g2o
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
g2o::SensorOdometry2D Class Reference

#include <sensor_odometry2d.h>

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

Public Member Functions

 SensorOdometry2D (const std::string &name_)
 
virtual void sense ()
 
virtual void addNoise (EdgeType *e)
 
- Public Member Functions inherited from g2o::BinarySensor< Robot2D, EdgeSE2, WorldObjectSE2 >
 BinarySensor (const std::string &name)
 
void setInformation (const InformationType &information_)
 
const InformationTypeinformation ()
 
- Public Member Functions inherited from g2o::BaseSensor
 BaseSensor (const std::string &name_)
 
BaseRobotrobot ()
 
void setRobot (BaseRobot *robot_)
 
Worldworld () const
 
OptimizableGraphgraph () const
 
const std::vector< Parameter * > & parameters ()
 
virtual void addParameters ()
 

Public Attributes

EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef Robot2D::PoseObject PoseObject
 
- Public Attributes inherited from g2o::BinarySensor< Robot2D, EdgeSE2, WorldObjectSE2 >
 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
 

Additional Inherited Members

- Public Types inherited from g2o::BinarySensor< Robot2D, EdgeSE2, WorldObjectSE2 >
typedef Robot2D RobotType
 
typedef RobotType::PoseObject PoseObject
 
typedef RobotType::TrajectoryType TrajectoryType
 
typedef RobotType::PoseObject::VertexType PoseVertexType
 
typedef EdgeSE2 EdgeType
 
typedef WorldObjectSE2 WorldObjectType
 
typedef WorldObjectType::VertexType VertexType
 
typedef EdgeType::InformationType InformationType
 
- Protected Member Functions inherited from g2o::BinarySensor< Robot2D, EdgeSE2, WorldObjectSE2 >
EdgeTypemkEdge (WorldObjectType *object)
 
virtual void addNoise (EdgeType *)
 
- Protected Attributes inherited from g2o::BinarySensor< Robot2D, EdgeSE2, WorldObjectSE2 >
PoseObject_robotPoseObject
 
InformationType _information
 
GaussianSampler< typename EdgeType::ErrorVector, InformationType_sampler
 
- Protected Attributes inherited from g2o::BaseSensor
std::string _name
 
std::vector< Parameter * > _parameters
 
BaseRobot_robot
 

Detailed Description

Definition at line 34 of file sensor_odometry2d.h.

Constructor & Destructor Documentation

◆ SensorOdometry2D()

g2o::SensorOdometry2D::SensorOdometry2D ( const std::string &  name_)

Definition at line 36 of file sensor_odometry2d.cpp.

37 : BinarySensor<Robot2D, EdgeSE2, WorldObjectSE2>(name_) {}

Member Function Documentation

◆ addNoise()

void g2o::SensorOdometry2D::addNoise ( EdgeType e)
virtual

Definition at line 69 of file sensor_odometry2d.cpp.

69 {
72 n.fromVector(noise);
73 e->setMeasurement(e->measurement() * n);
74 e->setInformation(information());
75}
internal::BaseEdgeTraits< D >::ErrorVector ErrorVector
Definition base_edge.h:90
GaussianSampler< typename EdgeType::ErrorVector, InformationType > _sampler
Definition simulator.h:298
SampleType generateSample()
return a sample of the Gaussian distribution
Definition sampler.h:63

References g2o::BinarySensor< Robot2D, EdgeSE2, WorldObjectSE2 >::_sampler, g2o::GaussianSampler< SampleType, CovarianceType >::generateSample(), and g2o::BinarySensor< Robot2D, EdgeSE2, WorldObjectSE2 >::information().

Referenced by sense().

◆ sense()

void g2o::SensorOdometry2D::sense ( )
virtual

Reimplemented from g2o::BinarySensor< Robot2D, EdgeSE2, WorldObjectSE2 >.

Definition at line 39 of file sensor_odometry2d.cpp.

39 {
40 if (!robot()) return;
41
42 RobotType* r = dynamic_cast<RobotType*>(robot());
43 if (!r) return;
44
45 PoseObject *pprev = 0, *pcurr = 0;
46 std::list<PoseObject*>::reverse_iterator it = r->trajectory().rbegin();
47 if (it != r->trajectory().rend()) {
48 pcurr = *it;
49 ++it;
50 }
51 if (it != r->trajectory().rend()) {
52 pprev = *it;
53 ++it;
54 }
55 if (!(pcurr && pprev)) {
56 cerr << __PRETTY_FUNCTION__ << ": fatal, trajectory empty" << endl;
57 return;
58 }
59 _robotPoseObject = pprev;
60 EdgeType* e = mkEdge(pcurr);
61 if (e) {
62 e->setMeasurementFromState();
63 addNoise(e);
64 if (graph()) graph()->addEdge(e);
65 }
66 _robotPoseObject = pcurr;
67}
OptimizableGraph * graph() const
Definition simulator.cpp:76
BaseRobot * robot()
Definition simulator.h:162
EdgeType * mkEdge(WorldObjectType *object)
Definition simulator.h:290
virtual void addNoise(EdgeType *e)
EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef Robot2D::PoseObject PoseObject
#define __PRETTY_FUNCTION__
Definition macros.h:90
virtual bool addEdge(HyperGraph::Edge *e)

References __PRETTY_FUNCTION__, g2o::BinarySensor< Robot2D, EdgeSE2, WorldObjectSE2 >::_robotPoseObject, g2o::OptimizableGraph::addEdge(), addNoise(), g2o::BaseSensor::graph(), g2o::BinarySensor< Robot2D, EdgeSE2, WorldObjectSE2 >::mkEdge(), and g2o::BaseSensor::robot().

Member Data Documentation

◆ PoseObject

Definition at line 38 of file sensor_odometry2d.h.


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