30 std::istream &in_stream,
31 std::vector<mrpt::obs::CObservationPtr> &out_observations,
36 out_observations.clear();
44 std::getline(in_stream, line);
56 CObservation2DRangeScanPtr obsLaser_ptr = CObservation2DRangeScan::Create();
61 double start_angle, angular_resolution , accuracy;
65 >> laser_type >> start_angle >> obsLaser->
aperture >> angular_resolution >> obsLaser->
maxRange >> accuracy >> remission_mode ) )
73 for(
size_t i=0;i<nRanges;i++)
83 size_t remmision_count;
84 if (! (S >> remmision_count) )
85 THROW_EXCEPTION_FMT(
"Error parsing line from CARMEN log (remmision_count):\n'%s'\n", line.c_str() )
87 vector<double> remission;
88 remission.resize(remmision_count);
90 for(
size_t i=0; i<remmision_count; i++)
92 if (! (S >> remission[i]) )
93 THROW_EXCEPTION_FMT(
"Error parsing line from CARMEN log (remmision vals):\n'%s'\n", line.c_str() )
99 if (! ( S >> globalLaserPose.
x >> globalLaserPose.
y >> globalLaserPose.
phi 100 >> globalRobotPose.
x >> globalRobotPose.
y >> globalRobotPose.
phi ) )
106 double tv,rv,fw_dist, side_dist,turn_axis;
107 S >> tv >> rv >> fw_dist >> side_dist >> turn_axis;
111 S >> timestamp >> robotName;
119 CObservationOdometryPtr obsOdo_ptr = CObservationOdometry::Create();
121 obsOdo_ptr->timestamp = obs_time;
122 obsOdo_ptr->odometry =
CPose2D(globalRobotPose);
123 obsOdo_ptr->sensorLabel =
"ODOMETRY";
125 out_observations.push_back(obsOdo_ptr);
129 out_observations.push_back(obsLaser_ptr);
138 std::istringstream S;
141 CObservation2DRangeScanPtr obsLaser_ptr = CObservation2DRangeScan::Create();
152 double maxRange = 81.0;
153 double resolutionDeg = 0.5;
157 maxRange = atof(global_log_params.
getWithDefaultVal(
"robot_front_laser_max",
"81.0").c_str());
158 resolutionDeg = atof(global_log_params.
getWithDefaultVal(
"laser_front_laser_resolution",
"0.5").c_str());
160 else if (line[0]==
'R')
162 maxRange = atof(global_log_params.
getWithDefaultVal(
"robot_rear_laser_max",
"81.0").c_str());
163 resolutionDeg = atof(global_log_params.
getWithDefaultVal(
"laser_rear_laser_resolution",
"0.5").c_str());
171 for(
size_t i=0;i<nRanges;i++)
175 THROW_EXCEPTION_FMT(
"Error parsing line from CARMEN log (ranges):\n'%s'\n", line.c_str() );
183 if (! ( S >> globalLaserPose.
x >> globalLaserPose.
y >> globalLaserPose.
phi 184 >> globalRobotPose.
x >> globalRobotPose.
y >> globalRobotPose.
phi ) )
193 S >> timestamp >> robotName;
201 CObservationOdometryPtr obsOdo_ptr = CObservationOdometry::Create();
203 obsOdo_ptr->timestamp = obs_time;
204 obsOdo_ptr->odometry =
CPose2D(globalRobotPose);
205 obsOdo_ptr->sensorLabel =
"ODOMETRY";
207 out_observations.push_back(obsOdo_ptr);
211 out_observations.push_back(obsLaser_ptr);
219 std::istringstream S;
225 if (! (S >> key >>
val) )
228 if (!key.empty() && !
val.empty() )
uint64_t TTimeStamp
A system independent time type, it holds the the number of 100-nanosecond intervals since January 1...
Classes for serialization, sockets, ini-file manipulation, streams, list of properties-values, timewatch, extensions to STL.
For usage when passing a dynamic number of (numeric) arguments to a function, by name.
This namespace provides a OS-independent interface to many useful functions: filenames manipulation...
void setScanRange(const size_t i, const float val)
bool BASE_IMPEXP strStartsI(const std::string &str, const std::string &subStr)
Return true if "str" starts with "subStr" (case insensitive)
#define THROW_EXCEPTION_FMT(_FORMAT_STRING,...)
float maxRange
The maximum range allowed by the device, in meters (e.g. 80m, 50m,...)
bool OBS_IMPEXP carmen_log_parse_line(std::istream &in_stream, std::vector< mrpt::obs::CObservationPtr > &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...
std::string BASE_IMPEXP lowerCase(const std::string &str)
Returns an lower-case version of a string.
This namespace contains representation of robot actions and observations.
double DEG2RAD(const double x)
Degrees to radians.
Classes for 2D/3D geometry representation, both of single values and probability density distribution...
std::string sensorLabel
An arbitrary label that can be used to identify the sensor.
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
mrpt::system::TTimeStamp timestamp
The associated UTC time-stamp. Where available, this should contain the accurate satellite-based time...
A "CObservation"-derived class that represents a 2D range scan measurement (typically from a laser sc...
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).
void resizeScan(const size_t len)
Resizes all data vectors to allocate a given number of scan rays.
T getWithDefaultVal(const std::string &s, const T &defaultVal) const
A const version of the [] operator and with a default value in case the parameter is not set (for usa...
float aperture
The "aperture" or field-of-view of the range finder, in radians (typically M_PI = 180 degrees)...
std::string BASE_IMPEXP trim(const std::string &str)
Removes leading and trailing spaces.
mrpt::system::TTimeStamp BASE_IMPEXP secondsToTimestamp(const double nSeconds)
Transform a time interval (in seconds) into TTimeStamp (e.g.
mrpt::utils::ContainerReadOnlyProxyAccessor< std::vector< float > > scan
The range values of the scan, in meters. Must have same length than validRange.
double phi
Orientation (rads)
mrpt::poses::CPose3D sensorPose
The 6D pose of the sensor on the robot at the moment of starting the scan.
void setScanRangeValidity(const size_t i, const bool val)