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

#include <sensor_pointxy_bearing.h>

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

Public Member Functions

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

Protected Member Functions

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

Additional Inherited Members

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

Detailed Description

Definition at line 36 of file sensor_pointxy_bearing.h.

Constructor & Destructor Documentation

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

Definition at line 34 of file sensor_pointxy_bearing.cpp.

References g2o::BinarySensor< Robot2D, EdgeSE2PointXYBearing, WorldObjectPointXY >::_information, and M_PI.

34  : BinarySensor<Robot2D, EdgeSE2PointXYBearing, WorldObjectPointXY>(name_) {
35  _information(0,0)=180.0 / M_PI;
36  }
#define M_PI
Definition: misc.h:34

Member Function Documentation

void g2o::SensorPointXYBearing::addNoise ( EdgeType e)
virtual
bool g2o::SensorPointXYBearing::isVisible ( SensorPointXYBearing::WorldObjectType to)
protected

Definition at line 44 of file sensor_pointxy_bearing.cpp.

References g2o::PointSensorParameters::_fov, g2o::PointSensorParameters::_maxRange2, g2o::PointSensorParameters::_minRange2, g2o::BinarySensor< Robot2D, EdgeSE2PointXYBearing, WorldObjectPointXY >::_robotPoseObject, and g2o::WorldObject< VertexType_ >::vertex().

Referenced by sense().

44  {
45  if (! _robotPoseObject)
46  return false;
47 
48  assert(to && to->vertex());
49  VertexType* v=to->vertex();
50  VertexType::EstimateType pose=v->estimate();
51  VertexType::EstimateType delta = _robotPoseObject->vertex()->estimate().inverse()*pose;
52  Vector2d translation=delta;
53  double range2=translation.squaredNorm();
54  if (range2>_maxRange2)
55  return false;
56  if (range2<_minRange2)
57  return false;
58  translation.normalize();
59  double bearing=acos(translation.x());
60  if (fabs(bearing)>_fov)
61  return false;
62  return true;
63  }
void g2o::SensorPointXYBearing::sense ( )
virtual

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

Definition at line 66 of file sensor_pointxy_bearing.cpp.

References g2o::BinarySensor< Robot2D, EdgeSE2PointXYBearing, WorldObjectPointXY >::_robotPoseObject, g2o::OptimizableGraph::addEdge(), addNoise(), g2o::BaseSensor::graph(), isVisible(), g2o::BinarySensor< Robot2D, EdgeSE2PointXYBearing, WorldObjectPointXY >::mkEdge(), g2o::World::objects(), g2o::BaseSensor::robot(), g2o::EdgeSE2PointXYBearing::setMeasurementFromState(), g2o::Robot< RobotPoseObject >::trajectory(), and g2o::BaseSensor::world().

66  {
68  RobotType* r= dynamic_cast<RobotType*>(robot());
69  std::list<PoseObject*>::reverse_iterator it=r->trajectory().rbegin();
70  int count = 0;
71  while (it!=r->trajectory().rend() && count < 1){
72  if (!_robotPoseObject)
73  _robotPoseObject = *it;
74  it++;
75  count++;
76  }
77  for (std::set<BaseWorldObject*>::iterator it=world()->objects().begin();
78  it!=world()->objects().end(); it++){
79  WorldObjectType* o=dynamic_cast<WorldObjectType*>(*it);
80  if (o && isVisible(o)){
81  EdgeType* e=mkEdge(o);
82  if (e && graph()) {
83  e->setMeasurementFromState();
84  addNoise(e);
85  graph()->addEdge(e);
86  }
87  }
88  }
89  }
virtual void addNoise(EdgeType *e)
bool isVisible(WorldObjectType *to)
World * world()
Definition: simulator.cpp:69
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
virtual bool addEdge(HyperGraph::Edge *e)

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