Laelaps  2.3.5
RoadNarrows Robotics Small Outdoor Mobile Robot Project
sensor::vl6180::LaeRangeSensorGroup Class Reference

Range sensor group class. More...

#include <laeVL6180.h>

Public Member Functions

 LaeRangeSensorGroup (laelaps::LaeI2C &i2cBus)
 Default constructor. More...
 
 ~LaeRangeSensorGroup ()
 Destructor.
 
virtual void blacklist ()
 Black list range sensor group from robot sensors.
 
virtual void whitelist ()
 White list range sensor group from robot sensors.
 
virtual bool isBlackListed ()
 Test if range sensor group is black listed. More...
 
int setInterface (uint_t uProdHwVer)
 Set the interface, given the Laelaps hardware version. More...
 
void clearSensedData ()
 Clear sensed data.
 
virtual int getInterfaceVersion (uint_t &uVerMajor, uint_t &uVerMinor, uint_t &uFwVer)
 Get interface version. More...
 
virtual int configure (const laelaps::LaeDesc &desc)
 Configure sensor group from product description. More...
 
virtual int configure (const laelaps::LaeTunes &tunes)
 Configure sensor group from tuning parameters. More...
 
virtual int reload (const laelaps::LaeTunes &tunes)
 Reload configuration tuning parameters. More...
 
virtual int getSensorProps (const std::string &strKey, std::string &strRadiationType, double &fFoV, double &fBeamDir, double &fMin, double &fMax)
 Get range sensor properties. More...
 
virtual int readSensorIdentity (const std::string &strKey, VL6180xIdentification &ident)
 Read sensor's identification. More...
 
virtual int readSensorTunes (const std::string &strKey, uint_t &uRangeOffset, uint_t &uRangeCrossTalk, double &fAlsGain, uint_t &uAlsIntPeriod)
 Read sensor's current tuning parameters. More...
 
virtual int getRange (const std::string &strKey, double &fRange)
 Get the shadowed range measurement. More...
 
virtual int getRange (std::vector< std::string > &vecNames, std::vector< double > &vecRanges)
 Get all shadowed sensor range measurements. More...
 
virtual int getAmbientLight (const std::string &strKey, double &fAmbient)
 Get the shadowed ambient light illuminance measurement. More...
 
virtual int getAmbientLight (std::vector< std::string > &vecNames, std::vector< double > &vecAmbient)
 Get all shadowed sensor ambient light illuminance measurements. More...
 
virtual void exec ()
 Execute task in one cycle to take measurements. More...
 

Protected Attributes

laelaps::LaeI2Cm_i2cBus
 bound I2C bus instance
 
LaeRangeInterfacem_interface
 the interface
 
bool m_bBlackListed
 sensor group [not] black listed.
 

Detailed Description

Range sensor group class.

Laelaps sensor hardware had major changes between v2.0 and v2.1.

Definition at line 1535 of file laeVL6180.h.

Constructor & Destructor Documentation

LaeRangeSensorGroup::LaeRangeSensorGroup ( laelaps::LaeI2C i2cBus)

Default constructor.

Parameters
i2cBusI2C interface.

Definition at line 2340 of file laeVL6180.cxx.

References m_bBlackListed, and m_interface.

2340  :
2341  m_i2cBus(i2cBus)
2342 {
2343  m_interface = new LaeRangeInterface(i2cBus); // no-op version
2344  m_bBlackListed = false;
2345  RtDb.m_enable.m_bRange = true;
2346 }
LaeRangeInterface * m_interface
the interface
Definition: laeVL6180.h:1732
Range sensors interface base class.
Definition: laeVL6180.h:779
bool m_bBlackListed
sensor group [not] black listed.
Definition: laeVL6180.h:1733
laelaps::LaeI2C & m_i2cBus
bound I2C bus instance
Definition: laeVL6180.h:1731

Member Function Documentation

int LaeRangeSensorGroup::configure ( const laelaps::LaeDesc desc)
virtual

Configure sensor group from product description.

Parameters
descProduct description.
Returns
On success, OK(0) is returned.
On error, RC_ERROR(-1) is returned.

Definition at line 2401 of file laeVL6180.cxx.

References sensor::vl6180::LaeRangeInterface::configure(), isBlackListed(), and m_interface.

Referenced by laelaps::LaeRobot::configForOperation().

2402 {
2403  if( !isBlackListed() )
2404  {
2405  return m_interface->configure(desc);
2406  }
2407  else
2408  {
2409  return LAE_OK;
2410  }
2411 }
LaeRangeInterface * m_interface
the interface
Definition: laeVL6180.h:1732
virtual int configure(const laelaps::LaeDesc &desc)
Configure sensor array from product description.
Definition: laeVL6180.h:834
virtual bool isBlackListed()
Test if range sensor group is black listed.
Definition: laeVL6180.h:1565
int LaeRangeSensorGroup::configure ( const laelaps::LaeTunes tunes)
virtual

Configure sensor group from tuning parameters.

Parameters
tunesTuning parameters.
Returns
On success, OK(0) is returned.
On error, RC_ERROR(-1) is returned.

Definition at line 2413 of file laeVL6180.cxx.

References sensor::vl6180::LaeRangeInterface::configure(), isBlackListed(), and m_interface.

2414 {
2415  if( !isBlackListed() )
2416  {
2417  return m_interface->configure(tunes);
2418  }
2419  else
2420  {
2421  return LAE_OK;
2422  }
2423 }
LaeRangeInterface * m_interface
the interface
Definition: laeVL6180.h:1732
virtual int configure(const laelaps::LaeDesc &desc)
Configure sensor array from product description.
Definition: laeVL6180.h:834
virtual bool isBlackListed()
Test if range sensor group is black listed.
Definition: laeVL6180.h:1565
void LaeRangeSensorGroup::exec ( )
virtual

Execute task in one cycle to take measurements.

Context:
LaeThreadRange thread instance.

Definition at line 2513 of file laeVL6180.cxx.

References sensor::vl6180::LaeRangeInterface::exec(), isBlackListed(), and m_interface.

Referenced by laelaps::LaeThreadRange::exec().

2514 {
2515  if( !isBlackListed() )
2516  {
2517  m_interface->exec();
2518  }
2519 }
virtual void exec()
Execute task in one cycle to take measurements.
Definition: laeVL6180.h:869
LaeRangeInterface * m_interface
the interface
Definition: laeVL6180.h:1732
virtual bool isBlackListed()
Test if range sensor group is black listed.
Definition: laeVL6180.h:1565
virtual int sensor::vl6180::LaeRangeSensorGroup::getAmbientLight ( const std::string &  strKey,
double &  fAmbient 
)
virtual

Get the shadowed ambient light illuminance measurement.

The exec() call pulls the measured sensed from the actual sensors.

Parameters
strKeySensor's unique name (key).
[out]fAmbientSensed ambient light (lux).
Returns
On success, OK(0) is returned.
On error, RC_ERROR(-1) is returned.

Referenced by laelaps::LaeRobot::getRangeSensorProps(), and readSensorTunes().

virtual int sensor::vl6180::LaeRangeSensorGroup::getAmbientLight ( std::vector< std::string > &  vecNames,
std::vector< double > &  vecAmbient 
)
virtual

Get all shadowed sensor ambient light illuminance measurements.

The exec() call pulls the measured sensed from the actual sensors.

Parameters
strKeySensor's unique name (key).
[out]vecAmbientVector of associated sensor measured ambients (lux).
Returns
On success, OK(0) is returned.
On error, RC_ERROR(-1) is returned.
int LaeRangeSensorGroup::getInterfaceVersion ( uint_t &  uVerMajor,
uint_t &  uVerMinor,
uint_t &  uFwVer 
)
virtual

Get interface version.

Parameters
[out]uVerMajorInterface version major number.
[out]uVerMinorInterface version minor number.
[out]uFwVerFirmware version.
Returns
On success, OK(0) is returned.
On error, RC_ERROR(-1) is returned.

Definition at line 2393 of file laeVL6180.cxx.

References sensor::vl6180::LaeRangeInterface::getInterfaceVersion(), and m_interface.

Referenced by laelaps::LaeRobot::connSensors().

2396 {
2397  // ignore blacklist
2398  return m_interface->getInterfaceVersion(uVerMajor, uVerMinor, uFwVer);
2399 }
virtual int getInterfaceVersion(uint_t &uVerMajor, uint_t &uVerMinor, uint_t &uFwVer)
Get interface version.
Definition: laeVL6180.h:809
LaeRangeInterface * m_interface
the interface
Definition: laeVL6180.h:1732
virtual int sensor::vl6180::LaeRangeSensorGroup::getRange ( const std::string &  strKey,
double &  fRange 
)
virtual

Get the shadowed range measurement.

The exec() call pulls the measured sensed from the actual sensors.

Parameters
strKeySensor's unique name (key).
[out]fRangeSensed object range (meters).
Returns
On success, OK(0) is returned.
On error, RC_ERROR(-1) is returned.

Referenced by laelaps::LaeRobot::getRangeSensorProps(), and readSensorTunes().

virtual int sensor::vl6180::LaeRangeSensorGroup::getRange ( std::vector< std::string > &  vecNames,
std::vector< double > &  vecRanges 
)
virtual

Get all shadowed sensor range measurements.

The exec() call pulls the measured sensed from the actual sensors.

Parameters
[out]vecNamesVector of sensor unique names.
[out]vecRangesVector of associated sensor measured ranges (meters).
Returns
On success, OK(0) is returned.
On error, RC_ERROR(-1) is returned.
int LaeRangeSensorGroup::getSensorProps ( const std::string &  strKey,
std::string &  strRadiationType,
double &  fFoV,
double &  fBeamDir,
double &  fMin,
double &  fMax 
)
virtual

Get range sensor properties.

Parameters
strKeySensor's unique name id (key).
[out]strRadiationTypeRadiation type.
[out]fFoVField of View (radians).
[out]fBeamdirCenter of beam direction (radians).
[out]fMinMinimum range (meters).
[out]fMaxMaximum range (meters).
Returns
On success, OK(0) is returned.
On error, RC_ERROR(-1) is returned.

Definition at line 2437 of file laeVL6180.cxx.

References sensor::vl6180::LaeRangeInterface::getSensorProps(), and m_interface.

Referenced by laelaps::LaeRobot::getRangeSensorProps().

2443 {
2444  // read-only data - nothing to blacklist
2445  return m_interface->getSensorProps(strKey,
2446  strRadiationType,
2447  fFoV, fBeamDir,
2448  fMin, fMax);
2449 }
LaeRangeInterface * m_interface
the interface
Definition: laeVL6180.h:1732
virtual int getSensorProps(const std::string &strKey, std::string &strRadiationType, double &fFoV, double &fBeamDir, double &fMin, double &fMax)
Get range sensor properties.
Definition: laeVL6180.h:942
virtual bool sensor::vl6180::LaeRangeSensorGroup::isBlackListed ( )
inlinevirtual

Test if range sensor group is black listed.

Returns
Returns true or false.

Definition at line 1565 of file laeVL6180.h.

Referenced by configure(), exec(), readSensorIdentity(), readSensorTunes(), and reload().

1566  {
1567  return m_bBlackListed;
1568  }
bool m_bBlackListed
sensor group [not] black listed.
Definition: laeVL6180.h:1733
int LaeRangeSensorGroup::readSensorIdentity ( const std::string &  strKey,
VL6180xIdentification ident 
)
virtual

Read sensor's identification.

Parameters
strKeySensor's unique name id (key).
[out]identIdentification structure.
Returns
On success, OK(0) is returned.
On error, RC_ERROR(-1) is returned.

Definition at line 2451 of file laeVL6180.cxx.

References isBlackListed(), m_interface, and sensor::vl6180::LaeRangeInterface::readSensorIdentity().

2454 {
2455  if( !isBlackListed() )
2456  {
2457  m_interface->readSensorIdentity(strKey, ident);
2458  }
2459  else
2460  {
2461  memset(&ident, 0, sizeof(VL6180xIdentification));
2462  return LAE_OK;
2463  }
2464 }
LaeRangeInterface * m_interface
the interface
Definition: laeVL6180.h:1732
virtual int readSensorIdentity(const std::string &strKey, VL6180xIdentification &ident)
Read sensor&#39;s identification.
Definition: laeVL6180.h:960
virtual bool isBlackListed()
Test if range sensor group is black listed.
Definition: laeVL6180.h:1565
int LaeRangeSensorGroup::readSensorTunes ( const std::string &  strKey,
uint_t &  uRangeOffset,
uint_t &  uRangeCrossTalk,
double &  fAlsGain,
uint_t &  uAlsIntPeriod 
)
virtual

Read sensor's current tuning parameters.

Parameters
strKeySensor's unique name id (key).
[out]uRangeOffsetToF sensor part-to-part offset.
[out]uRangeCrossTalkToF sensor cross-talk compensation.
[out]fAlsGainAmbient light sensor analog gain.
[out]uAlsIntPeriodAmbient light sensor integration period (msec).
Returns
On success, OK(0) is returned.
On error, RC_ERROR(-1) is returned.

Definition at line 2466 of file laeVL6180.cxx.

References sensor::vl6180::LaeRangeInterface::getAmbientLight(), getAmbientLight(), sensor::vl6180::LaeRangeInterface::getRange(), getRange(), isBlackListed(), m_interface, and sensor::vl6180::LaeRangeInterface::readSensorTunes().

2471 {
2472  if( !isBlackListed() )
2473  {
2474  m_interface->readSensorTunes(strKey, uRangeOffset, uRangeCrossTalk,
2475  fAlsGain, uAlsIntPeriod);
2476  }
2477  else
2478  {
2479  uRangeOffset = 0;
2480  uRangeCrossTalk = 0;
2481  fAlsGain = 0.0;
2482  uAlsIntPeriod = 0;
2483  return LAE_OK;
2484  }
2485 }
LaeRangeInterface * m_interface
the interface
Definition: laeVL6180.h:1732
virtual int readSensorTunes(const std::string &strKey, uint_t &uRangeOffset, uint_t &uRangeCrossTalk, double &fAlsGain, uint_t &uAlsIntPeriod)
Read sensor&#39;s current tuning parameters.
Definition: laeVL6180.h:978
virtual bool isBlackListed()
Test if range sensor group is black listed.
Definition: laeVL6180.h:1565
int LaeRangeSensorGroup::reload ( const laelaps::LaeTunes tunes)
virtual

Reload configuration tuning parameters.

Parameters
tunesTuning parameters.
Returns
On success, OK(0) is returned.
On error, RC_ERROR(-1) is returned.

Definition at line 2425 of file laeVL6180.cxx.

References isBlackListed(), m_interface, and sensor::vl6180::LaeRangeInterface::reload().

Referenced by laelaps::LaeThreadRange::reload().

2426 {
2427  if( !isBlackListed() )
2428  {
2429  return m_interface->reload(tunes);
2430  }
2431  else
2432  {
2433  return LAE_OK;
2434  }
2435 }
LaeRangeInterface * m_interface
the interface
Definition: laeVL6180.h:1732
virtual int reload(const laelaps::LaeTunes &tunes)
Reload configuration tuning parameters.
Definition: laeVL6180.h:858
virtual bool isBlackListed()
Test if range sensor group is black listed.
Definition: laeVL6180.h:1565
int LaeRangeSensorGroup::setInterface ( uint_t  uProdHwVer)

Set the interface, given the Laelaps hardware version.

Returns
On success, OK(0) is returned.
On error, RC_ERROR(-1) is returned.

Definition at line 2368 of file laeVL6180.cxx.

References LAE_VERSION, m_i2cBus, and m_interface.

Referenced by laelaps::LaeRobot::connSensors().

2369 {
2370  if( m_interface != NULL )
2371  {
2372  delete m_interface;
2373  m_interface = NULL;
2374  }
2375 
2376  if( uProdHwVer >= LAE_VERSION(2, 1, 0) )
2377  {
2379  }
2380  else
2381  {
2383  }
2384 
2385  return LAE_OK;
2386 }
Multiplexed range sensors class.
Definition: laeVL6180.h:1211
LaeRangeInterface * m_interface
the interface
Definition: laeVL6180.h:1732
#define LAE_VERSION(major, minor, revision)
Convert version triplet to integer equivalent.
Definition: laelaps.h:158
laelaps::LaeI2C & m_i2cBus
bound I2C bus instance
Definition: laeVL6180.h:1731
VL6180 Time of Flight Array Class.
Definition: laeVL6180.h:1005

The documentation for this class was generated from the following files: