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

#include <sensor_pointxyz.h>

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

Public Member Functions

 SensorPointXYZ (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, EdgeSE3PointXYZ, 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, EdgeSE3PointXYZ, WorldObjectTrackXYZ >
 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
 

Protected Member Functions

bool isVisible (WorldObjectType *to)
 
- Protected Member Functions inherited from g2o::BinarySensor< Robot3D, EdgeSE3PointXYZ, 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, EdgeSE3PointXYZ, 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, EdgeSE3PointXYZ, WorldObjectTrackXYZ >
typedef Robot3D RobotType
 
typedef RobotType::PoseObject PoseObject
 
typedef RobotType::TrajectoryType TrajectoryType
 
typedef RobotType::PoseObject::VertexType PoseVertexType
 
typedef EdgeSE3PointXYZ EdgeType
 
typedef WorldObjectTrackXYZ WorldObjectType
 
typedef WorldObjectType::VertexType VertexType
 
typedef EdgeType::InformationType InformationType
 

Detailed Description

Definition at line 35 of file sensor_pointxyz.h.

Constructor & Destructor Documentation

◆ SensorPointXYZ()

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

Definition at line 36 of file sensor_pointxyz.cpp.

37 : BinarySensor<Robot3D, EdgeSE3PointXYZ, WorldObjectTrackXYZ>(name_) {
38 _offsetParam = 0;
39 _information.setIdentity();
40 _information *= 1000;
41 _information(2, 2) = 10;
43}
void setInformation(const InformationType &information_)
Definition simulator.h:251
ParameterSE3Offset * _offsetParam

References g2o::BinarySensor< Robot3D, EdgeSE3PointXYZ, WorldObjectTrackXYZ >::_information, _offsetParam, and g2o::BinarySensor< Robot3D, EdgeSE3PointXYZ, WorldObjectTrackXYZ >::setInformation().

Member Function Documentation

◆ addNoise()

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

Definition at line 68 of file sensor_pointxyz.cpp.

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

Referenced by sense().

◆ addParameters()

void g2o::SensorPointXYZ::addParameters ( )
virtual

Reimplemented from g2o::BaseSensor.

Definition at line 62 of file sensor_pointxyz.cpp.

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

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

◆ isVisible()

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

Definition at line 45 of file sensor_pointxyz.cpp.

45 {
46 if (!_robotPoseObject) return false;
47 assert(to && to->vertex());
48 VertexType* v = to->vertex();
49 VertexType::EstimateType pose = v->estimate();
50 VertexType::EstimateType delta = _sensorPose.inverse() * pose;
51 Vector3d translation = delta;
52 double range2 = translation.squaredNorm();
53 if (range2 > _maxRange2) return false;
54 if (range2 < _minRange2) return false;
55 translation.normalize();
56 // the cameras have the z in front
57 double bearing = acos(translation.z());
58 if (fabs(bearing) > _fov) return false;
59 return true;
60}
RobotPoseType _sensorPose
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, EdgeSE3PointXYZ, WorldObjectTrackXYZ >::_robotPoseObject, and _sensorPose.

Referenced by sense().

◆ offsetParam()

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

Definition at line 44 of file sensor_pointxyz.h.

44{ return _offsetParam; };

Referenced by main().

◆ sense()

void g2o::SensorPointXYZ::sense ( )
virtual

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

Definition at line 74 of file sensor_pointxyz.cpp.

74 {
75 if (!_offsetParam) {
76 return;
77 }
79 RobotType* r = dynamic_cast<RobotType*>(robot());
80 std::list<PoseObject*>::reverse_iterator it = r->trajectory().rbegin();
81 int count = 0;
82 while (it != r->trajectory().rend() && count < 1) {
84 ++it;
85 count++;
86 }
87 if (!_robotPoseObject) return;
88 _sensorPose = _robotPoseObject->vertex()->estimate() * _offsetParam->offset();
89 for (std::set<BaseWorldObject*>::iterator it = world()->objects().begin();
90 it != world()->objects().end(); ++it) {
91 WorldObjectType* o = dynamic_cast<WorldObjectType*>(*it);
92 if (o && isVisible(o)) {
93 EdgeType* e = mkEdge(o);
94 if (e && graph()) {
95 e->setParameterId(0, _offsetParam->id());
96 graph()->addEdge(e);
97 e->setMeasurementFromState();
98 addNoise(e);
99 }
100 }
101 }
102}
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)
void addNoise(EdgeType *e)
std::set< BaseWorldObject * > & objects()
Definition simulator.h:115
virtual bool addEdge(HyperGraph::Edge *e)

References _offsetParam, g2o::BinarySensor< Robot3D, EdgeSE3PointXYZ, WorldObjectTrackXYZ >::_robotPoseObject, _sensorPose, g2o::OptimizableGraph::addEdge(), addNoise(), g2o::BaseSensor::graph(), g2o::Parameter::id(), isVisible(), g2o::BinarySensor< Robot3D, EdgeSE3PointXYZ, WorldObjectTrackXYZ >::mkEdge(), g2o::World::objects(), g2o::ParameterSE3Offset::offset(), g2o::BaseSensor::robot(), and g2o::BaseSensor::world().

Member Data Documentation

◆ _offsetParam

ParameterSE3Offset* g2o::SensorPointXYZ::_offsetParam
protected

Definition at line 50 of file sensor_pointxyz.h.

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

◆ _sensorPose

RobotPoseType g2o::SensorPointXYZ::_sensorPose
protected

Definition at line 49 of file sensor_pointxyz.h.

Referenced by isVisible(), and sense().

◆ RobotPoseType

EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef PoseVertexType::EstimateType g2o::SensorPointXYZ::RobotPoseType

Definition at line 40 of file sensor_pointxyz.h.


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