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

#include <sensor_pose3d_offset.h>

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

Public Member Functions

EIGEN_MAKE_ALIGNED_OPERATOR_NEW SensorPose3DOffset (const std::string &name_)
 
virtual void sense ()
 
int stepsToIgnore () const
 
void setStepsToIgnore (int stepsToIgnore_)
 
void addNoise (EdgeType *e)
 
virtual void addParameters ()
 
ParameterSE3OffsetoffsetParam1 ()
 
ParameterSE3OffsetoffsetParam2 ()
 
- 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, EdgeSE3Offset, 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 ()
 

Protected Member Functions

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

Protected Attributes

int _stepsToIgnore
 
ParameterSE3Offset_offsetParam1
 
ParameterSE3Offset_offsetParam2
 
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, EdgeSE3Offset, 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, EdgeSE3Offset, WorldObjectSE3 >
typedef Robot3D RobotType
 
typedef RobotType::PoseObject PoseObject
 
typedef RobotType::TrajectoryType TrajectoryType
 
typedef RobotType::PoseObject::VertexType PoseVertexType
 
typedef EdgeSE3Offset EdgeType
 
typedef WorldObjectSE3 WorldObjectType
 
typedef WorldObjectType::VertexType VertexType
 
typedef EdgeType::InformationType InformationType
 
- Public Attributes inherited from g2o::BinarySensor< Robot3D, EdgeSE3Offset, WorldObjectSE3 >
 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
 

Detailed Description

Definition at line 34 of file sensor_pose3d_offset.h.

Constructor & Destructor Documentation

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

Definition at line 35 of file sensor_pose3d_offset.cpp.

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

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

Member Function Documentation

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

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

Definition at line 57 of file sensor_pose3d_offset.cpp.

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

Referenced by sense(), and setStepsToIgnore().

57  {
60  e->setMeasurement(e->measurement()*n);
61  e->setInformation(information());
62  }
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)
void g2o::SensorPose3DOffset::addParameters ( )
virtual

Reimplemented from g2o::BaseSensor.

Definition at line 47 of file sensor_pose3d_offset.cpp.

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

Referenced by setStepsToIgnore().

47  {
48  if (!_offsetParam1)
49  _offsetParam1 = new ParameterSE3Offset();
50  if (!_offsetParam2)
51  _offsetParam2 = new ParameterSE3Offset();
52  assert(world());
55  }
bool addParameter(Parameter *p)
Definition: simulator.cpp:102
ParameterSE3Offset * _offsetParam1
World * world()
Definition: simulator.cpp:69
ParameterSE3Offset * _offsetParam2
bool g2o::SensorPose3DOffset::isVisible ( SensorPose3DOffset::WorldObjectType to)
protected

Definition at line 64 of file sensor_pose3d_offset.cpp.

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

Referenced by offsetParam2(), and sense().

64  {
65  if (! _robotPoseObject)
66  return false;
67  if (_posesToIgnore.find(to)!=_posesToIgnore.end())
68  return false;
69 
70  assert(to && to->vertex());
71  VertexType* v=to->vertex();
72  VertexType::EstimateType pose=v->estimate();
73  VertexType::EstimateType delta = _robotPoseObject->vertex()->estimate().inverse()*pose;
74  Vector3d translation=delta.translation();
75  double range2=translation.squaredNorm();
76  if (range2>_maxRange2)
77  return false;
78  if (range2<_minRange2)
79  return false;
80  translation.normalize();
81  double bearing=acos(translation.x());
82  if (fabs(bearing)>_fov)
83  return false;
84  AngleAxisd a(delta.rotation());
85  if (fabs(a.angle())>_maxAngularDifference)
86  return false;
87  return true;
88  }
std::set< PoseObject * > _posesToIgnore
ParameterSE3Offset* g2o::SensorPose3DOffset::offsetParam1 ( )
inline

Definition at line 43 of file sensor_pose3d_offset.h.

References _offsetParam1.

Referenced by main().

43 {return _offsetParam1;};
ParameterSE3Offset * _offsetParam1
ParameterSE3Offset* g2o::SensorPose3DOffset::offsetParam2 ( )
inline

Definition at line 44 of file sensor_pose3d_offset.h.

References _offsetParam2, and isVisible().

Referenced by main().

44 {return _offsetParam2;};
ParameterSE3Offset * _offsetParam2
void g2o::SensorPose3DOffset::sense ( )
virtual

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

Definition at line 91 of file sensor_pose3d_offset.cpp.

References _offsetParam1, _offsetParam2, _posesToIgnore, g2o::BinarySensor< Robot3D, EdgeSE3Offset, WorldObjectSE3 >::_robotPoseObject, _stepsToIgnore, g2o::OptimizableGraph::addEdge(), addNoise(), g2o::BaseSensor::graph(), g2o::Parameter::id(), isVisible(), g2o::BinarySensor< Robot3D, EdgeSE3Offset, WorldObjectSE3 >::mkEdge(), g2o::World::objects(), g2o::BaseSensor::robot(), g2o::EdgeSE3Offset::setMeasurementFromState(), g2o::OptimizableGraph::Edge::setParameterId(), g2o::Robot< RobotPoseObject >::trajectory(), and g2o::BaseSensor::world().

91  {
93  RobotType* r= dynamic_cast<RobotType*>(robot());
94  std::list<PoseObject*>::reverse_iterator it=r->trajectory().rbegin();
95  _posesToIgnore.clear();
96  int count = 0;
97  while (it!=r->trajectory().rend() && count < _stepsToIgnore){
98  if (!_robotPoseObject)
99  _robotPoseObject = *it;
100  _posesToIgnore.insert(*it);
101  it++;
102  count++;
103  }
104  for (std::set<BaseWorldObject*>::iterator it=world()->objects().begin();
105  it!=world()->objects().end(); it++){
106  WorldObjectType* o=dynamic_cast<WorldObjectType*>(*it);
107  if (o && isVisible(o)){
108  EdgeType* e=mkEdge(o);
109  if (e && graph()) {
110  e->setParameterId(0,_offsetParam1->id());
111  e->setParameterId(1,_offsetParam2->id());
112  graph()->addEdge(e);
113  e->setMeasurementFromState();
114  addNoise(e);
115  }
116  }
117  }
118  }
bool isVisible(WorldObjectType *to)
std::set< PoseObject * > _posesToIgnore
ParameterSE3Offset * _offsetParam1
World * world()
Definition: simulator.cpp:69
TrajectoryType & trajectory()
Definition: simulator.h:119
int id() const
Definition: parameter.h:45
ParameterSE3Offset * _offsetParam2
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)
void g2o::SensorPose3DOffset::setStepsToIgnore ( int  stepsToIgnore_)
inline

Definition at line 40 of file sensor_pose3d_offset.h.

References _stepsToIgnore, addNoise(), and addParameters().

40 {_stepsToIgnore = stepsToIgnore_;}
int g2o::SensorPose3DOffset::stepsToIgnore ( ) const
inline

Definition at line 39 of file sensor_pose3d_offset.h.

References _stepsToIgnore.

Member Data Documentation

ParameterSE3Offset* g2o::SensorPose3DOffset::_offsetParam1
protected

Definition at line 50 of file sensor_pose3d_offset.h.

Referenced by addParameters(), offsetParam1(), sense(), and SensorPose3DOffset().

ParameterSE3Offset * g2o::SensorPose3DOffset::_offsetParam2
protected

Definition at line 50 of file sensor_pose3d_offset.h.

Referenced by addParameters(), offsetParam2(), sense(), and SensorPose3DOffset().

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

Definition at line 53 of file sensor_pose3d_offset.h.

Referenced by isVisible(), and sense().

int g2o::SensorPose3DOffset::_stepsToIgnore
protected

Definition at line 49 of file sensor_pose3d_offset.h.

Referenced by sense(), SensorPose3DOffset(), setStepsToIgnore(), and stepsToIgnore().


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