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

#include <sensor_pose3d_offset.h>

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

Public Member Functions

EIGEN_MAKE_ALIGNED_OPERATOR_NEW SensorPose3DOffset (const std::string &name_)
 
virtual void sense ()
 
int stepsToIgnore () const
 
void setStepsToIgnore (int stepsToIgnore_)
 
void addNoise (EdgeType *e)
 
virtual void addParameters ()
 
ParameterSE3OffsetoffsetParam1 ()
 
ParameterSE3OffsetoffsetParam2 ()
 
- Public Member Functions inherited from g2o::PointSensorParameters
 PointSensorParameters ()
 
double maxRange () const
 
void setMaxRange (double maxRange_)
 
double minRange () const
 
void setMinRange (double minRange_)
 
double fov () const
 
void setFov (double fov_)
 
double maxAngularDifference () const
 
void setMaxAngularDifference (double angularDifference)
 
- Public Member Functions inherited from g2o::BinarySensor< Robot3D, EdgeSE3Offset, WorldObjectSE3 >
 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 ()
 

Protected Member Functions

bool isVisible (WorldObjectType *to)
 
- Protected Member Functions inherited from g2o::BinarySensor< Robot3D, EdgeSE3Offset, WorldObjectSE3 >
EdgeTypemkEdge (WorldObjectType *object)
 
virtual void addNoise (EdgeType *)
 

Protected Attributes

int _stepsToIgnore
 
ParameterSE3Offset_offsetParam1
 
ParameterSE3Offset_offsetParam2
 
std::set< PoseObject * > _posesToIgnore
 
- Protected Attributes inherited from g2o::PointSensorParameters
double _maxRange2
 
double _minRange2
 
double _fov
 
double _maxAngularDifference
 
- Protected Attributes inherited from g2o::BinarySensor< Robot3D, EdgeSE3Offset, WorldObjectSE3 >
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
 

Additional Inherited Members

- Public Types inherited from g2o::BinarySensor< Robot3D, EdgeSE3Offset, WorldObjectSE3 >
typedef Robot3D RobotType
 
typedef RobotType::PoseObject PoseObject
 
typedef RobotType::TrajectoryType TrajectoryType
 
typedef RobotType::PoseObject::VertexType PoseVertexType
 
typedef EdgeSE3Offset EdgeType
 
typedef WorldObjectSE3 WorldObjectType
 
typedef WorldObjectType::VertexType VertexType
 
typedef EdgeType::InformationType InformationType
 
- Public Attributes inherited from g2o::BinarySensor< Robot3D, EdgeSE3Offset, WorldObjectSE3 >
 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
 

Detailed Description

Definition at line 34 of file sensor_pose3d_offset.h.

Constructor & Destructor Documentation

◆ SensorPose3DOffset()

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

Member Function Documentation

◆ addNoise()

void g2o::SensorPose3DOffset::addNoise ( EdgeType e)

Definition at line 57 of file sensor_pose3d_offset.cpp.

57 {
60 e->setMeasurement(e->measurement() * n);
61 e->setInformation(information());
62}
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
Isometry3 fromVectorMQT(const Vector6 &v)

References g2o::BinarySensor< Robot3D, EdgeSE3Offset, WorldObjectSE3 >::_sampler, g2o::internal::fromVectorMQT(), g2o::GaussianSampler< SampleType, CovarianceType >::generateSample(), and g2o::BinarySensor< Robot3D, EdgeSE3Offset, WorldObjectSE3 >::information().

Referenced by sense().

◆ addParameters()

void g2o::SensorPose3DOffset::addParameters ( )
virtual

Reimplemented from g2o::BaseSensor.

Definition at line 49 of file sensor_pose3d_offset.cpp.

49 {
50 if (!_offsetParam1) _offsetParam1 = new ParameterSE3Offset();
51 if (!_offsetParam2) _offsetParam2 = new ParameterSE3Offset();
52 assert(world());
55}
World * world() const
Definition simulator.cpp:71
bool addParameter(Parameter *p)

References _offsetParam1, _offsetParam2, g2o::World::addParameter(), and g2o::BaseSensor::world().

◆ isVisible()

bool g2o::SensorPose3DOffset::isVisible ( WorldObjectType to)
protected

Definition at line 64 of file sensor_pose3d_offset.cpp.

64 {
65 if (!_robotPoseObject) return false;
66 if (_posesToIgnore.find(to) != _posesToIgnore.end()) return false;
67
68 assert(to && to->vertex());
69 VertexType* v = to->vertex();
70 VertexType::EstimateType pose = v->estimate();
71 VertexType::EstimateType delta =
72 _robotPoseObject->vertex()->estimate().inverse() * pose;
73 Vector3d translation = delta.translation();
74 double range2 = translation.squaredNorm();
75 if (range2 > _maxRange2) return false;
76 if (range2 < _minRange2) return false;
77 translation.normalize();
78 double bearing = acos(translation.x());
79 if (fabs(bearing) > _fov) return false;
80 AngleAxisd a(delta.rotation());
81 if (fabs(a.angle()) > _maxAngularDifference) return false;
82 return true;
83}
std::set< PoseObject * > _posesToIgnore
Jet< T, N > acos(const Jet< T, N > &f)
Definition jet.h:458

References g2o::PointSensorParameters::_fov, g2o::PointSensorParameters::_maxAngularDifference, g2o::PointSensorParameters::_maxRange2, g2o::PointSensorParameters::_minRange2, _posesToIgnore, and g2o::BinarySensor< Robot3D, EdgeSE3Offset, WorldObjectSE3 >::_robotPoseObject.

Referenced by sense().

◆ offsetParam1()

ParameterSE3Offset * g2o::SensorPose3DOffset::offsetParam1 ( )
inline

Definition at line 45 of file sensor_pose3d_offset.h.

45{ return _offsetParam1; };

References _offsetParam1.

Referenced by main().

◆ offsetParam2()

ParameterSE3Offset * g2o::SensorPose3DOffset::offsetParam2 ( )
inline

Definition at line 46 of file sensor_pose3d_offset.h.

46{ return _offsetParam2; };

References _offsetParam2.

Referenced by main().

◆ sense()

void g2o::SensorPose3DOffset::sense ( )
virtual

Reimplemented from g2o::BinarySensor< Robot3D, EdgeSE3Offset, WorldObjectSE3 >.

Definition at line 85 of file sensor_pose3d_offset.cpp.

85 {
87 RobotType* r = dynamic_cast<RobotType*>(robot());
88 std::list<PoseObject*>::reverse_iterator it = r->trajectory().rbegin();
89 _posesToIgnore.clear();
90 int count = 0;
91 while (it != r->trajectory().rend() && count < _stepsToIgnore) {
93 _posesToIgnore.insert(*it);
94 ++it;
95 count++;
96 }
97 for (std::set<BaseWorldObject*>::iterator it = world()->objects().begin();
98 it != world()->objects().end(); ++it) {
99 WorldObjectType* o = dynamic_cast<WorldObjectType*>(*it);
100 if (o && isVisible(o)) {
101 EdgeType* e = mkEdge(o);
102 if (e && graph()) {
103 e->setParameterId(0, _offsetParam1->id());
104 e->setParameterId(1, _offsetParam2->id());
105 graph()->addEdge(e);
106 e->setMeasurementFromState();
107 addNoise(e);
108 }
109 }
110 }
111}
OptimizableGraph * graph() const
Definition simulator.cpp:76
BaseRobot * robot()
Definition simulator.h:162
int id() const
Definition parameter.h:44
bool isVisible(WorldObjectType *to)
std::set< BaseWorldObject * > & objects()
Definition simulator.h:115
virtual bool addEdge(HyperGraph::Edge *e)

References _offsetParam1, _offsetParam2, _posesToIgnore, g2o::BinarySensor< Robot3D, EdgeSE3Offset, WorldObjectSE3 >::_robotPoseObject, _stepsToIgnore, g2o::OptimizableGraph::addEdge(), addNoise(), g2o::BaseSensor::graph(), g2o::Parameter::id(), isVisible(), g2o::BinarySensor< Robot3D, EdgeSE3Offset, WorldObjectSE3 >::mkEdge(), g2o::World::objects(), g2o::BaseSensor::robot(), and g2o::BaseSensor::world().

◆ setStepsToIgnore()

void g2o::SensorPose3DOffset::setStepsToIgnore ( int  stepsToIgnore_)
inline

Definition at line 42 of file sensor_pose3d_offset.h.

42{ _stepsToIgnore = stepsToIgnore_; }

References _stepsToIgnore.

◆ stepsToIgnore()

int g2o::SensorPose3DOffset::stepsToIgnore ( ) const
inline

Definition at line 41 of file sensor_pose3d_offset.h.

41{ return _stepsToIgnore; }

References _stepsToIgnore.

Member Data Documentation

◆ _offsetParam1

ParameterSE3Offset* g2o::SensorPose3DOffset::_offsetParam1
protected

Definition at line 51 of file sensor_pose3d_offset.h.

Referenced by addParameters(), offsetParam1(), sense(), and SensorPose3DOffset().

◆ _offsetParam2

ParameterSE3Offset * g2o::SensorPose3DOffset::_offsetParam2
protected

Definition at line 51 of file sensor_pose3d_offset.h.

Referenced by addParameters(), offsetParam2(), sense(), and SensorPose3DOffset().

◆ _posesToIgnore

std::set<PoseObject*> g2o::SensorPose3DOffset::_posesToIgnore
protected

Definition at line 54 of file sensor_pose3d_offset.h.

Referenced by isVisible(), and sense().

◆ _stepsToIgnore

int g2o::SensorPose3DOffset::_stepsToIgnore
protected

Definition at line 50 of file sensor_pose3d_offset.h.

Referenced by sense(), SensorPose3DOffset(), setStepsToIgnore(), and stepsToIgnore().


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