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

#include <sensor_pointxyz_depth.h>

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

Public Member Functions

 SensorPointXYZDepth (const std::string &name_)
 
virtual void sense ()
 
virtual void addParameters ()
 
ParameterSE3OffsetoffsetParam ()
 
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, EdgeSE3PointXYZDepth, WorldObjectTrackXYZ >
 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 ()
 

Public Attributes

EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef PoseVertexType::EstimateType RobotPoseType
 
- Public Attributes inherited from g2o::BinarySensor< Robot3D, EdgeSE3PointXYZDepth, WorldObjectTrackXYZ >
 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
 

Protected Member Functions

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

Protected Attributes

RobotPoseType _sensorPose
 
ParameterSE3Offset_offsetParam
 
- Protected Attributes inherited from g2o::PointSensorParameters
double _maxRange2
 
double _minRange2
 
double _fov
 
double _maxAngularDifference
 
- Protected Attributes inherited from g2o::BinarySensor< Robot3D, EdgeSE3PointXYZDepth, WorldObjectTrackXYZ >
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, EdgeSE3PointXYZDepth, WorldObjectTrackXYZ >
typedef Robot3D RobotType
 
typedef RobotType::PoseObject PoseObject
 
typedef RobotType::TrajectoryType TrajectoryType
 
typedef RobotType::PoseObject::VertexType PoseVertexType
 
typedef EdgeSE3PointXYZDepth EdgeType
 
typedef WorldObjectTrackXYZ WorldObjectType
 
typedef WorldObjectType::VertexType VertexType
 
typedef EdgeType::InformationType InformationType
 

Detailed Description

Definition at line 35 of file sensor_pointxyz_depth.h.

Constructor & Destructor Documentation

◆ SensorPointXYZDepth()

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

Member Function Documentation

◆ addNoise()

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

Definition at line 67 of file sensor_pointxyz_depth.cpp.

67 {
69 e->setMeasurement(e->measurement() + n);
70 e->setInformation(information());
71}
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< Robot3D, EdgeSE3PointXYZDepth, WorldObjectTrackXYZ >::_sampler, g2o::GaussianSampler< SampleType, CovarianceType >::generateSample(), and g2o::BinarySensor< Robot3D, EdgeSE3PointXYZDepth, WorldObjectTrackXYZ >::information().

Referenced by sense().

◆ addParameters()

void g2o::SensorPointXYZDepth::addParameters ( )
virtual

Reimplemented from g2o::BaseSensor.

Definition at line 61 of file sensor_pointxyz_depth.cpp.

61 {
62 if (!_offsetParam) _offsetParam = new ParameterCamera();
63 assert(world());
65}
World * world() const
Definition simulator.cpp:71
bool addParameter(Parameter *p)

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

◆ isVisible()

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

Definition at line 44 of file sensor_pointxyz_depth.cpp.

44 {
45 if (!_robotPoseObject) return false;
46 assert(to && to->vertex());
47 VertexType* v = to->vertex();
48 VertexType::EstimateType pose = v->estimate();
49 VertexType::EstimateType delta = _sensorPose.inverse() * pose;
50 Vector3d translation = delta;
51 double range2 = translation.squaredNorm();
52 if (range2 > _maxRange2) return false;
53 if (range2 < _minRange2) return false;
54 translation.normalize();
55 // the cameras have the z in front
56 double bearing = acos(translation.z());
57 if (fabs(bearing) > _fov) return false;
58 return true;
59}
Jet< T, N > acos(const Jet< T, N > &f)
Definition jet.h:458

References g2o::PointSensorParameters::_fov, g2o::PointSensorParameters::_maxRange2, g2o::PointSensorParameters::_minRange2, g2o::BinarySensor< Robot3D, EdgeSE3PointXYZDepth, WorldObjectTrackXYZ >::_robotPoseObject, and _sensorPose.

Referenced by sense().

◆ offsetParam()

ParameterSE3Offset * g2o::SensorPointXYZDepth::offsetParam ( )
inline

Definition at line 44 of file sensor_pointxyz_depth.h.

44{ return _offsetParam; };

Referenced by main().

◆ sense()

void g2o::SensorPointXYZDepth::sense ( )
virtual

Reimplemented from g2o::BinarySensor< Robot3D, EdgeSE3PointXYZDepth, WorldObjectTrackXYZ >.

Definition at line 73 of file sensor_pointxyz_depth.cpp.

73 {
74 if (!_offsetParam) return;
76 RobotType* r = dynamic_cast<RobotType*>(robot());
77 std::list<PoseObject*>::reverse_iterator it = r->trajectory().rbegin();
78 int count = 0;
79 while (it != r->trajectory().rend() && count < 1) {
81 ++it;
82 count++;
83 }
84 if (!_robotPoseObject) return;
85 _sensorPose = _robotPoseObject->vertex()->estimate() * _offsetParam->offset();
86 for (std::set<BaseWorldObject*>::iterator it = world()->objects().begin();
87 it != world()->objects().end(); ++it) {
88 WorldObjectType* o = dynamic_cast<WorldObjectType*>(*it);
89 if (o && isVisible(o)) {
90 EdgeType* e = mkEdge(o);
91 if (e && graph()) {
92 e->setParameterId(0, _offsetParam->id());
93 graph()->addEdge(e);
94 e->setMeasurementFromState();
95 addNoise(e);
96 }
97 }
98 }
99}
OptimizableGraph * graph() const
Definition simulator.cpp:76
BaseRobot * robot()
Definition simulator.h:162
const Isometry3 & offset() const
rotation of the offset as 3x3 rotation matrix
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 _offsetParam, g2o::BinarySensor< Robot3D, EdgeSE3PointXYZDepth, WorldObjectTrackXYZ >::_robotPoseObject, _sensorPose, g2o::OptimizableGraph::addEdge(), addNoise(), g2o::BaseSensor::graph(), g2o::Parameter::id(), isVisible(), g2o::BinarySensor< Robot3D, EdgeSE3PointXYZDepth, WorldObjectTrackXYZ >::mkEdge(), g2o::World::objects(), g2o::ParameterSE3Offset::offset(), g2o::BaseSensor::robot(), and g2o::BaseSensor::world().

Member Data Documentation

◆ _offsetParam

ParameterSE3Offset* g2o::SensorPointXYZDepth::_offsetParam
protected

Definition at line 50 of file sensor_pointxyz_depth.h.

Referenced by addParameters(), sense(), and SensorPointXYZDepth().

◆ _sensorPose

RobotPoseType g2o::SensorPointXYZDepth::_sensorPose
protected

Definition at line 49 of file sensor_pointxyz_depth.h.

Referenced by isVisible(), and sense().

◆ RobotPoseType

EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef PoseVertexType::EstimateType g2o::SensorPointXYZDepth::RobotPoseType

Definition at line 40 of file sensor_pointxyz_depth.h.


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