MRPT logo

mrpt::hwdrivers::C2DRangeFinderAbstract Class Reference

This is the base, abstract class for "software drivers" interfaces to 2D scanners (laser range finders). More...

#include <mrpt/hwdrivers/C2DRangeFinderAbstract.h>

Inheritance diagram for mrpt::hwdrivers::C2DRangeFinderAbstract:

mrpt::utils::CDebugOutputCapable mrpt::hwdrivers::CGenericSensor mrpt::utils::CUncopiable mrpt::hwdrivers::CHokuyoURG mrpt::hwdrivers::CSickLaserUSB

List of all members.

Public Member Functions

 C2DRangeFinderAbstract ()
 Default constructor.
virtual ~C2DRangeFinderAbstract ()
 Destructor.
void bindIO (CStream *streamIO)
 Binds the object to a given I/O channel.
void getObservation (bool &outThereIsObservation, mrpt::slam::CObservation2DRangeScan &outObservation, bool &hardwareError)
 Get the last observation from the sensor, if available, and unmarks it as being "the last one" (thus a new scan must arrive or subsequent calls will find no new observations).
void doProcess ()
 Main method for a CGenericSensor.
virtual void doProcessSimple (bool &outThereIsObservation, mrpt::slam::CObservation2DRangeScan &outObservation, bool &hardwareError)=0
 Specific laser scanner "software drivers" must process here new data from the I/O stream, and, if a whole scan has arrived, return it.
virtual bool turnOn ()=0
 Enables the scanning mode (which may depend on the specific laser device); this must be called before asking for observations to assure that the protocol has been initializated.
virtual bool turnOff ()=0
 Disables the scanning mode (this can be used to turn the device in low energy mode, if available).

Protected Member Functions

void loadExclusionAreas (const mrpt::utils::CConfigFileBase &configSource, const std::string &iniSection)
 Should be call by derived classes at "loadConfig".
void filterByExclusionAreas (mrpt::slam::CObservation2DRangeScan &obs) const
 Mark as invalid those points which (x,y) coordinates fall within the exclusion polygons.

Protected Attributes

utils::CStreamm_stream
 The I/O channel (will be NULL if not bound).

Private Attributes

mrpt::slam::CObservation2DRangeScan m_lastObservation
bool m_lastObservationIsNew
bool m_hardwareError
synch::CCriticalSection m_csChangeStream
 For being thread-safe.
synch::CCriticalSection m_csLastObservation
mrpt::slam::CObservation2DRangeScanPtr m_nextObservation
 A dynamic object used as buffer in doProcess.
std::vector< mrpt::math::CPolygonm_lstExclusionPolys
 A list of optional exclusion polygons, in coordinates relative to the vehicle, that is, taking into account the "sensorPose".


Detailed Description

This is the base, abstract class for "software drivers" interfaces to 2D scanners (laser range finders).

Physical devices may be interfaced through a serial port, a USB connection,etc. but this class abstract those details throught the "binding" of the specific scanner driver to a given I/O channel, which must be set by calling "hwdrivers::C2DRangeFinderAbstract::bindIO". See also the derived classes.

There is support for "exclusion polygons", areas where points, if detected, should be marked as invalid. Those areas are useful in cases where the scanner always detects part of the vehicle itself, and those points want to be ignored.

See also:
hwdrivers::CSerialPort

Definition at line 59 of file C2DRangeFinderAbstract.h.


Constructor & Destructor Documentation

mrpt::hwdrivers::C2DRangeFinderAbstract::C2DRangeFinderAbstract (  ) 

Default constructor.

virtual mrpt::hwdrivers::C2DRangeFinderAbstract::~C2DRangeFinderAbstract (  )  [virtual]

Destructor.


Member Function Documentation

void mrpt::hwdrivers::C2DRangeFinderAbstract::bindIO ( CStream streamIO  ) 

Binds the object to a given I/O channel.

The stream object must not be deleted before the destruction of this class.

See also:
hwdrivers::CSerialPort

void mrpt::hwdrivers::C2DRangeFinderAbstract::doProcess (  )  [virtual]

Main method for a CGenericSensor.

Implements mrpt::hwdrivers::CGenericSensor.

virtual void mrpt::hwdrivers::C2DRangeFinderAbstract::doProcessSimple ( bool &  outThereIsObservation,
mrpt::slam::CObservation2DRangeScan outObservation,
bool &  hardwareError 
) [pure virtual]

Specific laser scanner "software drivers" must process here new data from the I/O stream, and, if a whole scan has arrived, return it.

This method MUST BE CALLED in a timely fashion by the user to allow the proccessing of incoming data. It can be run in a different thread safely.

Implemented in mrpt::hwdrivers::CHokuyoURG, and mrpt::hwdrivers::CSickLaserUSB.

void mrpt::hwdrivers::C2DRangeFinderAbstract::filterByExclusionAreas ( mrpt::slam::CObservation2DRangeScan obs  )  const [protected]

Mark as invalid those points which (x,y) coordinates fall within the exclusion polygons.

See also:
loadExclusionAreas

void mrpt::hwdrivers::C2DRangeFinderAbstract::getObservation ( bool &  outThereIsObservation,
mrpt::slam::CObservation2DRangeScan outObservation,
bool &  hardwareError 
)

Get the last observation from the sensor, if available, and unmarks it as being "the last one" (thus a new scan must arrive or subsequent calls will find no new observations).

void mrpt::hwdrivers::C2DRangeFinderAbstract::loadExclusionAreas ( const mrpt::utils::CConfigFileBase configSource,
const std::string &  iniSection 
) [protected]

Should be call by derived classes at "loadConfig".

This loads a sequence of vertices of a polygon given by its (x,y) coordinates relative to the vehicle, that is, taking into account the "sensorPose".

  • exclusionZoneu_x
  • exclusionZoneu_y for u=1,2,3,... The number of zones is variable, but they must start at 1 and be consecutive.
    See also:
    filterByExclusionAreas

virtual bool mrpt::hwdrivers::C2DRangeFinderAbstract::turnOff (  )  [pure virtual]

Disables the scanning mode (this can be used to turn the device in low energy mode, if available).

Returns:
If everything works "true", or "false" if there is any error.

Implemented in mrpt::hwdrivers::CHokuyoURG, and mrpt::hwdrivers::CSickLaserUSB.

virtual bool mrpt::hwdrivers::C2DRangeFinderAbstract::turnOn (  )  [pure virtual]

Enables the scanning mode (which may depend on the specific laser device); this must be called before asking for observations to assure that the protocol has been initializated.

Returns:
If everything works "true", or "false" if there is any error.

Implemented in mrpt::hwdrivers::CHokuyoURG, and mrpt::hwdrivers::CSickLaserUSB.


Member Data Documentation

For being thread-safe.

Definition at line 68 of file C2DRangeFinderAbstract.h.

Definition at line 68 of file C2DRangeFinderAbstract.h.

Definition at line 64 of file C2DRangeFinderAbstract.h.

Definition at line 62 of file C2DRangeFinderAbstract.h.

Definition at line 63 of file C2DRangeFinderAbstract.h.

A list of optional exclusion polygons, in coordinates relative to the vehicle, that is, taking into account the "sensorPose".

Definition at line 72 of file C2DRangeFinderAbstract.h.

mrpt::slam::CObservation2DRangeScanPtr mrpt::hwdrivers::C2DRangeFinderAbstract::m_nextObservation [private]

A dynamic object used as buffer in doProcess.

Definition at line 70 of file C2DRangeFinderAbstract.h.

The I/O channel (will be NULL if not bound).

Reimplemented from mrpt::utils::CDebugOutputCapable.

Definition at line 77 of file C2DRangeFinderAbstract.h.




Page generated by Doxygen 1.5.7.1 for MRPT 0.6.5 SVN: at Mon Feb 23 13:24:51 EST 2009