29 std::istream& in_stream,
30 std::vector<mrpt::obs::CObservation::Ptr>& out_observations,
36 out_observations.clear();
42 if (!in_stream)
return false;
43 std::getline(in_stream, line);
56 mrpt::make_aligned_shared<CObservation2DRangeScan>();
63 double start_angle, angular_resolution, accuracy;
66 if (!(S >> obsLaser->
sensorLabel >> laser_type >> start_angle >>
68 accuracy >> remission_mode))
70 "Error parsing line from CARMEN log (params):\n'%s'\n",
78 for (
size_t i = 0; i < nRanges; i++)
83 "Error parsing line from CARMEN log (ranges):\n'%s'\n",
89 obsLaser->
scan[i] <= 0));
92 size_t remmision_count;
93 if (!(S >> remmision_count))
95 "Error parsing line from CARMEN log (remmision_count):\n'%s'\n",
98 vector<double> remission;
99 remission.resize(remmision_count);
101 for (
size_t i = 0; i < remmision_count; i++)
103 if (!(S >> remission[i]))
105 "Error parsing line from CARMEN log (remmision "
113 if (!(S >> globalLaserPose.
x >> globalLaserPose.
y >>
114 globalLaserPose.
phi >> globalRobotPose.
x >> globalRobotPose.
y >>
115 globalRobotPose.
phi))
117 "Error parsing line from CARMEN log (poses):\n'%s'\n",
124 double tv, rv, fw_dist, side_dist, turn_axis;
125 S >> tv >> rv >> fw_dist >> side_dist >> turn_axis;
129 S >> timestamp >> robotName;
140 mrpt::make_aligned_shared<CObservationOdometry>();
142 obsOdo_ptr->timestamp = obs_time;
143 obsOdo_ptr->odometry =
CPose2D(globalRobotPose);
144 obsOdo_ptr->sensorLabel =
"ODOMETRY";
146 out_observations.push_back(obsOdo_ptr);
150 out_observations.push_back(obsLaser_ptr);
159 std::istringstream S;
163 mrpt::make_aligned_shared<CObservation2DRangeScan>();
172 "Error parsing line from CARMEN log (params):\n'%s'\n",
177 double maxRange = 81.0;
178 double resolutionDeg = 0.5;
184 .getWithDefaultVal(
"robot_front_laser_max",
"81.0")
186 resolutionDeg = atof(
189 "laser_front_laser_resolution",
"0.5")
192 else if (line[0] ==
'R')
196 .getWithDefaultVal(
"robot_rear_laser_max",
"81.0")
198 resolutionDeg = atof(
201 "laser_rear_laser_resolution",
"0.5")
210 for (
size_t i = 0; i < nRanges; i++)
215 "Error parsing line from CARMEN log (ranges):\n'%s'\n",
221 obsLaser->
scan[i] <= 0));
226 if (!(S >> globalLaserPose.
x >> globalLaserPose.
y >>
227 globalLaserPose.
phi >> globalRobotPose.
x >> globalRobotPose.
y >>
228 globalRobotPose.
phi))
230 "Error parsing line from CARMEN log (poses):\n'%s'\n",
239 S >> timestamp >> robotName;
250 mrpt::make_aligned_shared<CObservationOdometry>();
252 obsOdo_ptr->timestamp = obs_time;
253 obsOdo_ptr->odometry =
CPose2D(globalRobotPose);
254 obsOdo_ptr->sensorLabel =
"ODOMETRY";
256 out_observations.push_back(obsOdo_ptr);
260 out_observations.push_back(obsLaser_ptr);
267 std::istringstream S;
273 if (!(S >> key >>
val))
275 "Error parsing line from CARMEN log (PARAM):\n'%s'\n",
278 if (!key.empty() && !
val.empty())
A "CObservation"-derived class that represents a 2D range scan measurement (typically from a laser sc...
float maxRange
The maximum range allowed by the device, in meters (e.g.
float aperture
The "aperture" or field-of-view of the range finder, in radians (typically M_PI = 180 degrees).
mrpt::poses::CPose3D sensorPose
The 6D pose of the sensor on the robot at the moment of starting the scan.
std::shared_ptr< CObservation2DRangeScan > Ptr
mrpt::utils::ContainerReadOnlyProxyAccessor< std::vector< float > > scan
The range values of the scan, in meters.
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)
void setScanRange(const size_t i, const float val)
std::string sensorLabel
An arbitrary label that can be used to identify the sensor.
mrpt::system::TTimeStamp timestamp
The associated UTC time-stamp.
std::shared_ptr< CObservationOdometry > Ptr
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).
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...
bool strStartsI(const std::string &str, const std::string &subStr)
Return true if "str" starts with "subStr" (case insensitive)
std::string trim(const std::string &str)
Removes leading and trailing spaces.
std::string lowerCase(const std::string &str)
Returns an lower-case version of a string.
mrpt::system::TTimeStamp secondsToTimestamp(const double nSeconds)
Transform a time interval (in seconds) into TTimeStamp (e.g.
uint64_t TTimeStamp
A system independent time type, it holds the the number of 100-nanosecond intervals since January 1,...
#define THROW_EXCEPTION_FMT(_FORMAT_STRING,...)
This namespace contains representation of robot actions and observations.
Classes for 2D/3D geometry representation, both of single values and probability density distribution...
This namespace provides a OS-independent interface to many useful functions: filenames manipulation,...
Classes for serialization, sockets, ini-file manipulation, streams, list of properties-values,...
double DEG2RAD(const double x)
Degrees to radians.
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
double phi
Orientation (rads)
For usage when passing a dynamic number of (numeric) arguments to a function, by name.