25 C2DRangeFinderAbstract::C2DRangeFinderAbstract() :
26 mrpt::utils::COutputLogger(
"C2DRangeFinderAbstract"),
27 m_lastObservation ( ),
28 m_lastObservationIsNew ( false ),
29 m_hardwareError ( false ),
31 m_showPreview ( false ),
57 bool &outThereIsObservation,
66 if (outThereIsObservation)
77 bool thereIs, hwError;
117 vector<double>
x,
y, z_range;
118 configSource.
read_vector( iniSection,
format(
"exclusionZone%u_x",N), vector<double>(0),
x);
119 configSource.
read_vector( iniSection,
format(
"exclusionZone%u_y",N), vector<double>(0),
y);
120 configSource.
read_vector( iniSection,
format(
"exclusionZone%u_z",N++), vector<double>(0), z_range);
122 if (!
x.empty() && !
y.empty())
126 CObservation2DRangeScan::TListExclusionAreasWithRanges::value_type dat;
128 dat.first.setAllVertices(
x,
y);
131 dat.second.first = -std::numeric_limits<double>::max();
132 dat.second.second = std::numeric_limits<double>::max();
136 ASSERTMSG_(z_range.size()==2,
"exclusionZone%u_z must be a range [z_min z_max]");
137 ASSERT_(z_range[0]<=z_range[1]);
139 dat.second.first = z_range[0];
140 dat.second.second = z_range[1];
191 m_win->setCameraAzimuthDeg(180);
192 m_win->setCameraElevationDeg(90);
193 COpenGLScenePtr &theScene =
m_win->get3DSceneAndLock();
194 theScene->insert(CAxisPtr( CAxis::Create(-300,-300,-50, 300,300,50, 1.0, 3,
true ) ));
195 m_win->unlockAccess3DScene();
200 COpenGLScenePtr &theScene =
m_win->get3DSceneAndLock();
201 opengl::CPlanarLaserScanPtr laser;
202 CRenderizablePtr
obj = theScene->getByName(
"laser");
206 laser->setName(
"laser");
208 theScene->insert(laser);
212 laser = CPlanarLaserScanPtr(
obj);
215 m_win->unlockAccess3DScene();
216 m_win->forceRepaint();
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 ...
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
bool read_bool(const std::string §ion, const std::string &name, bool defaultValue, bool failIfNotFound=false) const
Classes for serialization, sockets, ini-file manipulation, streams, list of properties-values, timewatch, extensions to STL.
utils::CStream * m_stream
The I/O channel (will be NULL if not bound).
std::string m_sensorLabel
See CGenericSensor.
#define THROW_EXCEPTION(msg)
mrpt::gui::CDisplayWindow3DPtr m_win
synch::CCriticalSection m_csChangeStream
For being thread-safe.
Contains classes for various device interfaces.
void filterByExclusionAreas(mrpt::obs::CObservation2DRangeScan &obs) const
Mark as invalid those points which (x,y) coordinates fall within the exclusion polygons.
GLsizei GLsizei GLuint * obj
void filterByExclusionAngles(mrpt::obs::CObservation2DRangeScan &obs) const
Mark as invalid those ranges in a set of forbiden angle ranges.
This class allows loading and storing values and vectors of different types from a configuration text...
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 ...
void leave() const MRPT_OVERRIDE
Leave.
This base class is used to provide a unified interface to files,memory buffers,..Please see the deriv...
static CDisplayWindow3DPtr Create()
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 ...
void enter() const MRPT_OVERRIDE
Enter.
This namespace contains representation of robot actions and observations.
virtual ~C2DRangeFinderAbstract()
Destructor.
std::string BASE_IMPEXP format(const char *fmt,...) MRPT_printf_format_check(1
A std::string version of C sprintf.
void bindIO(mrpt::utils::CStream *streamIO)
Binds the object to a given I/O channel.
void loadCommonParams(const mrpt::utils::CConfigFileBase &configSource, const std::string &iniSection)
Should be call by derived classes at "loadConfig" (loads exclusion areas AND exclusion angles)...
GLsizei const GLchar ** string
mrpt::obs::CObservation2DRangeScan::TListExclusionAreasWithRanges m_lstExclusionPolys
A list of optional exclusion polygons, in coordinates relative to the vehicle, that is...
mrpt::obs::CObservation2DRangeScanPtr m_nextObservation
A dynamic object used as buffer in doProcess.
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...
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...
static CPlanarLaserScanPtr Create()
double read_double(const std::string §ion, const std::string &name, double defaultValue, bool failIfNotFound=false) const
bool m_showPreview
If true, shows a 3D window with a preview of the grabber data.
void doProcess()
Main method for a CGenericSensor.
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.
void appendObservation(const mrpt::utils::CSerializablePtr &obj)
Like appendObservations() but for just one observation.
GLenum GLsizei GLenum format
void filterByExclusionAreas(const TListExclusionAreas &areas)
Mark as invalid sensed points that fall within any of a set of "exclusion areas", given in coordinate...
#define ASSERTMSG_(f, __ERROR_MSG)
synch::CCriticalSection m_csLastObservation
bool m_lastObservationIsNew