g2o
Loading...
Searching...
No Matches
g2o::BinarySensor< RobotType_, EdgeType_, WorldObjectType_ > Class Template Reference

#include <simulator.h>

Inheritance diagram for g2o::BinarySensor< RobotType_, EdgeType_, WorldObjectType_ >:
Collaboration diagram for g2o::BinarySensor< RobotType_, EdgeType_, WorldObjectType_ >:

Public Types

typedef RobotType_ RobotType
typedef RobotType::PoseObject PoseObject
typedef RobotType::TrajectoryType TrajectoryType
typedef RobotType::PoseObject::VertexType PoseVertexType
typedef EdgeType_ EdgeType
typedef WorldObjectType_ WorldObjectType
typedef WorldObjectType::VertexType VertexType
typedef EdgeType::InformationType InformationType

Public Member Functions

 BinarySensor (const std::string &name)
void setInformation (const InformationType &information_)
const InformationType & information ()
virtual void sense ()
Public Member Functions inherited from g2o::BaseSensor
 BaseSensor (const std::string &name_)
BaseRobot * robot ()
void setRobot (BaseRobot *robot_)
World * world () const
OptimizableGraph * graph () const
const std::vector< Parameter * > & parameters ()
virtual void addParameters ()

Public Attributes

 EIGEN_MAKE_ALIGNED_OPERATOR_NEW

Protected Member Functions

EdgeType * mkEdge (WorldObjectType *object)
virtual void addNoise (EdgeType *)

Protected Attributes

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

template<class RobotType_, class EdgeType_, class WorldObjectType_>
class g2o::BinarySensor< RobotType_, EdgeType_, WorldObjectType_ >

Definition at line 235 of file simulator.h.

Member Typedef Documentation

◆ EdgeType

template<class RobotType_, class EdgeType_, class WorldObjectType_>
typedef EdgeType_ g2o::BinarySensor< RobotType_, EdgeType_, WorldObjectType_ >::EdgeType

Definition at line 242 of file simulator.h.

◆ InformationType

template<class RobotType_, class EdgeType_, class WorldObjectType_>
typedef EdgeType::InformationType g2o::BinarySensor< RobotType_, EdgeType_, WorldObjectType_ >::InformationType

Definition at line 245 of file simulator.h.

◆ PoseObject

template<class RobotType_, class EdgeType_, class WorldObjectType_>
typedef RobotType::PoseObject g2o::BinarySensor< RobotType_, EdgeType_, WorldObjectType_ >::PoseObject

Definition at line 239 of file simulator.h.

◆ PoseVertexType

template<class RobotType_, class EdgeType_, class WorldObjectType_>
typedef RobotType::PoseObject::VertexType g2o::BinarySensor< RobotType_, EdgeType_, WorldObjectType_ >::PoseVertexType

Definition at line 241 of file simulator.h.

◆ RobotType

template<class RobotType_, class EdgeType_, class WorldObjectType_>
typedef RobotType_ g2o::BinarySensor< RobotType_, EdgeType_, WorldObjectType_ >::RobotType

Definition at line 238 of file simulator.h.

◆ TrajectoryType

template<class RobotType_, class EdgeType_, class WorldObjectType_>
typedef RobotType::TrajectoryType g2o::BinarySensor< RobotType_, EdgeType_, WorldObjectType_ >::TrajectoryType

Definition at line 240 of file simulator.h.

◆ VertexType

template<class RobotType_, class EdgeType_, class WorldObjectType_>
typedef WorldObjectType::VertexType g2o::BinarySensor< RobotType_, EdgeType_, WorldObjectType_ >::VertexType

Definition at line 244 of file simulator.h.

◆ WorldObjectType

template<class RobotType_, class EdgeType_, class WorldObjectType_>
typedef WorldObjectType_ g2o::BinarySensor< RobotType_, EdgeType_, WorldObjectType_ >::WorldObjectType

Definition at line 243 of file simulator.h.

Constructor & Destructor Documentation

◆ BinarySensor()

template<class RobotType_, class EdgeType_, class WorldObjectType_>
g2o::BinarySensor< RobotType_, EdgeType_, WorldObjectType_ >::BinarySensor ( const std::string & name)
inline

Definition at line 247 of file simulator.h.

247 : BaseSensor(name) {
248 _information.setIdentity();
249 }
BaseSensor(const std::string &name_)
Definition simulator.h:161
InformationType _information
Definition simulator.h:288

References _information, and g2o::BaseSensor::BaseSensor().

Member Function Documentation

◆ addNoise()

template<class RobotType_, class EdgeType_, class WorldObjectType_>
virtual void g2o::BinarySensor< RobotType_, EdgeType_, WorldObjectType_ >::addNoise ( EdgeType * )
inlineprotectedvirtual

Reimplemented in g2o::SensorPointLine3D.

Definition at line 299 of file simulator.h.

299{};

Referenced by sense().

◆ information()

template<class RobotType_, class EdgeType_, class WorldObjectType_>
const InformationType & g2o::BinarySensor< RobotType_, EdgeType_, WorldObjectType_ >::information ( )
inline

Definition at line 256 of file simulator.h.

256{ return _information; }

References _information.

Referenced by main().

◆ mkEdge()

template<class RobotType_, class EdgeType_, class WorldObjectType_>
EdgeType * g2o::BinarySensor< RobotType_, EdgeType_, WorldObjectType_ >::mkEdge ( WorldObjectType * object)
inlineprotected

Definition at line 290 of file simulator.h.

290 {
292 EdgeType* e = new EdgeType();
293 e->vertices()[0] = robotVertex;
294 e->vertices()[1] = object->vertex();
295 e->information().setIdentity();
296 return e;
297 }
PoseObject * _robotPoseObject
Definition simulator.h:287
RobotType::PoseObject::VertexType PoseVertexType
Definition simulator.h:241
const InformationType & information()
Definition simulator.h:256
EdgeType_ EdgeType
Definition simulator.h:242

References _robotPoseObject.

Referenced by sense().

◆ sense()

template<class RobotType_, class EdgeType_, class WorldObjectType_>
virtual void g2o::BinarySensor< RobotType_, EdgeType_, WorldObjectType_ >::sense ( )
inlinevirtual

Implements g2o::BaseSensor.

Reimplemented in g2o::SensorOdometry2D, g2o::SensorOdometry3D, g2o::SensorOdometry< R, E, O >, g2o::SensorPointLine3D, g2o::SensorPointXY, g2o::SensorPointXYBearing, g2o::SensorPointXYOffset, g2o::SensorPointXYZ, g2o::SensorPointXYZDepth, g2o::SensorPointXYZDisparity, g2o::SensorPose2D, g2o::SensorPose3D, g2o::SensorPose3DOffset, g2o::SensorSegment2D, g2o::SensorSegment2DLine, and g2o::SensorSegment2DPointLine.

Definition at line 258 of file simulator.h.

258 {
260 // set the robot pose
261 if (!robot()) return;
262
263 RobotType* r = dynamic_cast<RobotType*>(robot());
264 if (!r) return;
265
266 if (!r->trajectory().empty())
267 _robotPoseObject = *(r->trajectory().rbegin());
268
269 if (!world() || !graph()) return;
270
271 // naive search. just for initial testing
273 it != world()->objects().end(); ++it) {
274 WorldObjectType* wo = dynamic_cast<WorldObjectType*>(*it);
275 if (wo) {
276 EdgeType* e = mkEdge(wo);
277 if (e) {
278 e->setMeasurementFromState();
279 addNoise(e);
280 graph()->addEdge(e);
281 }
282 }
283 }
284 }
OptimizableGraph * graph() const
Definition simulator.cpp:76
World * world() const
Definition simulator.cpp:71
BaseRobot * robot()
Definition simulator.h:162
WorldObjectType_ WorldObjectType
Definition simulator.h:243
EdgeType * mkEdge(WorldObjectType *object)
Definition simulator.h:290
RobotType_ RobotType
Definition simulator.h:238
virtual void addNoise(EdgeType *)
Definition simulator.h:299
std::set< BaseWorldObject * > & objects()
Definition simulator.h:115
virtual bool addEdge(HyperGraph::Edge *e)

References _robotPoseObject, g2o::OptimizableGraph::addEdge(), addNoise(), g2o::BaseSensor::graph(), mkEdge(), g2o::World::objects(), g2o::BaseSensor::robot(), and g2o::BaseSensor::world().

◆ setInformation()

template<class RobotType_, class EdgeType_, class WorldObjectType_>
void g2o::BinarySensor< RobotType_, EdgeType_, WorldObjectType_ >::setInformation ( const InformationType & information_)
inline

Definition at line 251 of file simulator.h.

251 {
253 _sampler.setDistribution(_information.inverse());
254 }
GaussianSampler< typename EdgeType::ErrorVector, InformationType > _sampler
Definition simulator.h:298

References _information, and _sampler.

Referenced by main().

Member Data Documentation

◆ _information

template<class RobotType_, class EdgeType_, class WorldObjectType_>
InformationType g2o::BinarySensor< RobotType_, EdgeType_, WorldObjectType_ >::_information
protected

Definition at line 288 of file simulator.h.

Referenced by BinarySensor(), information(), and setInformation().

◆ _robotPoseObject

template<class RobotType_, class EdgeType_, class WorldObjectType_>
PoseObject* g2o::BinarySensor< RobotType_, EdgeType_, WorldObjectType_ >::_robotPoseObject
protected

Definition at line 287 of file simulator.h.

Referenced by mkEdge(), and sense().

◆ _sampler

template<class RobotType_, class EdgeType_, class WorldObjectType_>
GaussianSampler<typename EdgeType::ErrorVector, InformationType> g2o::BinarySensor< RobotType_, EdgeType_, WorldObjectType_ >::_sampler
protected

Definition at line 298 of file simulator.h.

Referenced by setInformation().

◆ EIGEN_MAKE_ALIGNED_OPERATOR_NEW

template<class RobotType_, class EdgeType_, class WorldObjectType_>
g2o::BinarySensor< RobotType_, EdgeType_, WorldObjectType_ >::EIGEN_MAKE_ALIGNED_OPERATOR_NEW

Definition at line 237 of file simulator.h.


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