31 #ifdef G2O_HAVE_OPENGL 40 RobotLaser::RobotLaser() :
42 _laserTv(0.), _laserRv(0.), _forwardSafetyDist(0.), _sideSaftyDist(0.), _turnAxis(0.)
53 double angle, fov, res, maxrange, acc;
55 is >> type >> angle >> fov >> res >> maxrange >> acc >> remission_mode;
61 for (
int i=0; i<beams; i++)
66 for (
int i = 0; i < beams; i++)
71 is >> x >> y >> theta;
74 is >> x >> y >> theta;
93 for (
size_t i = 0; i <
ranges().size(); ++i)
101 os <<
" " << p.x() <<
" " << p.y() <<
" " << p.z();
103 os <<
" " << p.x() <<
" " << p.y() <<
" " << p.z();
121 #ifdef G2O_HAVE_OPENGL 128 if (_previousParams){
129 _beamsDownsampling = _previousParams->makeProperty<
IntProperty>(_typeName +
"::BEAMS_DOWNSAMPLING", 1);
130 _pointSize = _previousParams->makeProperty<
FloatProperty>(_typeName +
"::POINT_SIZE", 1.0f);
131 _maxRange = _previousParams->makeProperty<
FloatProperty>(_typeName +
"::MAX_RANGE", -1.);
133 _beamsDownsampling = 0;
142 if (
typeid(*element).name()!=_typeName)
145 refreshPropertyPtrs(params_);
146 if (! _previousParams){
149 if (_show && !_show->value())
154 if (_maxRange && _maxRange->value() >=0 ) {
158 float r2=_maxRange->value();
160 for (
size_t i=0; i<points.size(); i++){
161 double x = points[i].x();
162 double y = points[i].y();
164 npoints[k++] = points[i];
174 glColor4f(1.f,0.f,0.f,0.5f);
176 if (_beamsDownsampling )
177 step = _beamsDownsampling->value();
179 glPointSize(_pointSize->value());
183 for (
size_t i=0; i<points.size(); i+=
step){
184 glVertex3f((
float)points[i].x(), (
float)points[i].y(), 0.f);
std::string _hostname
name of the computer/robot generating the data
const SE2 & odomPose() const
std::vector< Vector2D, Eigen::aligned_allocator< Vector2D > > Point2DVector
Vector3D toVector() const
convert to a 3D vector (x, y, theta)
Eigen::Matrix< double, 3, 1, Eigen::ColMajor > Vector3D
Abstract action that operates on a graph entity.
double _timestamp
timestamp when the measurement was generated
laser measurement obtained by a robot
void setOdomPose(const SE2 &odomPose)
virtual bool read(std::istream &is)
read the data from a stream
double _loggerTimestamp
timestamp when the measurement was recorded
std::vector< double > _ranges
const Eigen::Rotation2Dd & rotation() const
rotational component
virtual bool write(std::ostream &os) const
write the data to a stream
double loggerTimestamp() const
const std::vector< double > & ranges() const
the range measurements by the laser
double _laserTv
velocities and safety distances of the robot.
const LaserParameters & laserParams() const
the parameters of the laser
const std::string & hostname() const
LaserParameters _laserParams
virtual bool refreshPropertyPtrs(HyperGraphElementAction::Parameters *params_)
SE2 inverse() const
invert :-)
const Vector2D & translation() const
translational component
double _forwardSafetyDist
std::vector< double > _remissions
Point2DVector cartesian() const
parameters for a 2D range finder