g2o
Loading...
Searching...
No Matches
g2o::SensorPose3D Class Reference

#include <sensor_pose3d.h>

Inheritance diagram for g2o::SensorPose3D:
Collaboration diagram for g2o::SensorPose3D:

Public Member Functions

EIGEN_MAKE_ALIGNED_OPERATOR_NEW SensorPose3D (const std::string &name_)
virtual void sense ()
int stepsToIgnore () const
void setStepsToIgnore (int stepsToIgnore_)
void addNoise (EdgeType *e)
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, EdgeSE3, WorldObjectSE3 >
 BinarySensor (const std::string &name)
void setInformation (const InformationType &information_)
const InformationType & information ()
Public Member Functions inherited from g2o::BaseSensor
 BaseSensor (const std::string &name_)
BaseRobot * robot ()
void setRobot (BaseRobot *robot_)
World * world () const
OptimizableGraph * graph () const
const std::vector< Parameter * > & parameters ()
virtual void addParameters ()

Protected Member Functions

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

Protected Attributes

int _stepsToIgnore
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, EdgeSE3, 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, EdgeSE3, WorldObjectSE3 >
typedef Robot3D RobotType
typedef RobotType::PoseObject PoseObject
typedef RobotType::TrajectoryType TrajectoryType
typedef RobotType::PoseObject::VertexType PoseVertexType
typedef EdgeSE3 EdgeType
typedef WorldObjectSE3 WorldObjectType
typedef WorldObjectType::VertexType VertexType
typedef EdgeType::InformationType InformationType
Public Attributes inherited from g2o::BinarySensor< Robot3D, EdgeSE3, WorldObjectSE3 >
 EIGEN_MAKE_ALIGNED_OPERATOR_NEW

Detailed Description

Definition at line 35 of file sensor_pose3d.h.

Constructor & Destructor Documentation

◆ SensorPose3D()

Member Function Documentation

◆ addNoise()

void g2o::SensorPose3D::addNoise ( EdgeType * e)

Definition at line 48 of file sensor_pose3d.cpp.

48 {
49 EdgeType::ErrorVector noise = _sampler.generateSample();
51 e->setMeasurement(e->measurement() * n);
52 e->setInformation(information());
53}
internal::BaseEdgeTraits< D >::ErrorVector ErrorVector
Definition base_edge.h:90
GaussianSampler< typename EdgeType::ErrorVector, InformationType > _sampler
Definition simulator.h:298
Isometry3 fromVectorMQT(const Vector6 &v)

References g2o::BinarySensor< Robot3D, EdgeSE3, WorldObjectSE3 >::_sampler, g2o::internal::fromVectorMQT(), and g2o::BinarySensor< Robot3D, EdgeSE3, WorldObjectSE3 >::information().

Referenced by sense().

◆ isVisible()

bool g2o::SensorPose3D::isVisible ( WorldObjectType * to)
protected

Definition at line 55 of file sensor_pose3d.cpp.

55 {
56 if (!_robotPoseObject) return false;
57 if (_posesToIgnore.find(to) != _posesToIgnore.end()) return false;
58
59 assert(to && to->vertex());
60 VertexType* v = to->vertex();
61 VertexType::EstimateType pose = v->estimate();
63 _robotPoseObject->vertex()->estimate().inverse() * pose;
64 Vector3d translation = delta.translation();
65 double range2 = translation.squaredNorm();
66 if (range2 > _maxRange2) return false;
67 if (range2 < _minRange2) return false;
68 translation.normalize();
69 double bearing = acos(translation.x());
70 if (fabs(bearing) > _fov) return false;
71 AngleAxisd a(delta.rotation());
72 if (fabs(a.angle()) > _maxAngularDifference) return false;
73 return true;
74}
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, g2o::BinarySensor< Robot3D, EdgeSE3, WorldObjectSE3 >::_robotPoseObject, and g2o::BaseVertex< D, T >::estimate().

Referenced by sense().

◆ sense()

void g2o::SensorPose3D::sense ( )
virtual

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

Definition at line 76 of file sensor_pose3d.cpp.

76 {
78 RobotType* r = dynamic_cast<RobotType*>(robot());
79 std::list<PoseObject*>::reverse_iterator it = r->trajectory().rbegin();
80 _posesToIgnore.clear();
81 int count = 0;
82 while (it != r->trajectory().rend() && count < _stepsToIgnore) {
84 _posesToIgnore.insert(*it);
85 ++it;
86 count++;
87 }
88 for (std::set<BaseWorldObject*>::iterator it = world()->objects().begin();
89 it != world()->objects().end(); ++it) {
90 WorldObjectType* o = dynamic_cast<WorldObjectType*>(*it);
91 if (o && isVisible(o)) {
92 EdgeType* e = mkEdge(o);
93 if (e && graph()) {
94 graph()->addEdge(e);
95 e->setMeasurementFromState();
96 addNoise(e);
97 }
98 }
99 }
100}
OptimizableGraph * graph() const
Definition simulator.cpp:76
World * world() const
Definition simulator.cpp:71
BaseRobot * robot()
Definition simulator.h:162
EdgeType * mkEdge(WorldObjectType *object)
Definition simulator.h:290
void addNoise(EdgeType *e)
bool isVisible(WorldObjectType *to)
std::set< BaseWorldObject * > & objects()
Definition simulator.h:115
virtual bool addEdge(HyperGraph::Edge *e)

References _posesToIgnore, g2o::BinarySensor< Robot3D, EdgeSE3, WorldObjectSE3 >::_robotPoseObject, _stepsToIgnore, g2o::OptimizableGraph::addEdge(), addNoise(), g2o::BaseSensor::graph(), isVisible(), g2o::BinarySensor< Robot3D, EdgeSE3, WorldObjectSE3 >::mkEdge(), g2o::World::objects(), g2o::BaseSensor::robot(), g2o::Robot< RobotPoseObject >::trajectory(), and g2o::BaseSensor::world().

◆ setStepsToIgnore()

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

Definition at line 43 of file sensor_pose3d.h.

43{ _stepsToIgnore = stepsToIgnore_; }

References _stepsToIgnore.

◆ stepsToIgnore()

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

Definition at line 42 of file sensor_pose3d.h.

42{ return _stepsToIgnore; }

References _stepsToIgnore.

Member Data Documentation

◆ _posesToIgnore

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

Definition at line 50 of file sensor_pose3d.h.

Referenced by isVisible(), and sense().

◆ _stepsToIgnore

int g2o::SensorPose3D::_stepsToIgnore
protected

Definition at line 48 of file sensor_pose3d.h.

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


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