Go to the documentation of this file.
27 std::istream& in_stream,
28 std::vector<mrpt::obs::CObservation::Ptr>& out_observations,
34 out_observations.clear();
40 if (!in_stream)
return false;
41 std::getline(in_stream, line);
54 std::make_shared<CObservation2DRangeScan>();
61 double start_angle, angular_resolution, accuracy;
64 if (!(S >> obsLaser->
sensorLabel >> laser_type >> start_angle >>
66 accuracy >> remission_mode))
68 "Error parsing line from CARMEN log (params):\n'%s'\n",
76 for (
size_t i = 0; i < nRanges; i++)
81 "Error parsing line from CARMEN log (ranges):\n'%s'\n",
86 i, (range >= obsLaser->
maxRange || range <= 0));
89 size_t remmision_count;
90 if (!(S >> remmision_count))
92 "Error parsing line from CARMEN log (remmision_count):\n'%s'\n",
95 vector<double> remission;
96 remission.resize(remmision_count);
98 for (
size_t i = 0; i < remmision_count; i++)
100 if (!(S >> remission[i]))
102 "Error parsing line from CARMEN log (remmision "
110 if (!(S >> globalLaserPose.
x >> globalLaserPose.
y >>
111 globalLaserPose.
phi >> globalRobotPose.
x >> globalRobotPose.
y >>
112 globalRobotPose.
phi))
114 "Error parsing line from CARMEN log (poses):\n'%s'\n",
121 double tv, rv, fw_dist, side_dist, turn_axis;
122 S >> tv >> rv >> fw_dist >> side_dist >> turn_axis;
126 S >> timestamp >> robotName;
130 std::chrono::microseconds(
static_cast<uint64_t
>(1e-6 * timestamp));
137 std::make_shared<CObservationOdometry>();
139 obsOdo_ptr->timestamp = obs_time;
140 obsOdo_ptr->odometry =
CPose2D(globalRobotPose);
141 obsOdo_ptr->sensorLabel =
"ODOMETRY";
143 out_observations.push_back(obsOdo_ptr);
147 out_observations.push_back(obsLaser_ptr);
156 std::istringstream S;
160 std::make_shared<CObservation2DRangeScan>();
169 "Error parsing line from CARMEN log (params):\n'%s'\n",
174 double maxRange = 81.0;
175 double resolutionDeg = 0.5;
176 using namespace std::string_literals;
182 .getWithDefaultVal(
"robot_front_laser_max",
"81.0"s)
185 atof(global_log_params
187 "laser_front_laser_resolution",
"0.5"s)
190 else if (line[0] ==
'R')
193 atof(global_log_params
194 .getWithDefaultVal(
"robot_rear_laser_max",
"81.0"s)
197 atof(global_log_params
199 "laser_rear_laser_resolution",
"0.5"s)
208 for (
size_t i = 0; i < nRanges; i++)
213 "Error parsing line from CARMEN log (ranges):\n'%s'\n",
224 if (!(S >> globalLaserPose.
x >> globalLaserPose.
y >>
225 globalLaserPose.
phi >> globalRobotPose.
x >> globalRobotPose.
y >>
226 globalRobotPose.
phi))
228 "Error parsing line from CARMEN log (poses):\n'%s'\n",
237 S >> timestamp >> robotName;
241 std::chrono::microseconds(
static_cast<uint64_t
>(1e-6 * timestamp));
248 std::make_shared<CObservationOdometry>();
250 obsOdo_ptr->timestamp = obs_time;
251 obsOdo_ptr->odometry =
CPose2D(globalRobotPose);
252 obsOdo_ptr->sensorLabel =
"ODOMETRY";
254 out_observations.push_back(obsOdo_ptr);
258 out_observations.push_back(obsLaser_ptr);
265 std::istringstream S;
271 if (!(S >> key >>
val))
273 "Error parsing line from CARMEN log (PARAM):\n'%s'\n",
276 if (!key.empty() && !
val.empty())
std::string sensorLabel
An arbitrary label that can be used to identify the sensor.
void setScanRange(const size_t i, const float val)
std::shared_ptr< mrpt::obs ::CObservationOdometry > Ptr
float maxRange
The maximum range allowed by the device, in meters (e.g.
static std::string & trim(std::string &s)
bool strStartsI(const std::string &str, const std::string &subStr)
Return true if "str" starts with "subStr" (case insensitive)
A "CObservation"-derived class that represents a 2D range scan measurement (typically from a laser sc...
double phi
Orientation (rads)
const float & getScanRange(const size_t i) const
The range values of the scan, in meters.
#define THROW_EXCEPTION_FMT(_FORMAT_STRING,...)
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
void resizeScan(const size_t len)
Resizes all data vectors to allocate a given number of scan rays.
void setScanRangeValidity(const size_t i, const bool val)
Classes for 2D/3D geometry representation, both of single values and probability density distribution...
This namespace contains representation of robot actions and observations.
std::string lowerCase(const std::string &str)
Returns an lower-case version of a string.
mrpt::system::TTimeStamp timestamp
The associated UTC time-stamp.
std::shared_ptr< mrpt::obs ::CObservation2DRangeScan > Ptr
bool carmen_log_parse_line(std::istream &in_stream, std::vector< mrpt::obs::CObservation::Ptr > &out_imported_observations, const mrpt::system::TTimeStamp &time_start_log)
Parse one line from an text input stream and interpret it as a CARMEN log entry, returning its MRPT o...
float aperture
The "aperture" or field-of-view of the range finder, in radians (typically M_PI = 180 degrees).
For usage when passing a dynamic number of (numeric) arguments to a function, by name.
A class used to store a 2D pose, including the 2D coordinate point and a heading (phi) angle.
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
mrpt::Clock::time_point TTimeStamp
A system independent time type, it holds the the number of 100-nanosecond intervals since January 1,...
float d2f(const double d)
shortcut for static_cast<float>(double)
constexpr double DEG2RAD(const double x)
Degrees to radians
mrpt::poses::CPose3D sensorPose
The 6D pose of the sensor on the robot at the moment of starting the scan.
Page generated by Doxygen 1.8.18 for MRPT 2.0.4 at Thu Sep 24 07:14:18 UTC 2020 | |