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

#include <sensor_pose3d.h>

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

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 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 ()
 

Protected Member Functions

bool isVisible (WorldObjectType *to)
 
- Protected Member Functions inherited from g2o::BinarySensor< Robot3D, EdgeSE3, WorldObjectSE3 >
EdgeTypemkEdge (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()

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

Definition at line 37 of file sensor_pose3d.cpp.

38 : BinarySensor<Robot3D, EdgeSE3, WorldObjectSE3>(name_) {
39 _stepsToIgnore = 10;
40 _information.setIdentity();
41 _information *= 100;
42 _information(3, 3) = 10000;
43 _information(4, 4) = 10000;
44 _information(5, 5) = 1000;
46}
void setInformation(const InformationType &information_)
Definition simulator.h:251

References g2o::BinarySensor< Robot3D, EdgeSE3, WorldObjectSE3 >::_information, _stepsToIgnore, and g2o::BinarySensor< Robot3D, EdgeSE3, WorldObjectSE3 >::setInformation().

Member Function Documentation

◆ addNoise()

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

Definition at line 48 of file sensor_pose3d.cpp.

48 {
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
SampleType generateSample()
return a sample of the Gaussian distribution
Definition sampler.h:63
Isometry3 fromVectorMQT(const Vector6 &v)

References g2o::BinarySensor< Robot3D, EdgeSE3, WorldObjectSE3 >::_sampler, g2o::internal::fromVectorMQT(), g2o::GaussianSampler< SampleType, CovarianceType >::generateSample(), 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();
62 VertexType::EstimateType delta =
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, and g2o::BinarySensor< Robot3D, EdgeSE3, WorldObjectSE3 >::_robotPoseObject.

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(), and g2o::BaseSensor::world().

◆ setStepsToIgnore()

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

Definition at line 43 of file sensor_pose3d.h.

43{ _stepsToIgnore = stepsToIgnore_; }

◆ stepsToIgnore()

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

Definition at line 42 of file sensor_pose3d.h.

42{ return _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(), and SensorPose3D().


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