![]() |
Laelaps
2.3.5
RoadNarrows Robotics Small Outdoor Mobile Robot Project
|
Multiplexed range sensors class. More...
#include <laeVL6180.h>
Public Types | |
typedef std::map< std::string, LaeVL6180SensorInfo > | SensorInfoMap |
Sensor information map type. | |
Public Member Functions | |
LaeRangeMuxSubproc (laelaps::LaeI2C &i2cBus, uint_t addr=laelaps::LaeI2CAddrToFMux) | |
Initialization constructor. More... | |
virtual | ~LaeRangeMuxSubproc () |
Destructor. | |
virtual int | getInterfaceVersion (uint_t &uVerMajor, uint_t &uVerMinor, uint_t &uFwVer) |
Get interface version. More... | |
virtual void | clearSensedData () |
Clear sensed data. | |
virtual int | configure (const laelaps::LaeDesc &desc) |
Configure sensor array from product description. More... | |
virtual int | configure (const laelaps::LaeTunes &tunes) |
Configure sensor array from tuning parameters. More... | |
virtual int | reload (const laelaps::LaeTunes &tunes) |
Reload configuration tuning parameters. More... | |
virtual void | exec () |
Execute one cycle to take measurements. More... | |
virtual int | getRange (const std::string &strKey, double &fRange) |
Get a range measurement. More... | |
virtual int | getRange (std::vector< std::string > &vecNames, std::vector< double > &vecRanges) |
Get all sensor range measurements. More... | |
virtual int | getAmbientLight (const std::string &strKey, double &fAmbient) |
Get an ambient light illuminance measurement. More... | |
virtual int | getAmbientLight (std::vector< std::string > &vecNames, std::vector< double > &vecAmbient) |
Get all sensor ambient light illuminance measurements. 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... | |
![]() | |
LaeRangeInterface (laelaps::LaeI2C &i2cBus) | |
Initialization constructor. More... | |
virtual | ~LaeRangeInterface () |
Destructor. | |
Static Public Attributes | |
static const long | TStd = 100 |
standard wait write_read (usec) | |
Protected Member Functions | |
void | lock () |
Lock the share resource. More... | |
void | unlock () |
Unlock the shared resource. More... | |
virtual int | cmdGetFwVersion (uint_t &uVerNum) |
Get the firmware version command. More... | |
int | cmdGetIdent (const std::string &strKey, VL6180xIdentification &ident) |
Read sensor identification command. More... | |
int | cmdGetTunes (const std::string &strKey, uint_t &uRangeOffset, uint_t &uRangeCrossTalk, double &fAlsGain, uint_t &uAlsIntPeriod) |
Read exported tuning parameters command. More... | |
int | cmdGetRanges (std::vector< double > &vecRanges) |
Get measured object distances. More... | |
int | cmdGetAmbientLight (std::vector< double > &vecLux) |
Get measured ambient light illumination. More... | |
int | cmdTuneToFSensor (const std::string &strKey, uint_t uRangeOffset, uint_t uRangeCrossTalk) |
Tune time-of-flight range sensor command. More... | |
int | cmdTuneAls (const std::string &strKey, double fAlsGain, uint_t uAlsIntPeriod) |
Tune ambient light sensor command. More... | |
int | cmdGetRanges () |
Get range distance measurments command. More... | |
int | cmdGetAmbientLight () |
Get ambient light measurments command. More... | |
Protected Attributes | |
uint_t | m_addrSubProc |
I2C sub-processor address. | |
uint_t | m_uFwVer |
firmware version number | |
SensorInfoMap | m_mapInfo |
map of sensor properties by key | |
std::vector< double > | m_vecRanges |
measured distances (meters) | |
std::vector< double > | m_vecLux |
measured ambient light (lux) | |
pthread_mutex_t | m_mutex |
mutex | |
![]() | |
laelaps::LaeI2C & | m_i2cBus |
bound I2C bus instance | |
Multiplexed range sensors class.
The interface between the processor and the sensors is through an I2C connected sub-processor. Since the sub-processor (mostly) hides the specific sensor hardware, this class is more general.
Used in 2.1+ hardware.
Definition at line 1211 of file laeVL6180.h.
LaeRangeMuxSubproc::LaeRangeMuxSubproc | ( | laelaps::LaeI2C & | i2cBus, |
uint_t | addr = laelaps::LaeI2CAddrToFMux |
||
) |
Initialization constructor.
i2cbus | Bound open I2C bus instance. |
addr | ToF multiplexor sub-processor I2C address. |
Definition at line 1606 of file laeVL6180.cxx.
References m_mutex, and m_uFwVer.
|
protected |
Get measured ambient light illumination.
[out] | vecLux | Vector of illuminations (lux). |
Definition at line 2037 of file laeVL6180.cxx.
References cmdGetAmbientLight(), and m_vecLux.
|
protected |
Get ambient light measurments command.
Definition at line 1995 of file laeVL6180.cxx.
References lock(), m_addrSubProc, sensor::vl6180::LaeRangeInterface::m_i2cBus, TStd, unlock(), and laelaps::LaeI2C::write_read().
Referenced by cmdGetAmbientLight(), and exec().
|
protectedvirtual |
Get the firmware version command.
[out] | uVerNum | Firmware version number. |
Definition at line 1856 of file laeVL6180.cxx.
References lock(), m_addrSubProc, sensor::vl6180::LaeRangeInterface::m_i2cBus, m_uFwVer, TStd, unlock(), and laelaps::LaeI2C::write_read().
Referenced by configure(), getInterfaceVersion(), and Laelaps.WatchDog.WatchDog::sync().
|
protected |
Read sensor identification command.
[out] | id | Identification structure. |
Definition at line 1882 of file laeVL6180.cxx.
References lock(), m_addrSubProc, sensor::vl6180::LaeRangeInterface::m_i2cBus, m_mapInfo, TStd, unlock(), and laelaps::LaeI2C::write_read().
Referenced by configure(), and readSensorIdentity().
|
protected |
Get measured object distances.
[out] | vecRanges | Vector of distances (mm). |
Definition at line 1983 of file laeVL6180.cxx.
References cmdGetRanges(), and m_vecRanges.
|
protected |
Get range distance measurments command.
Definition at line 1934 of file laeVL6180.cxx.
References lock(), m_addrSubProc, sensor::vl6180::LaeRangeInterface::m_i2cBus, m_vecRanges, TStd, unlock(), VL6180X_ERR_MEAS, VL6180X_RANGE_MIN, VL6180X_RANGE_NO_OBJ, and laelaps::LaeI2C::write_read().
Referenced by cmdGetRanges(), and exec().
|
protected |
Read exported tuning parameters command.
[out] | uRangeOffset | ToF sensor part-to-part offset. |
[out] | uRangeCrossTalk | ToF sensor cross-talk compensation. |
[out] | fAlsGain | Ambient light sensor analog gain. |
[out] | uAlsIntPeriod | Ambient light sensor integration period (msec). |
Definition at line 2049 of file laeVL6180.cxx.
References sensor::vl6180::LaeVL6180Mux::gainEnumToAnalog(), lock(), m_addrSubProc, sensor::vl6180::LaeRangeInterface::m_i2cBus, m_mapInfo, m_uFwVer, TStd, unlock(), and laelaps::LaeI2C::write_read().
Referenced by configure(), and readSensorTunes().
|
protected |
Tune ambient light sensor command.
fAlsGain | Ambient light sensor analog gain. |
uAlsIntPeriod | Ambient light sensor integration period (msec). |
Definition at line 2173 of file laeVL6180.cxx.
References laelaps::cap(), sensor::vl6180::LaeVL6180Mux::gainAnalogToEnum(), lock(), m_addrSubProc, sensor::vl6180::LaeRangeInterface::m_i2cBus, m_mapInfo, TStd, unlock(), VL6180X_AMBIENT_INT_T_MAX, VL6180X_AMBIENT_INT_T_MIN, and laelaps::LaeI2C::write_read().
Referenced by configure().
|
protected |
Tune time-of-flight range sensor command.
uRangeOffset | ToF sensor part-to-part offset. If VL6180X_FACTORY_DFT then leave as is. |
uRangeCrossTalk | ToF sensor cross-talk compensation. If VL6180X_FACTORY_DFT then leave as is. |
Definition at line 2112 of file laeVL6180.cxx.
References laelaps::cap(), lock(), m_addrSubProc, sensor::vl6180::LaeRangeInterface::m_i2cBus, m_mapInfo, m_uFwVer, TStd, unlock(), VL6180X_RANGE_OFFSET_MAX, VL6180X_RANGE_OFFSET_MIN, VL6180X_RANGE_XTALK_MAX, VL6180X_RANGE_XTALK_MIN, and laelaps::LaeI2C::write_read().
Referenced by configure().
|
virtual |
Configure sensor array from product description.
desc | Product description. |
Reimplemented from sensor::vl6180::LaeRangeInterface.
Definition at line 1651 of file laeVL6180.cxx.
References cmdGetFwVersion(), cmdGetIdent(), cmdGetTunes(), getSensorProps(), laelaps::LaeDesc::m_mapDescRangeSensor, m_mapInfo, m_uFwVer, and laelaps::radToDeg().
Referenced by reload().
|
virtual |
Configure sensor array from tuning parameters.
tunes | Tuning parameters. |
Reimplemented from sensor::vl6180::LaeRangeInterface.
Definition at line 1780 of file laeVL6180.cxx.
References cmdTuneAls(), cmdTuneToFSensor(), laelaps::LaeTunes::getVL6180Params(), m_mapInfo, and VL6180X_FACTORY_DFT.
|
virtual |
Execute one cycle to take measurements.
Reimplemented from sensor::vl6180::LaeRangeInterface.
Definition at line 1847 of file laeVL6180.cxx.
References cmdGetAmbientLight(), and cmdGetRanges().
|
virtual |
Get an ambient light illuminance measurement.
strKey | Sensor's unique name (key). | |
[out] | fAmbient | Sensed ambient light (lux). |
Reimplemented from sensor::vl6180::LaeRangeInterface.
Definition at line 2259 of file laeVL6180.cxx.
References m_mapInfo, and m_vecLux.
|
virtual |
Get all sensor ambient light illuminance measurements.
[out] | vecNames | Vector of sensor unique names. |
[out] | vecAmbient | Vector of associated sensor measured ambients (lux). |
Reimplemented from sensor::vl6180::LaeRangeInterface.
Definition at line 2276 of file laeVL6180.cxx.
References m_mapInfo, and m_vecLux.
|
virtual |
Get interface version.
[out] | uVerMajor | Interface version major number. |
[out] | uVerMinor | Interface version minor number. |
[out] | uFwVer | Firmware version. |
Reimplemented from sensor::vl6180::LaeRangeInterface.
Definition at line 1621 of file laeVL6180.cxx.
References cmdGetFwVersion(), LAE_VER_MAJOR, LAE_VER_MINOR, and m_uFwVer.
|
virtual |
Get a range measurement.
strKey | Sensor's unique name (key). | |
[out] | fRange | Sensed object range (meters). |
Reimplemented from sensor::vl6180::LaeRangeInterface.
Definition at line 2225 of file laeVL6180.cxx.
References m_mapInfo, and m_vecRanges.
|
virtual |
Get all sensor range measurements.
[out] | vecNames | Vector of sensor unique names. |
[out] | vecRanges | Vector of associated sensor measured ranges (meters). |
Reimplemented from sensor::vl6180::LaeRangeInterface.
Definition at line 2242 of file laeVL6180.cxx.
References m_mapInfo, and m_vecRanges.
|
virtual |
Get range sensor properties.
strKey | Sensor's unique name id (key). | |
[out] | strRadiationType | Radiation type. |
[out] | fFoV | Field of View (radians). |
[out] | fBeamdir | Center of beam direction (radians). |
[out] | fMin | Minimum range (meters). |
[out] | fMax | Maximum range (meters). |
Reimplemented from sensor::vl6180::LaeRangeInterface.
Definition at line 2292 of file laeVL6180.cxx.
References m_mapInfo.
Referenced by configure().
|
inlineprotected |
Lock the share resource.
The lock()/unlock() primitives provide a thread safe mechanism.
Definition at line 1408 of file laeVL6180.h.
Referenced by cmdGetAmbientLight(), cmdGetFwVersion(), cmdGetIdent(), cmdGetRanges(), cmdGetTunes(), cmdTuneAls(), and cmdTuneToFSensor().
|
virtual |
Read sensor's identification.
strKey | Sensor's unique name id (key). | |
[out] | ident | Identification structure. |
Reimplemented from sensor::vl6180::LaeRangeInterface.
Definition at line 2318 of file laeVL6180.cxx.
References cmdGetIdent().
|
virtual |
Read sensor's current tuning parameters.
strKey | Sensor's unique name id (key). | |
[out] | uRangeOffset | ToF sensor part-to-part offset. |
[out] | uRangeCrossTalk | ToF sensor cross-talk compensation. |
[out] | fAlsGain | Ambient light sensor analog gain. |
[out] | uAlsIntPeriod | Ambient light sensor integration period (msec). |
Reimplemented from sensor::vl6180::LaeRangeInterface.
Definition at line 2325 of file laeVL6180.cxx.
References cmdGetTunes().
|
virtual |
Reload configuration tuning parameters.
tunes | Tuning parameters. |
Reimplemented from sensor::vl6180::LaeRangeInterface.
Definition at line 1840 of file laeVL6180.cxx.
References configure().
|
inlineprotected |
Unlock the shared resource.
Definition at line 1419 of file laeVL6180.h.
Referenced by cmdGetAmbientLight(), cmdGetFwVersion(), cmdGetIdent(), cmdGetRanges(), cmdGetTunes(), cmdTuneAls(), and cmdTuneToFSensor().