g2o
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
g2o::SensorPointXYZDisparity Class Reference

#include <sensor_pointxyz_disparity.h>

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

Public Member Functions

 SensorPointXYZDisparity (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, EdgeSE3PointXYZDisparity, 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 ()
 
OptimizableGraphgraph ()
 
std::vector< Parameter * > parameters ()
 

Public Attributes

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

Protected Member Functions

bool isVisible (WorldObjectType *to)
 
- Protected Member Functions inherited from g2o::BinarySensor< Robot3D, EdgeSE3PointXYZDisparity, WorldObjectTrackXYZ >
EdgeTypemkEdge (WorldObjectType *object)
 

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, EdgeSE3PointXYZDisparity, 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, EdgeSE3PointXYZDisparity, WorldObjectTrackXYZ >
typedef Robot3D RobotType
 
typedef RobotType::PoseObject PoseObject
 
typedef RobotType::TrajectoryType TrajectoryType
 
typedef RobotType::PoseObject::VertexType PoseVertexType
 
typedef EdgeSE3PointXYZDisparity EdgeType
 
typedef WorldObjectTrackXYZ WorldObjectType
 
typedef WorldObjectType::VertexType VertexType
 
typedef EdgeType::InformationType InformationType
 

Detailed Description

Definition at line 36 of file sensor_pointxyz_disparity.h.

Constructor & Destructor Documentation

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

Member Function Documentation

void g2o::SensorPointXYZDisparity::addNoise ( EdgeType e)
virtual
void g2o::SensorPointXYZDisparity::addParameters ( )
virtual

Reimplemented from g2o::BaseSensor.

Definition at line 62 of file sensor_pointxyz_disparity.cpp.

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

62  {
63  if (!_offsetParam)
64  _offsetParam = new ParameterCamera();
65  assert(world());
67  }
bool addParameter(Parameter *p)
Definition: simulator.cpp:102
World * world()
Definition: simulator.cpp:69
bool g2o::SensorPointXYZDisparity::isVisible ( SensorPointXYZDisparity::WorldObjectType to)
protected

Definition at line 41 of file sensor_pointxyz_disparity.cpp.

References g2o::PointSensorParameters::_fov, g2o::PointSensorParameters::_maxRange2, g2o::PointSensorParameters::_minRange2, g2o::BinarySensor< Robot3D, EdgeSE3PointXYZDisparity, WorldObjectTrackXYZ >::_robotPoseObject, _sensorPose, and g2o::WorldObject< VertexType_ >::vertex().

Referenced by sense().

41  {
42  if (! _robotPoseObject)
43  return false;
44  assert(to && to->vertex());
45  VertexType* v=to->vertex();
46  VertexType::EstimateType pose=v->estimate();
47  VertexType::EstimateType delta = _sensorPose.inverse()*pose;
48  Vector3d translation=delta;
49  double range2=translation.squaredNorm();
50  if (range2>_maxRange2)
51  return false;
52  if (range2<_minRange2)
53  return false;
54  translation.normalize();
55  // the cameras have the z in front
56  double bearing=acos(translation.z());
57  if (fabs(bearing)>_fov)
58  return false;
59  return true;
60  }
ParameterSE3Offset* g2o::SensorPointXYZDisparity::offsetParam ( )
inline

Definition at line 43 of file sensor_pointxyz_disparity.h.

Referenced by main().

43 {return _offsetParam;};
void g2o::SensorPointXYZDisparity::sense ( )
virtual

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

Definition at line 75 of file sensor_pointxyz_disparity.cpp.

References _offsetParam, g2o::BinarySensor< Robot3D, EdgeSE3PointXYZDisparity, WorldObjectTrackXYZ >::_robotPoseObject, _sensorPose, g2o::OptimizableGraph::addEdge(), addNoise(), g2o::BaseSensor::graph(), g2o::Parameter::id(), isVisible(), g2o::BinarySensor< Robot3D, EdgeSE3PointXYZDisparity, WorldObjectTrackXYZ >::mkEdge(), g2o::World::objects(), g2o::ParameterSE3Offset::offset(), g2o::BaseSensor::robot(), g2o::EdgeSE3PointXYZDisparity::setMeasurementFromState(), g2o::OptimizableGraph::Edge::setParameterId(), g2o::Robot< RobotPoseObject >::trajectory(), and g2o::BaseSensor::world().

75  {
76  if (! _offsetParam){
77  return;
78  }
80  RobotType* r= dynamic_cast<RobotType*>(robot());
81  std::list<PoseObject*>::reverse_iterator it=r->trajectory().rbegin();
82  int count = 0;
83  while (it!=r->trajectory().rend() && count < 1){
84  if (!_robotPoseObject)
85  _robotPoseObject = *it;
86  it++;
87  count++;
88  }
89  if (!_robotPoseObject)
90  return;
91  _sensorPose = _robotPoseObject->vertex()->estimate()*_offsetParam->offset();
92  for (std::set<BaseWorldObject*>::iterator it=world()->objects().begin();
93  it!=world()->objects().end(); it++){
94  WorldObjectType* o=dynamic_cast<WorldObjectType*>(*it);
95  if (o && isVisible(o)){
96  EdgeType* e=mkEdge(o);
97  e->setParameterId(0,_offsetParam->id());
98  if (e && graph()) {
99  graph()->addEdge(e);
100  e->setMeasurementFromState();
101  addNoise(e);
102  }
103  }
104  }
105  }
const Isometry3D & offset() const
rotation of the offset as 3x3 rotation matrix
World * world()
Definition: simulator.cpp:69
TrajectoryType & trajectory()
Definition: simulator.h:119
int id() const
Definition: parameter.h:45
OptimizableGraph * graph()
Definition: simulator.cpp:75
BaseRobot * robot()
Definition: simulator.h:129
std::set< BaseWorldObject * > & objects()
Definition: simulator.h:284
virtual bool addEdge(HyperGraph::Edge *e)

Member Data Documentation

ParameterSE3Offset* g2o::SensorPointXYZDisparity::_offsetParam
protected

Definition at line 48 of file sensor_pointxyz_disparity.h.

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

RobotPoseType g2o::SensorPointXYZDisparity::_sensorPose
protected

Definition at line 47 of file sensor_pointxyz_disparity.h.

Referenced by isVisible(), and sense().

EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef PoseVertexType::EstimateType g2o::SensorPointXYZDisparity::RobotPoseType

Definition at line 39 of file sensor_pointxyz_disparity.h.


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