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

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

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

Definition at line 35 of file sensor_pose3d.cpp.

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

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

Member Function Documentation

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

Reimplemented from g2o::BinarySensor< Robot3D, EdgeSE3, WorldObjectSE3 >.

Definition at line 45 of file sensor_pose3d.cpp.

References g2o::BinarySensor< Robot3D, EdgeSE3, WorldObjectSE3 >::_sampler, g2o::internal::fromVectorMQT(), g2o::GaussianSampler< SampleType, CovarianceType >::generateSample(), g2o::BinarySensor< Robot3D, EdgeSE3, WorldObjectSE3 >::information(), g2o::BaseEdge< D, E >::measurement(), g2o::BaseEdge< D, E >::setInformation(), and g2o::EdgeSE3::setMeasurement().

Referenced by sense().

45  {
48  e->setMeasurement(e->measurement()*n);
49  e->setInformation(information());
50  }
GaussianSampler< typename EdgeType::ErrorVector, InformationType > _sampler
Definition: simulator.h:271
BaseEdge< D, Isometry3D >::ErrorVector ErrorVector
SampleType generateSample()
Definition: sampler.h:67
BaseEdge< D, Isometry3D >::Measurement Measurement
Isometry3D fromVectorMQT(const Vector6d &v)
bool g2o::SensorPose3D::isVisible ( SensorPose3D::WorldObjectType to)
protected

Definition at line 52 of file sensor_pose3d.cpp.

References g2o::PointSensorParameters::_fov, g2o::PointSensorParameters::_maxAngularDifference, g2o::PointSensorParameters::_maxRange2, g2o::PointSensorParameters::_minRange2, _posesToIgnore, g2o::BinarySensor< Robot3D, EdgeSE3, WorldObjectSE3 >::_robotPoseObject, and g2o::WorldObject< VertexType_ >::vertex().

Referenced by sense().

52  {
53  if (! _robotPoseObject)
54  return false;
55  if (_posesToIgnore.find(to)!=_posesToIgnore.end())
56  return false;
57 
58  assert(to && to->vertex());
59  VertexType* v=to->vertex();
60  VertexType::EstimateType pose=v->estimate();
61  VertexType::EstimateType delta = _robotPoseObject->vertex()->estimate().inverse()*pose;
62  Vector3d translation=delta.translation();
63  double range2=translation.squaredNorm();
64  if (range2>_maxRange2)
65  return false;
66  if (range2<_minRange2)
67  return false;
68  translation.normalize();
69  double bearing=acos(translation.x());
70  if (fabs(bearing)>_fov)
71  return false;
72  AngleAxisd a(delta.rotation());
73  if (fabs(a.angle())>_maxAngularDifference)
74  return false;
75  return true;
76  }
std::set< PoseObject * > _posesToIgnore
Definition: sensor_pose3d.h:49
void g2o::SensorPose3D::sense ( )
virtual

Reimplemented from g2o::BinarySensor< Robot3D, EdgeSE3, WorldObjectSE3 >.

Definition at line 79 of file sensor_pose3d.cpp.

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

79  {
81  RobotType* r= dynamic_cast<RobotType*>(robot());
82  std::list<PoseObject*>::reverse_iterator it=r->trajectory().rbegin();
83  _posesToIgnore.clear();
84  int count = 0;
85  while (it!=r->trajectory().rend() && count < _stepsToIgnore){
86  if (!_robotPoseObject)
87  _robotPoseObject = *it;
88  _posesToIgnore.insert(*it);
89  it++;
90  count++;
91  }
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  if (e && graph()) {
98  graph()->addEdge(e);
99  e->setMeasurementFromState();
100  addNoise(e);
101  }
102  }
103  }
104  }
bool isVisible(WorldObjectType *to)
World * world()
Definition: simulator.cpp:69
void addNoise(EdgeType *e)
TrajectoryType & trajectory()
Definition: simulator.h:119
OptimizableGraph * graph()
Definition: simulator.cpp:75
BaseRobot * robot()
Definition: simulator.h:129
std::set< BaseWorldObject * > & objects()
Definition: simulator.h:284
std::set< PoseObject * > _posesToIgnore
Definition: sensor_pose3d.h:49
virtual bool addEdge(HyperGraph::Edge *e)
EdgeType * mkEdge(WorldObjectType *object)
Definition: simulator.h:263
void g2o::SensorPose3D::setStepsToIgnore ( int  stepsToIgnore_)
inline

Definition at line 41 of file sensor_pose3d.h.

41 {_stepsToIgnore = stepsToIgnore_;}
int g2o::SensorPose3D::stepsToIgnore ( ) const
inline

Definition at line 40 of file sensor_pose3d.h.

40 {return _stepsToIgnore;}

Member Data Documentation

std::set<PoseObject*> g2o::SensorPose3D::_posesToIgnore
protected

Definition at line 49 of file sensor_pose3d.h.

Referenced by isVisible(), and sense().

int g2o::SensorPose3D::_stepsToIgnore
protected

Definition at line 47 of file sensor_pose3d.h.

Referenced by sense(), and SensorPose3D().


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