10 #include <geometry_msgs/Pose.h>    15 #include <mrpt/version.h>    16 #include <sensor_msgs/LaserScan.h>    27     obj.
aperture = msg.angle_max - msg.angle_min;
    33     const size_t N = msg.ranges.size();
    34     const double ang_step = obj.
aperture / (N - 1);
    35     const double fov05 = 0.5 * obj.
aperture;
    36     const double inv_ang_step = (N - 1) / obj.
aperture;
    39     for (std::size_t i_mrpt = 0; i_mrpt < N; i_mrpt++)
    43         int i_ros = inv_ang_step * (-fov05 - msg.angle_min + ang_step * i_mrpt);
    46         else if (i_ros >= (
int)N)
    50         const float r = msg.ranges[i_ros];
    56             ((ri < (msg.range_max * 0.99)) && (ri > msg.range_min));
    67     if (!nRays) 
return false;
    69     msg.angle_min = -0.5f * obj.
aperture;
    74     msg.time_increment = 0.0;  
    77     msg.range_min = 0.02f;
    80     msg.ranges.resize(nRays);
    81     for (
size_t i = 0; i < nRays; i++) msg.ranges[i] = obj.
getScanRange(i);
    92     geometry_msgs::Pose& pose)
 
void setScanRange(const size_t i, const float val)
 
size_t getScanSize() const
Get number of scan rays. 
 
float maxRange
The maximum range allowed by the device, in meters (e.g. 
 
#define ASSERT_(f)
Defines an assertion mechanism. 
 
bool convert(const sensor_msgs::LaserScan &msg, const mrpt::poses::CPose3D &pose, mrpt::obs::CObservation2DRangeScan &obj)
 
bool toROS(const mrpt::obs::CObservationGPS &obj, const std_msgs::Header &msg_header, sensor_msgs::NavSatFix &msg)
Convert mrpt::obs::CObservationGPS -> sensor_msgs/NavSatFix The user must supply the "msg_header" fie...
 
std::string sensorLabel
An arbitrary label that can be used to identify the sensor. 
 
mrpt::system::TTimeStamp timestamp
The associated UTC time-stamp. 
 
A "CObservation"-derived class that represents a 2D range scan measurement (typically from a laser sc...
 
ROS message: http://docs.ros.org/api/sensor_msgs/html/msg/NavSatFix.html MRPT message: https://github...
 
A class used to store a 3D pose (a 3D translation + a rotation in 3D). 
 
void resizeScan(const size_t len)
Resizes all data vectors to allocate a given number of scan rays. 
 
bool fromROS(const sensor_msgs::NavSatFix &msg, mrpt::obs::CObservationGPS &obj)
Convert sensor_msgs/NavSatFix -> mrpt::obs::CObservationGPS. 
 
const float & getScanRange(const size_t i) const
The range values of the scan, in meters. 
 
float aperture
The "aperture" or field-of-view of the range finder, in radians (typically M_PI = 180 degrees)...
 
geometry_msgs::Pose toROS_Pose(const mrpt::poses::CPose2D &src)
 
mrpt::poses::CPose3D sensorPose
The 6D pose of the sensor on the robot at the moment of starting the scan. 
 
bool rightToLeft
The scanning direction: true=counterclockwise; false=clockwise. 
 
void setScanRangeValidity(const size_t i, const bool val)