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

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

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

Definition at line 34 of file sensor_pointxyz.cpp.

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

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

Member Function Documentation

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

Reimplemented from g2o::BaseSensor.

Definition at line 63 of file sensor_pointxyz.cpp.

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

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

Definition at line 42 of file sensor_pointxyz.cpp.

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

Referenced by sense().

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

Definition at line 42 of file sensor_pointxyz.h.

Referenced by main().

42 {return _offsetParam;};
ParameterSE3Offset * _offsetParam
void g2o::SensorPointXYZ::sense ( )
virtual

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

Definition at line 76 of file sensor_pointxyz.cpp.

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(), g2o::EdgeSE3PointXYZ::setMeasurementFromState(), g2o::OptimizableGraph::Edge::setParameterId(), g2o::Robot< RobotPoseObject >::trajectory(), and g2o::BaseSensor::world().

76  {
77  if (! _offsetParam){
78  return;
79  }
81  RobotType* r= dynamic_cast<RobotType*>(robot());
82  std::list<PoseObject*>::reverse_iterator it=r->trajectory().rbegin();
83  int count = 0;
84  while (it!=r->trajectory().rend() && count < 1){
85  if (!_robotPoseObject)
86  _robotPoseObject = *it;
87  it++;
88  count++;
89  }
90  if (!_robotPoseObject)
91  return;
92  _sensorPose = _robotPoseObject->vertex()->estimate()*_offsetParam->offset();
93  for (std::set<BaseWorldObject*>::iterator it=world()->objects().begin();
94  it!=world()->objects().end(); it++){
95  WorldObjectType* o=dynamic_cast<WorldObjectType*>(*it);
96  if (o && isVisible(o)){
97  EdgeType* e=mkEdge(o);
98  e->setParameterId(0,_offsetParam->id());
99  if (e && graph()) {
100  graph()->addEdge(e);
101  e->setMeasurementFromState();
102  addNoise(e);
103  }
104  }
105  }
106  }
void addNoise(EdgeType *e)
ParameterSE3Offset * _offsetParam
const Isometry3D & offset() const
rotation of the offset as 3x3 rotation matrix
RobotPoseType _sensorPose
bool isVisible(WorldObjectType *to)
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::SensorPointXYZ::_offsetParam
protected

Definition at line 47 of file sensor_pointxyz.h.

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

RobotPoseType g2o::SensorPointXYZ::_sensorPose
protected

Definition at line 46 of file sensor_pointxyz.h.

Referenced by isVisible(), and sense().

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

Definition at line 38 of file sensor_pointxyz.h.


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