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

Raw laser measuerement. More...

#include <raw_laser.h>

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

Public Types

typedef std::vector< Vector2D, Eigen::aligned_allocator< Vector2D > > Point2DVector
 

Public Member Functions

 RawLaser ()
 
 ~RawLaser ()
 
virtual bool write (std::ostream &os) const
 write the data to a stream More...
 
virtual bool read (std::istream &is)
 read the data from a stream More...
 
Point2DVector cartesian () const
 
const std::vector< double > & ranges () const
 the range measurements by the laser More...
 
void setRanges (const std::vector< double > &ranges)
 
const std::vector< double > & remissions () const
 the remission measurements by the laser More...
 
void setRemissions (const std::vector< double > &remissions)
 
const LaserParameterslaserParams () const
 the parameters of the laser More...
 
void setLaserParams (const LaserParameters &laserParams)
 
- Public Member Functions inherited from g2o::RobotData
 RobotData ()
 
virtual ~RobotData ()
 
double timestamp () const
 
void setTimestamp (double ts)
 
double loggerTimestamp () const
 
void setLoggerTimestamp (double ts)
 
const std::string & tag () const
 
void setTag (const std::string &tag)
 
const std::string & hostname () const
 
void setHostname (const std::string &hostname)
 
- Public Member Functions inherited from g2o::HyperGraph::Data
 Data ()
 
 ~Data ()
 
virtual HyperGraph::HyperGraphElementType elementType () const
 
const Datanext () const
 
Datanext ()
 
void setNext (Data *next_)
 
DataContainerdataContainer ()
 
const DataContainerdataContainer () const
 
void setDataContainer (DataContainer *dataContainer_)
 
- Public Member Functions inherited from g2o::HyperGraph::HyperGraphElement
virtual ~HyperGraphElement ()
 
HyperGraphElementclone () const
 

Protected Attributes

std::vector< double > _ranges
 
std::vector< double > _remissions
 
LaserParameters _laserParams
 
- Protected Attributes inherited from g2o::RobotData
double _timestamp
 timestamp when the measurement was generated More...
 
double _loggerTimestamp
 timestamp when the measurement was recorded More...
 
std::string _tag
 string tag (FLASER, ROBOTLASER, ODOM..) of the line in the log More...
 
std::string _hostname
 name of the computer/robot generating the data More...
 
- Protected Attributes inherited from g2o::HyperGraph::Data
Data_next
 
DataContainer_dataContainer
 

Detailed Description

Raw laser measuerement.

A raw laser measuerement. The read/write function correspond to the format of CARMEN.

Definition at line 46 of file raw_laser.h.

Member Typedef Documentation

typedef std::vector<Vector2D, Eigen::aligned_allocator<Vector2D> > g2o::RawLaser::Point2DVector

Definition at line 48 of file raw_laser.h.

Constructor & Destructor Documentation

g2o::RawLaser::RawLaser ( )

Definition at line 35 of file raw_laser.cpp.

35  :
36  RobotData(),
37  _laserParams(0, 180, -M_PI/2, M_PI/180., 50.,0.1, 0)
38  {
39  }
LaserParameters _laserParams
Definition: raw_laser.h:78
#define M_PI
Definition: misc.h:34
g2o::RawLaser::~RawLaser ( )

Definition at line 41 of file raw_laser.cpp.

42  {
43  }

Member Function Documentation

RawLaser::Point2DVector g2o::RawLaser::cartesian ( ) const

computes a cartesian view of the beams (x,y).

Returns
a vector with the points of the scan in cartesian coordinates.

Definition at line 93 of file raw_laser.cpp.

References _laserParams, _ranges, g2o::LaserParameters::angularStep, g2o::LaserParameters::firstBeamAngle, and g2o::LaserParameters::maxRange.

Referenced by g2o::RobotLaser::setOdomPose().

94  {
95  Point2DVector points;
96  for (size_t i = 0; i < _ranges.size(); ++i) {
97  const double& r = _ranges[i];
98  if (r < _laserParams.maxRange) {
100  points.push_back(Vector2D(cos(alpha) * r, sin(alpha) * r));
101  }
102  }
103  return points;
104  }
Eigen::Matrix< double, 2, 1, Eigen::ColMajor > Vector2D
Definition: eigen_types.h:45
std::vector< Vector2D, Eigen::aligned_allocator< Vector2D > > Point2DVector
Definition: raw_laser.h:48
std::vector< double > _ranges
Definition: raw_laser.h:76
LaserParameters _laserParams
Definition: raw_laser.h:78
const LaserParameters& g2o::RawLaser::laserParams ( ) const
inline

the parameters of the laser

Definition at line 72 of file raw_laser.h.

Referenced by g2o::Gm2dlIO::readGm2dl(), setLaserParams(), g2o::RobotLaser::setOdomPose(), and g2o::Gm2dlIO::updateLaserData().

72 { return _laserParams;}
LaserParameters _laserParams
Definition: raw_laser.h:78
const std::vector<double>& g2o::RawLaser::ranges ( ) const
inline

the range measurements by the laser

Definition at line 64 of file raw_laser.h.

Referenced by setRanges(), and g2o::RobotLaser::write().

64 { return _ranges;}
std::vector< double > _ranges
Definition: raw_laser.h:76
bool g2o::RawLaser::read ( std::istream &  is)
virtual

read the data from a stream

Implements g2o::HyperGraph::Data.

Reimplemented in g2o::RobotLaser.

Definition at line 52 of file raw_laser.cpp.

References g2o::RobotData::_hostname, _laserParams, g2o::RobotData::_loggerTimestamp, _ranges, _remissions, and g2o::RobotData::_timestamp.

53  {
54  int type;
55  double angle, fov, res, maxrange, acc;
56  int remission_mode;
57  is >> type >> angle >> fov >> res >> maxrange >> acc >> remission_mode;
58 
59  int beams;
60  is >> beams;
61  _laserParams = LaserParameters(type, beams, angle, res, maxrange, acc, remission_mode);
62  _ranges.resize(beams);
63  for (int i=0; i<beams; i++)
64  is >> _ranges[i];
65 
66  is >> beams;
67  _remissions.resize(beams);
68  for (int i=0; i < beams; i++)
69  is >> _remissions[i];
70 
71  // timestamp + host
72  is >> _timestamp;
73  is >> _hostname;
74  is >> _loggerTimestamp;
75  return true;
76  }
std::string _hostname
name of the computer/robot generating the data
Definition: robot_data.h:63
double _timestamp
timestamp when the measurement was generated
Definition: robot_data.h:60
double _loggerTimestamp
timestamp when the measurement was recorded
Definition: robot_data.h:61
std::vector< double > _ranges
Definition: raw_laser.h:76
LaserParameters _laserParams
Definition: raw_laser.h:78
std::vector< double > _remissions
Definition: raw_laser.h:77
const std::vector<double>& g2o::RawLaser::remissions ( ) const
inline

the remission measurements by the laser

Definition at line 68 of file raw_laser.h.

Referenced by setRemissions().

68 { return _remissions;}
std::vector< double > _remissions
Definition: raw_laser.h:77
void g2o::RawLaser::setLaserParams ( const LaserParameters laserParams)

Definition at line 88 of file raw_laser.cpp.

References _laserParams, and laserParams().

Referenced by g2o::Gm2dlIO::updateLaserData().

89  {
91  }
const LaserParameters & laserParams() const
the parameters of the laser
Definition: raw_laser.h:72
LaserParameters _laserParams
Definition: raw_laser.h:78
void g2o::RawLaser::setRanges ( const std::vector< double > &  ranges)

Definition at line 78 of file raw_laser.cpp.

References _ranges, and ranges().

79  {
80  _ranges = ranges;
81  }
std::vector< double > _ranges
Definition: raw_laser.h:76
const std::vector< double > & ranges() const
the range measurements by the laser
Definition: raw_laser.h:64
void g2o::RawLaser::setRemissions ( const std::vector< double > &  remissions)

Definition at line 83 of file raw_laser.cpp.

References _remissions, and remissions().

84  {
86  }
const std::vector< double > & remissions() const
the remission measurements by the laser
Definition: raw_laser.h:68
std::vector< double > _remissions
Definition: raw_laser.h:77
bool g2o::RawLaser::write ( std::ostream &  os) const
virtual

write the data to a stream

Implements g2o::HyperGraph::Data.

Reimplemented in g2o::RobotLaser.

Definition at line 45 of file raw_laser.cpp.

46  {
47  // TODO
48  cerr << "RawLaser::write() not implemented yet." << endl;
49  return false;
50  }

Member Data Documentation

LaserParameters g2o::RawLaser::_laserParams
protected
std::vector<double> g2o::RawLaser::_ranges
protected

Definition at line 76 of file raw_laser.h.

Referenced by cartesian(), g2o::RobotLaser::read(), read(), and setRanges().

std::vector<double> g2o::RawLaser::_remissions
protected

Definition at line 77 of file raw_laser.h.

Referenced by g2o::RobotLaser::read(), read(), setRemissions(), and g2o::RobotLaser::write().


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