Main MRPT website > C++ reference
MRPT logo
Public Member Functions | Protected Member Functions | Protected Attributes | Private Attributes

mrpt::hwdrivers::C2DRangeFinderAbstract Class Reference


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 C2DRangeFinderAbstract::loadExclusionAreas).

See also:
hwdrivers::CSerialPort

Definition at line 62 of file C2DRangeFinderAbstract.h.

#include <mrpt/hwdrivers/C2DRangeFinderAbstract.h>

Inheritance diagram for mrpt::hwdrivers::C2DRangeFinderAbstract:
Inheritance graph
[legend]

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, 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, 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" (loads exclusion areas AND exclusion angles).
void filterByExclusionAreas (CObservation2DRangeScan &obs) const
 Mark as invalid those points which (x,y) coordinates fall within the exclusion polygons.
void filterByExclusionAngles (CObservation2DRangeScan &obs) const
 Mark as invalid those ranges in a set of forbiden angle ranges.

Protected Attributes

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

Private Attributes

CObservation2DRangeScan m_lastObservation
bool m_lastObservationIsNew
bool m_hardwareError
synch::CCriticalSection m_csChangeStream
 For being thread-safe.
synch::CCriticalSection m_csLastObservation
CObservation2DRangeScanPtr m_nextObservation
 A dynamic object used as buffer in doProcess.
CObservation2DRangeScan::TListExclusionAreasWithRanges m_lstExclusionPolys
 A list of optional exclusion polygons, in coordinates relative to the vehicle, that is, taking into account the "sensorPose".
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 be marked as invalid.

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.

Reimplemented in mrpt::hwdrivers::CLMS100Eth.

virtual void mrpt::hwdrivers::C2DRangeFinderAbstract::doProcessSimple ( bool &  outThereIsObservation,
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, mrpt::hwdrivers::CLMS100Eth, mrpt::hwdrivers::CSickLaserSerial, and mrpt::hwdrivers::CSickLaserUSB.

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

Mark as invalid those ranges in a set of forbiden angle ranges.

See also:
loadExclusionAreas
void mrpt::hwdrivers::C2DRangeFinderAbstract::filterByExclusionAreas ( 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,
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" (loads exclusion areas AND exclusion angles).

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,... All points within the 2D polygon will be ignored, for any Z, unless an optional entry is found:
  • exclusionZoneu_z=[z_min z_max] In that case, only the points within the 2D polygon AND the given range in Z will be ignored.

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, mrpt::hwdrivers::CLMS100Eth, mrpt::hwdrivers::CSickLaserSerial, 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, mrpt::hwdrivers::CLMS100Eth, mrpt::hwdrivers::CSickLaserSerial, and mrpt::hwdrivers::CSickLaserUSB.


Member Data Documentation

For being thread-safe.

Definition at line 71 of file C2DRangeFinderAbstract.h.

Definition at line 71 of file C2DRangeFinderAbstract.h.

Definition at line 67 of file C2DRangeFinderAbstract.h.

Definition at line 65 of file C2DRangeFinderAbstract.h.

Definition at line 66 of file C2DRangeFinderAbstract.h.

std::vector<std::pair<double,double> > mrpt::hwdrivers::C2DRangeFinderAbstract::m_lstExclusionAngles [private]

A list of pairs of angles <init,end> such as all sensor ranges falling in those forbiden angles will be marked as invalid.

Definition at line 76 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 75 of file C2DRangeFinderAbstract.h.

A dynamic object used as buffer in doProcess.

Definition at line 73 of file C2DRangeFinderAbstract.h.

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

Definition at line 82 of file C2DRangeFinderAbstract.h.




Page generated by Doxygen 1.7.3 for MRPT 0.9.4 SVN: at Sat Mar 26 06:40:17 UTC 2011