g2o
Loading...
Searching...
No Matches
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

using Point2DVector = std::vector< Vector2 >
 

Public Member Functions

 RawLaser ()
 
 ~RawLaser ()
 
virtual bool write (std::ostream &os) const
 write the data to a stream
 
virtual bool read (std::istream &is)
 read the data from a stream
 
Point2DVector cartesian () const
 
const std::vector< double > & ranges () const
 the range measurements by the laser
 
void setRanges (const std::vector< double > &ranges)
 
const std::vector< double > & remissions () const
 the remission measurements by the laser
 
void setRemissions (const std::vector< double > &remissions)
 
const LaserParameterslaserParams () const
 the parameters of the laser
 
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 ()
 

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
 
double _loggerTimestamp
 timestamp when the measurement was recorded
 
std::string _tag
 string tag (FLASER, ROBOTLASER, ODOM..) of the line in the log
 
std::string _hostname
 name of the computer/robot generating the data
 
- 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 45 of file raw_laser.h.

Member Typedef Documentation

◆ Point2DVector

using g2o::RawLaser::Point2DVector = std::vector<Vector2>

Definition at line 47 of file raw_laser.h.

Constructor & Destructor Documentation

◆ RawLaser()

g2o::RawLaser::RawLaser ( )

Definition at line 37 of file raw_laser.cpp.

38 : RobotData(),
39 _laserParams(0, 180, -const_pi() / 2, const_pi() / 180, 50, cst(0.1), 0) {
40}
LaserParameters _laserParams
Definition raw_laser.h:77
constexpr double cst(long double v)
Definition misc.h:60
constexpr double const_pi()
Definition misc.h:62

◆ ~RawLaser()

g2o::RawLaser::~RawLaser ( )

Definition at line 42 of file raw_laser.cpp.

42{}

Member Function Documentation

◆ cartesian()

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 84 of file raw_laser.cpp.

84 {
85 Point2DVector points;
86 for (size_t i = 0; i < _ranges.size(); ++i) {
87 const double& r = _ranges[i];
88 if (r < _laserParams.maxRange && r > _laserParams.minRange) {
90 points.push_back(Vector2(std::cos(alpha) * r, std::sin(alpha) * r));
91 }
92 }
93 return points;
94}
std::vector< double > _ranges
Definition raw_laser.h:75
std::vector< Vector2 > Point2DVector
Definition raw_laser.h:47
VectorN< 2 > Vector2
Definition eigen_types.h:50

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

◆ laserParams()

const LaserParameters & g2o::RawLaser::laserParams ( ) const
inline

the parameters of the laser

Definition at line 71 of file raw_laser.h.

71{ return _laserParams; }

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

◆ ranges()

const std::vector< double > & g2o::RawLaser::ranges ( ) const
inline

the range measurements by the laser

Definition at line 63 of file raw_laser.h.

63{ return _ranges; }

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

◆ read()

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 50 of file raw_laser.cpp.

50 {
51 int type;
52 double angle, fov, res, maxrange, acc;
53 int remission_mode;
54 is >> type >> angle >> fov >> res >> maxrange >> acc >> remission_mode;
55
56 int beams;
57 is >> beams;
59 LaserParameters(type, beams, angle, res, maxrange, acc, remission_mode);
60 _ranges.resize(beams);
61 for (int i = 0; i < beams; i++) is >> _ranges[i];
62
63 is >> beams;
64 _remissions.resize(beams);
65 for (int i = 0; i < beams; i++) is >> _remissions[i];
66
67 // timestamp + host
68 is >> _timestamp;
69 is >> _hostname;
70 is >> _loggerTimestamp;
71 return true;
72}
std::vector< double > _remissions
Definition raw_laser.h:76
double _loggerTimestamp
timestamp when the measurement was recorded
Definition robot_data.h:60
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:59

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

◆ remissions()

const std::vector< double > & g2o::RawLaser::remissions ( ) const
inline

the remission measurements by the laser

Definition at line 67 of file raw_laser.h.

67{ return _remissions; }

Referenced by setRemissions().

◆ setLaserParams()

void g2o::RawLaser::setLaserParams ( const LaserParameters laserParams)

Definition at line 80 of file raw_laser.cpp.

80 {
82}
const LaserParameters & laserParams() const
the parameters of the laser
Definition raw_laser.h:71

References _laserParams, and laserParams().

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

◆ setRanges()

void g2o::RawLaser::setRanges ( const std::vector< double > &  ranges)

Definition at line 74 of file raw_laser.cpp.

74{ _ranges = ranges; }
const std::vector< double > & ranges() const
the range measurements by the laser
Definition raw_laser.h:63

References _ranges, and ranges().

◆ setRemissions()

void g2o::RawLaser::setRemissions ( const std::vector< double > &  remissions)

Definition at line 76 of file raw_laser.cpp.

76 {
78}
const std::vector< double > & remissions() const
the remission measurements by the laser
Definition raw_laser.h:67

References _remissions, and remissions().

◆ write()

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 44 of file raw_laser.cpp.

44 {
45 // TODO(Rainer): implement writing of raw laser
46 G2O_ERROR("RawLaser::write() not implemented yet.");
47 return false;
48}
#define G2O_ERROR(...)
Definition logger.h:89

References G2O_ERROR.

Member Data Documentation

◆ _laserParams

LaserParameters g2o::RawLaser::_laserParams
protected

◆ _ranges

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

Definition at line 75 of file raw_laser.h.

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

◆ _remissions

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

Definition at line 76 of file raw_laser.h.

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


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