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

#include <sensor_pointxy_offset.h>

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

Public Member Functions

 SensorPointXYOffset (const std::string &name_)
 
virtual void sense ()
 
virtual void addNoise (EdgeType *e)
 
virtual void addParameters ()
 
- 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< Robot2D, EdgeSE2PointXYOffset, WorldObjectPointXY >
 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< Robot2D, EdgeSE2PointXYOffset, WorldObjectPointXY >
 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
 

Protected Member Functions

bool isVisible (WorldObjectType *to)
 
- Protected Member Functions inherited from g2o::BinarySensor< Robot2D, EdgeSE2PointXYOffset, WorldObjectPointXY >
EdgeTypemkEdge (WorldObjectType *object)
 

Protected Attributes

ParameterSE2Offset_offsetParam
 
RobotPoseType _sensorPose
 
- Protected Attributes inherited from g2o::PointSensorParameters
double _maxRange2
 
double _minRange2
 
double _fov
 
double _maxAngularDifference
 
- Protected Attributes inherited from g2o::BinarySensor< Robot2D, EdgeSE2PointXYOffset, WorldObjectPointXY >
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< Robot2D, EdgeSE2PointXYOffset, WorldObjectPointXY >
typedef Robot2D RobotType
 
typedef RobotType::PoseObject PoseObject
 
typedef RobotType::TrajectoryType TrajectoryType
 
typedef RobotType::PoseObject::VertexType PoseVertexType
 
typedef EdgeSE2PointXYOffset EdgeType
 
typedef WorldObjectPointXY WorldObjectType
 
typedef WorldObjectType::VertexType VertexType
 
typedef EdgeType::InformationType InformationType
 

Detailed Description

Definition at line 36 of file sensor_pointxy_offset.h.

Constructor & Destructor Documentation

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

Member Function Documentation

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

Reimplemented from g2o::BaseSensor.

Definition at line 64 of file sensor_pointxy_offset.cpp.

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

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

Definition at line 42 of file sensor_pointxy_offset.cpp.

References g2o::PointSensorParameters::_fov, g2o::PointSensorParameters::_maxRange2, g2o::PointSensorParameters::_minRange2, g2o::BinarySensor< Robot2D, EdgeSE2PointXYOffset, WorldObjectPointXY >::_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  Vector2d 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=atan2(translation.y(), translation.x());
58  if (fabs(bearing)>_fov)
59  return false;
60  //cerr <<"a";
61  return true;
62  }
void g2o::SensorPointXYOffset::sense ( )
virtual

Reimplemented from g2o::BinarySensor< Robot2D, EdgeSE2PointXYOffset, WorldObjectPointXY >.

Definition at line 77 of file sensor_pointxy_offset.cpp.

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

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

ParameterSE2Offset* g2o::SensorPointXYOffset::_offsetParam
protected

Definition at line 46 of file sensor_pointxy_offset.h.

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

RobotPoseType g2o::SensorPointXYOffset::_sensorPose
protected

Definition at line 47 of file sensor_pointxy_offset.h.

Referenced by isVisible(), and sense().

EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef PoseVertexType::EstimateType g2o::SensorPointXYOffset::RobotPoseType

Definition at line 39 of file sensor_pointxy_offset.h.


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