25 C2DRangeFinderAbstract::C2DRangeFinderAbstract()
    46     bool& outThereIsObservation,
    64     bool thereIs, hwError;
    75             5.0, 
"Error reading from the sensor hardware. Will retry.");
   121     const std::string& iniSection)
   134         vector<double> x, y, z_range;
   136             iniSection, 
format(
"exclusionZone%u_x", N), vector<double>(0), x);
   138             iniSection, 
format(
"exclusionZone%u_y", N), vector<double>(0), y);
   140             iniSection, 
format(
"exclusionZone%u_z", N++), vector<double>(0),
   143         if (!x.empty() && !y.empty())
   146             CObservation2DRangeScan::TListExclusionAreasWithRanges::value_type
   149             dat.first.setAllVertices(x, y);
   152                 dat.second.first = -std::numeric_limits<double>::max();
   153                 dat.second.second = std::numeric_limits<double>::max();
   159                     "exclusionZone%u_z must be a range [z_min z_max]");
   160                 ASSERT_(z_range[0] <= z_range[1]);
   162                 dat.second.first = z_range[0];
   163                 dat.second.second = z_range[1];
   178             iniSection, 
format(
"exclusionAngles%u_ini", N), -1000));
   180             iniSection, 
format(
"exclusionAngles%u_end", N++), -1000));
   223             m_win->setCameraAzimuthDeg(180);
   224             m_win->setCameraElevationDeg(90);
   226             theScene->insert(std::make_shared<CAxis>(
   227                 -300, -300, -50, 300, 300, 50, 1.0, 3, 
true));
   228             m_win->unlockAccess3DScene();
   238                 laser = std::make_shared<opengl::CPlanarLaserScan>();
   239                 laser->setName(
"laser");
   241                 theScene->insert(laser);
   248             m_win->unlockAccess3DScene();
   249             m_win->forceRepaint();
 virtual void doProcessSimple(bool &outThereIsObservation, mrpt::obs::CObservation2DRangeScan &outObservation, bool &hardwareError)=0
Specific laser scanner "software drivers" must process here new data from the I/O stream...
 
mrpt::obs::CObservation2DRangeScan m_lastObservation
 
void filterByExclusionAngles(const std::vector< std::pair< double, double >> &angles)
Mark as invalid the ranges in any of a given set of "forbiden angle ranges", given as pairs<min_angle...
 
void appendObservation(const mrpt::serialization::CSerializable::Ptr &obj)
Like appendObservations() but for just one observation. 
 
int m_max_missed_scan_failures
 
std::string std::string format(std::string_view fmt, ARGS &&... args)
 
void bindIO(const std::shared_ptr< mrpt::io::CStream > &streamIO)
Binds the object to a given I/O channel. 
 
mrpt::gui::CDisplayWindow3D::Ptr m_win
 
void internal_notifyGoodScanNow()
Must be called from doProcessSimple() implementations. 
 
std::string m_sensorLabel
See CGenericSensor. 
 
std::mutex m_csChangeStream
For being thread-safe. 
 
mrpt::system::TTimeStamp now()
A shortcut for system::getCurrentTime. 
 
Contains classes for various device interfaces. 
 
mrpt::system::TTimeStamp m_last_good_scan
Used in internal_notifyGoodScanNow() 
 
static CDisplayWindow3D::Ptr Create(const std::string &windowCaption, unsigned int initialWindowWidth=400, unsigned int initialWindowHeight=300)
Class factory returning a smart pointer. 
 
void filterByExclusionAreas(mrpt::obs::CObservation2DRangeScan &obs) const
Mark as invalid those points which (x,y) coordinates fall within the exclusion polygons. 
 
mrpt::system::COutputLogger COutputLogger
 
void filterByExclusionAngles(mrpt::obs::CObservation2DRangeScan &obs) const
Mark as invalid those ranges in a set of forbiden angle ranges. 
 
int read_int(const std::string §ion, const std::string &name, int defaultValue, bool failIfNotFound=false) const
 
void getObservation(bool &outThereIsObservation, mrpt::obs::CObservation2DRangeScan &outObservation, bool &hardwareError)
Get the last observation from the sensor, if available, and unmarks it as being "the last one" (thus ...
 
#define ASSERT_(f)
Defines an assertion mechanism. 
 
double m_estimated_scan_period
Updated in internal_notifyGoodScanNow() 
 
This class allows loading and storing values and vectors of different types from a configuration text...
 
std::vector< std::pair< double, double > > m_lstExclusionAngles
A list of pairs of angles <init,end> such as all sensor ranges falling in those forbiden angles will ...
 
constexpr double DEG2RAD(const double x)
Degrees to radians. 
 
void doProcess() override
Main method for a CGenericSensor. 
 
This namespace contains representation of robot actions and observations. 
 
This object renders a 2D laser scan by means of three elements: the points, the line along end-points...
 
#define ASSERTMSG_(f, __ERROR_MSG)
Defines an assertion mechanism. 
 
double read_double(const std::string §ion, const std::string &name, double defaultValue, bool failIfNotFound=false) const
 
mrpt::obs::CObservation2DRangeScan::TListExclusionAreasWithRanges m_lstExclusionPolys
A list of optional exclusion polygons, in coordinates relative to the vehicle, that is...
 
mrpt::obs::CObservation2DRangeScan::Ptr m_nextObservation
A dynamic object used as buffer in doProcess. 
 
#define MRPT_LOG_THROTTLE_ERROR(_PERIOD_SECONDS, _STRING)
 
const_iterator end() const
 
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries. 
 
A "CObservation"-derived class that represents a 2D range scan measurement (typically from a laser sc...
 
std::shared_ptr< mrpt::io::CStream > m_stream
The I/O channel (will be nullptr if not bound). 
 
bool internal_notifyNoScanReceived()
Must be called from doProcessSimple() implementations. 
 
bool read_bool(const std::string §ion, const std::string &name, bool defaultValue, bool failIfNotFound=false) const
 
bool m_showPreview
If true, shows a 3D window with a preview of the grabber data. 
 
void loadCommonParams(const mrpt::config::CConfigFileBase &configSource, const std::string &iniSection)
Should be call by derived classes at "loadConfig" (loads exclusion areas AND exclusion angles)...
 
int m_failure_waiting_scan_counter
Used in internal_notifyNoScanReceived() 
 
void processPreview(const mrpt::obs::CObservation2DRangeScan &obs)
Must be called inside the capture method to allow optional GUI preview of scans. 
 
The namespace for 3D scene representation and rendering. 
 
std::mutex m_csLastObservation
 
double timeDifference(const mrpt::system::TTimeStamp t_first, const mrpt::system::TTimeStamp t_later)
Returns the time difference from t1 to t2 (positive if t2 is posterior to t1), in seconds...
 
~C2DRangeFinderAbstract() override
Destructor. 
 
void filterByExclusionAreas(const TListExclusionAreas &areas)
Mark as invalid sensed points that fall within any of a set of "exclusion areas", given in coordinate...
 
#define INVALID_TIMESTAMP
Represents an invalid timestamp, where applicable. 
 
bool m_lastObservationIsNew
 
void read_vector(const std::string §ion, const std::string &name, const VECTOR_TYPE &defaultValue, VECTOR_TYPE &outValues, bool failIfNotFound=false) const
Reads a configuration parameter of type vector, stored in the file as a string: "[v1 v2 v3 ...