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

Multiplexed range sensors class. More...

#include <laeVL6180.h>

Inheritance diagram for sensor::vl6180::LaeRangeMuxSubproc:
sensor::vl6180::LaeRangeInterface

Public Types

typedef std::map< std::string, LaeVL6180SensorInfoSensorInfoMap
 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...
 
- Public Member Functions inherited from sensor::vl6180::LaeRangeInterface
 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
 
- Protected Attributes inherited from sensor::vl6180::LaeRangeInterface
laelaps::LaeI2Cm_i2cBus
 bound I2C bus instance
 

Detailed Description

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.

Constructor & Destructor Documentation

LaeRangeMuxSubproc::LaeRangeMuxSubproc ( laelaps::LaeI2C i2cBus,
uint_t  addr = laelaps::LaeI2CAddrToFMux 
)

Initialization constructor.

Note
The constructor should be kept light weight.
Parameters
i2cbusBound open I2C bus instance.
addrToF multiplexor sub-processor I2C address.

Definition at line 1606 of file laeVL6180.cxx.

References m_mutex, and m_uFwVer.

1606  :
1607  LaeRangeInterface(i2cBus), m_addrSubProc(addr),
1608  m_vecRanges(ToFSensorMaxNumOf, 0.0),
1609  m_vecLux(ToFSensorMaxNumOf, 0.0)
1610 {
1611  m_uFwVer = 0;
1612 
1613  pthread_mutex_init(&m_mutex, NULL);
1614 }
std::vector< double > m_vecRanges
measured distances (meters)
Definition: laeVL6180.h:1394
pthread_mutex_t m_mutex
mutex
Definition: laeVL6180.h:1398
LaeRangeInterface(laelaps::LaeI2C &i2cBus)
Initialization constructor.
Definition: laeVL6180.h:789
uint_t m_uFwVer
firmware version number
Definition: laeVL6180.h:1388
uint_t m_addrSubProc
I2C sub-processor address.
Definition: laeVL6180.h:1387
std::vector< double > m_vecLux
measured ambient light (lux)
Definition: laeVL6180.h:1395

Member Function Documentation

int LaeRangeMuxSubproc::cmdGetAmbientLight ( std::vector< double > &  vecLux)
protected

Get measured ambient light illumination.

Parameters
[out]vecLuxVector of illuminations (lux).
Returns
On success, OK(0) is returned.
On error, RC_ERROR(-1) is returned.

Definition at line 2037 of file laeVL6180.cxx.

References cmdGetAmbientLight(), and m_vecLux.

2038 {
2039  int rc;
2040 
2041  if( (rc = cmdGetAmbientLight()) == LAE_OK )
2042  {
2043  vecLux = m_vecLux;
2044  }
2045 
2046  return rc;
2047 }
int cmdGetAmbientLight()
Get ambient light measurments command.
Definition: laeVL6180.cxx:1995
std::vector< double > m_vecLux
measured ambient light (lux)
Definition: laeVL6180.h:1395
int LaeRangeMuxSubproc::cmdGetAmbientLight ( )
protected

Get ambient light measurments command.

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

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().

1996 {
1997  byte_t cmd[LaeToFMuxI2CMaxCmdLen];
1998  byte_t rsp[LaeToFMuxI2CMaxRspLen];
1999  size_t lenCmd = 0;
2000  size_t lenRsp = LaeToFMuxI2CRspLenGetLux;
2001  int sensorIndex;
2002  int n;
2003  u32_t val;
2004  double fLux;
2005  int rc;
2006 
2007  lock();
2008 
2009  cmd[lenCmd++] = LaeToFMuxI2CCmdIdGetLux;
2010 
2011  rc = m_i2cBus.write_read(m_addrSubProc, cmd, lenCmd, rsp, lenRsp, TStd);
2012 
2013  if( rc == LAE_OK )
2014  {
2015  n = 0;
2016 
2017  for(sensorIndex = 0; sensorIndex < ToFSensorMaxNumOf; ++sensorIndex)
2018  {
2019  val = 0;
2020  for(int i = 0; i < 4; ++i)
2021  {
2022  val << 8;
2023  val |= rsp[n++];
2024  }
2025 
2026  fLux = (double)val * (double)LaeToFMuxI2CArgLuxScale;
2027 
2028  RtDb.m_range[sensorIndex].m_fAmbientLight = fLux;
2029  }
2030  }
2031 
2032  unlock();
2033 
2034  return rc;
2035 }
virtual int write_read(uint_t addr, const byte_t wbuf[], size_t wlen, byte_t rbuf[], size_t rlen, long usec=0)
Perform a write/read transaction to/from an I2C slave endpoint device.
Definition: laeI2C.cxx:249
laelaps::LaeI2C & m_i2cBus
bound I2C bus instance
Definition: laeVL6180.h:988
void unlock()
Unlock the shared resource.
Definition: laeVL6180.h:1419
void lock()
Lock the share resource.
Definition: laeVL6180.h:1408
static const long TStd
standard wait write_read (usec)
Definition: laeVL6180.h:1217
uint_t m_addrSubProc
I2C sub-processor address.
Definition: laeVL6180.h:1387
int LaeRangeMuxSubproc::cmdGetFwVersion ( uint_t &  uVerNum)
protectedvirtual

Get the firmware version command.

Parameters
[out]uVerNumFirmware version number.
Returns
On success, OK(0) is returned.
On error, RC_ERROR(-1) is returned.

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().

1857 {
1858  byte_t cmd[LaeToFMuxI2CMaxCmdLen];
1859  byte_t rsp[LaeToFMuxI2CMaxRspLen];
1860  size_t lenCmd = 0;
1861  size_t lenRsp = LaeToFMuxI2CRspLenGetVersion;
1862  int rc;
1863 
1864  lock();
1865 
1866  cmd[lenCmd++] = LaeToFMuxI2CCmdIdGetVersion;
1867 
1868  rc = m_i2cBus.write_read(m_addrSubProc, cmd, lenCmd, rsp, lenRsp, TStd);
1869 
1870  if( rc == LAE_OK )
1871  {
1872  uVerNum = (uint_t)rsp[0];
1873  m_uFwVer = uVerNum;
1874  RtDb.m_product.m_uToFMuxFwVer = m_uFwVer;
1875  }
1876 
1877  unlock();
1878 
1879  return rc;
1880 }
virtual int write_read(uint_t addr, const byte_t wbuf[], size_t wlen, byte_t rbuf[], size_t rlen, long usec=0)
Perform a write/read transaction to/from an I2C slave endpoint device.
Definition: laeI2C.cxx:249
laelaps::LaeI2C & m_i2cBus
bound I2C bus instance
Definition: laeVL6180.h:988
void unlock()
Unlock the shared resource.
Definition: laeVL6180.h:1419
void lock()
Lock the share resource.
Definition: laeVL6180.h:1408
uint_t m_uFwVer
firmware version number
Definition: laeVL6180.h:1388
static const long TStd
standard wait write_read (usec)
Definition: laeVL6180.h:1217
uint_t m_addrSubProc
I2C sub-processor address.
Definition: laeVL6180.h:1387
int LaeRangeMuxSubproc::cmdGetIdent ( const std::string &  strKey,
VL6180xIdentification ident 
)
protected

Read sensor identification command.

Parameters
[out]idIdentification structure.
Returns
On success, OK(0) is returned.
On error, RC_ERROR(-1) is returned.

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().

1884 {
1885  byte_t cmd[LaeToFMuxI2CMaxCmdLen];
1886  byte_t rsp[LaeToFMuxI2CMaxRspLen];
1887  size_t lenCmd = 0;
1888  size_t lenRsp = LaeToFMuxI2CRspLenGetIdent;
1889  byte_t sensorIndex;
1890  u16_t val_hi, val_lo;
1891  int n;
1892  int rc;
1893 
1894  SensorInfoMap::iterator pos;
1895 
1896  if( (pos = m_mapInfo.find(strKey)) == m_mapInfo.end() )
1897  {
1898  LOGERROR("VL6180 sensor %s not found.", strKey.c_str());
1899  return -LAE_ECODE_BAD_VAL;
1900  }
1901 
1902  sensorIndex = pos->second.m_nIndex;
1903 
1904  lock();
1905 
1906  cmd[lenCmd++] = LaeToFMuxI2CCmdIdGetIdent;
1907  cmd[lenCmd++] = sensorIndex;
1908 
1909  rc = m_i2cBus.write_read(m_addrSubProc, cmd, lenCmd, rsp, lenRsp, TStd);
1910 
1911  if( rc == LAE_OK )
1912  {
1913  n = 0;
1914  ident.idModel = rsp[n++];
1915  ident.idModelRevMajor = rsp[n++];
1916  ident.idModelRevMinor = rsp[n++];
1917  ident.idModuleRevMajor = rsp[n++];
1918  ident.idModuleRevMinor = rsp[n++];
1919 
1920  val_hi = ((u16_t)rsp[n++]) << 8;
1921  val_lo = (u16_t)rsp[n++];
1922  ident.idDate = val_hi | val_lo;
1923 
1924  val_hi = ((u16_t)rsp[n++]) << 8;
1925  val_lo = (u16_t)rsp[n++];
1926  ident.idTime = val_hi | val_lo;
1927  }
1928 
1929  unlock();
1930 
1931  return rc;
1932 }
virtual int write_read(uint_t addr, const byte_t wbuf[], size_t wlen, byte_t rbuf[], size_t rlen, long usec=0)
Perform a write/read transaction to/from an I2C slave endpoint device.
Definition: laeI2C.cxx:249
laelaps::LaeI2C & m_i2cBus
bound I2C bus instance
Definition: laeVL6180.h:988
void unlock()
Unlock the shared resource.
Definition: laeVL6180.h:1419
void lock()
Lock the share resource.
Definition: laeVL6180.h:1408
static const long TStd
standard wait write_read (usec)
Definition: laeVL6180.h:1217
SensorInfoMap m_mapInfo
map of sensor properties by key
Definition: laeVL6180.h:1391
uint_t m_addrSubProc
I2C sub-processor address.
Definition: laeVL6180.h:1387
int LaeRangeMuxSubproc::cmdGetRanges ( std::vector< double > &  vecRanges)
protected

Get measured object distances.

Parameters
[out]vecRangesVector of distances (mm).
Returns
On success, OK(0) is returned.
On error, RC_ERROR(-1) is returned.

Definition at line 1983 of file laeVL6180.cxx.

References cmdGetRanges(), and m_vecRanges.

1984 {
1985  int rc;
1986 
1987  if( (rc = cmdGetRanges()) == LAE_OK )
1988  {
1989  vecRanges = m_vecRanges;
1990  }
1991 
1992  return rc;
1993 }
std::vector< double > m_vecRanges
measured distances (meters)
Definition: laeVL6180.h:1394
int cmdGetRanges()
Get range distance measurments command.
Definition: laeVL6180.cxx:1934
int LaeRangeMuxSubproc::cmdGetRanges ( )
protected

Get range distance measurments command.

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

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().

1935 {
1936  byte_t cmd[LaeToFMuxI2CMaxCmdLen];
1937  byte_t rsp[LaeToFMuxI2CMaxRspLen];
1938  size_t lenCmd = 0;
1939  size_t lenRsp = LaeToFMuxI2CRspLenGetRanges;
1940  int sensorIndex;
1941  byte_t val;
1942  double fRange;
1943  int rc;
1944 
1945  lock();
1946 
1947  cmd[lenCmd++] = LaeToFMuxI2CCmdIdGetRanges;
1948 
1949  rc = m_i2cBus.write_read(m_addrSubProc, cmd, lenCmd, rsp, lenRsp, TStd);
1950 
1951  if( rc == LAE_OK )
1952  {
1953  for(sensorIndex = 0; sensorIndex < ToFSensorMaxNumOf; ++sensorIndex)
1954  {
1955  val = rsp[sensorIndex];
1956  if( val <= LaeToFMuxRangeMax )
1957  {
1958  fRange = (double)val * 0.001; // mm to meters
1959  }
1960  else if( val == LaeToFMuxRangeNoObj )
1961  {
1962  fRange = VL6180X_RANGE_NO_OBJ;
1963  }
1964  else if( val == LaeToFMuxRangeNoDev )
1965  {
1966  fRange = VL6180X_RANGE_MIN;
1967  }
1968  else
1969  {
1970  fRange = VL6180X_ERR_MEAS;
1971  }
1972 
1973  m_vecRanges[sensorIndex] = fRange;
1974  }
1975  RtDb.m_range[sensorIndex].m_fRange = fRange;
1976  }
1977 
1978  unlock();
1979 
1980  return rc;
1981 }
virtual int write_read(uint_t addr, const byte_t wbuf[], size_t wlen, byte_t rbuf[], size_t rlen, long usec=0)
Perform a write/read transaction to/from an I2C slave endpoint device.
Definition: laeI2C.cxx:249
laelaps::LaeI2C & m_i2cBus
bound I2C bus instance
Definition: laeVL6180.h:988
std::vector< double > m_vecRanges
measured distances (meters)
Definition: laeVL6180.h:1394
void unlock()
Unlock the shared resource.
Definition: laeVL6180.h:1419
#define VL6180X_RANGE_NO_OBJ
no object detected
Definition: laeVL6180.h:133
void lock()
Lock the share resource.
Definition: laeVL6180.h:1408
#define VL6180X_ERR_MEAS
error meassurement
Definition: laeVL6180.h:164
static const long TStd
standard wait write_read (usec)
Definition: laeVL6180.h:1217
uint_t m_addrSubProc
I2C sub-processor address.
Definition: laeVL6180.h:1387
#define VL6180X_RANGE_MIN
minimum range (m)
Definition: laeVL6180.h:130
int LaeRangeMuxSubproc::cmdGetTunes ( const std::string &  strKey,
uint_t &  uRangeOffset,
uint_t &  uRangeCrossTalk,
double &  fAlsGain,
uint_t &  uAlsIntPeriod 
)
protected

Read exported tuning parameters command.

Parameters
[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 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().

2054 {
2055  byte_t cmd[LaeToFMuxI2CMaxCmdLen];
2056  byte_t rsp[LaeToFMuxI2CMaxRspLen];
2057  size_t lenCmd = 0;
2058  size_t lenRsp = LaeToFMuxI2CRspLenGetTunes;
2059  byte_t sensorIndex;
2060  byte_t val;
2061  uint_t val_hi, val_lo;
2062  int n;
2063  int rc;
2064 
2065  SensorInfoMap::iterator pos;
2066 
2067  if( (pos = m_mapInfo.find(strKey)) == m_mapInfo.end() )
2068  {
2069  LOGERROR("VL6180 sensor %s not found.", strKey.c_str());
2070  return -LAE_ECODE_BAD_VAL;
2071  }
2072 
2073  sensorIndex = pos->second.m_nIndex;
2074 
2075  lock();
2076 
2077  cmd[lenCmd++] = LaeToFMuxI2CCmdIdGetTunes;
2078  cmd[lenCmd++] = sensorIndex;
2079 
2080  rc = m_i2cBus.write_read(m_addrSubProc, cmd, lenCmd, rsp, lenRsp, TStd);
2081 
2082  if( rc == LAE_OK )
2083  {
2084  n = 0;
2085 
2086  uRangeOffset = rsp[n++];
2087 
2088  if( m_uFwVer >= 2 )
2089  {
2090  val_hi = ((uint_t)rsp[n++]) << 8;
2091  val_lo = (uint_t)rsp[n++];
2092  uRangeCrossTalk = val_hi | val_lo;
2093  }
2094  else
2095  {
2096  uRangeCrossTalk = rsp[n++];
2097  }
2098 
2099  val = rsp[n++];
2101 
2102  val_hi = ((uint_t)rsp[n++]) << 8;
2103  val_lo = (uint_t)rsp[n++];
2104  uAlsIntPeriod = val_hi | val_lo;
2105  }
2106 
2107  unlock();
2108 
2109  return rc;
2110 }
vl6180x_als_gain
Ambient Light Sensor gain value enumeration.
Definition: laeVL6180.h:247
virtual int write_read(uint_t addr, const byte_t wbuf[], size_t wlen, byte_t rbuf[], size_t rlen, long usec=0)
Perform a write/read transaction to/from an I2C slave endpoint device.
Definition: laeI2C.cxx:249
laelaps::LaeI2C & m_i2cBus
bound I2C bus instance
Definition: laeVL6180.h:988
void unlock()
Unlock the shared resource.
Definition: laeVL6180.h:1419
void lock()
Lock the share resource.
Definition: laeVL6180.h:1408
static double gainEnumToAnalog(vl6180x_als_gain eAlsGain)
Convert ambient light sensor gain register value enum to analog gain.
Definition: laeVL6180.cxx:1125
uint_t m_uFwVer
firmware version number
Definition: laeVL6180.h:1388
static const long TStd
standard wait write_read (usec)
Definition: laeVL6180.h:1217
SensorInfoMap m_mapInfo
map of sensor properties by key
Definition: laeVL6180.h:1391
uint_t m_addrSubProc
I2C sub-processor address.
Definition: laeVL6180.h:1387
int LaeRangeMuxSubproc::cmdTuneAls ( const std::string &  strKey,
double  fAlsGain,
uint_t  uAlsIntPeriod 
)
protected

Tune ambient light sensor command.

Parameters
fAlsGainAmbient light sensor analog gain.
uAlsIntPeriodAmbient light sensor integration period (msec).
Returns
On success, OK(0) is returned.
On error, RC_ERROR(-1) is returned.

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().

2176 {
2177  byte_t cmd[LaeToFMuxI2CMaxCmdLen];
2178  byte_t rsp[LaeToFMuxI2CMaxRspLen];
2179  size_t lenCmd = 0;
2180  size_t lenRsp = LaeToFMuxI2CRspLenTuneAls;
2181  byte_t sensorIndex;
2182  byte_t regAlsGain;
2183  byte_t val_hi, val_lo;
2184  byte_t pf;
2185  int rc;
2186 
2187  SensorInfoMap::iterator pos;
2188 
2189  if( (pos = m_mapInfo.find(strKey)) == m_mapInfo.end() )
2190  {
2191  LOGERROR("VL6180 sensor %s not found.", strKey.c_str());
2192  return -LAE_ECODE_BAD_VAL;
2193  }
2194 
2195  sensorIndex = pos->second.m_nIndex;
2196 
2197  lock();
2198 
2199  regAlsGain = (byte_t)LaeVL6180Mux::gainAnalogToEnum(fAlsGain);
2200 
2201  uAlsIntPeriod = cap(uAlsIntPeriod, (uint_t)VL6180X_AMBIENT_INT_T_MIN,
2202  (uint_t)VL6180X_AMBIENT_INT_T_MAX);
2203 
2204  val_hi = (byte_t)((uAlsIntPeriod >> 8) & 0xff);
2205  val_lo = (byte_t)(uAlsIntPeriod & 0xff);
2206 
2207  cmd[lenCmd++] = LaeToFMuxI2CCmdIdTuneAls;
2208  cmd[lenCmd++] = sensorIndex;
2209  cmd[lenCmd++] = regAlsGain;
2210  cmd[lenCmd++] = val_hi;
2211  cmd[lenCmd++] = val_lo;
2212 
2213  rc = m_i2cBus.write_read(m_addrSubProc, cmd, lenCmd, rsp, lenRsp, TStd);
2214 
2215  if( rc == LAE_OK )
2216  {
2217  pf = rsp[0]; // pass/fail
2218  }
2219 
2220  unlock();
2221 
2222  return rc;
2223 }
#define VL6180X_AMBIENT_INT_T_MIN
minimum als int. period (msec)
Definition: laeVL6180.h:156
virtual int write_read(uint_t addr, const byte_t wbuf[], size_t wlen, byte_t rbuf[], size_t rlen, long usec=0)
Perform a write/read transaction to/from an I2C slave endpoint device.
Definition: laeI2C.cxx:249
#define VL6180X_AMBIENT_INT_T_MAX
maximum als int. period (msec)
Definition: laeVL6180.h:157
laelaps::LaeI2C & m_i2cBus
bound I2C bus instance
Definition: laeVL6180.h:988
static vl6180x_als_gain gainAnalogToEnum(double fAlsGain)
Convert ambient light sensor analog gain to associated register value enum.
Definition: laeVL6180.cxx:1137
void unlock()
Unlock the shared resource.
Definition: laeVL6180.h:1419
int cap(int a, int min, int max)
Cap value within limits [min, max].
Definition: laeUtils.h:176
void lock()
Lock the share resource.
Definition: laeVL6180.h:1408
static const long TStd
standard wait write_read (usec)
Definition: laeVL6180.h:1217
SensorInfoMap m_mapInfo
map of sensor properties by key
Definition: laeVL6180.h:1391
uint_t m_addrSubProc
I2C sub-processor address.
Definition: laeVL6180.h:1387
int LaeRangeMuxSubproc::cmdTuneToFSensor ( const std::string &  strKey,
uint_t  uRangeOffset,
uint_t  uRangeCrossTalk 
)
protected

Tune time-of-flight range sensor command.

Parameters
uRangeOffsetToF sensor part-to-part offset. If VL6180X_FACTORY_DFT then leave as is.
uRangeCrossTalkToF sensor cross-talk compensation. If VL6180X_FACTORY_DFT then leave as is.
Returns
On success, OK(0) is returned.
On error, RC_ERROR(-1) is returned.

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().

2115 {
2116  byte_t cmd[LaeToFMuxI2CMaxCmdLen];
2117  byte_t rsp[LaeToFMuxI2CMaxRspLen];
2118  size_t lenCmd = 0;
2119  size_t lenRsp = LaeToFMuxI2CRspLenTuneToFSensor;
2120  byte_t sensorIndex;
2121  byte_t regOffset;
2122  u16_t regCrossTalk;
2123  byte_t val_hi, val_lo;
2124  byte_t pf;
2125  int rc;
2126 
2127  SensorInfoMap::iterator pos;
2128 
2129  if( (pos = m_mapInfo.find(strKey)) == m_mapInfo.end() )
2130  {
2131  LOGERROR("VL6180 sensor %s not found.", strKey.c_str());
2132  return -LAE_ECODE_BAD_VAL;
2133  }
2134 
2135  sensorIndex = pos->second.m_nIndex;
2136 
2137  lock();
2138 
2139  regOffset = (byte_t)(uRangeOffset, (uint_t)VL6180X_RANGE_OFFSET_MIN,
2140  (uint_t)VL6180X_RANGE_OFFSET_MAX);
2141 
2142  regCrossTalk = (u16_t)cap(uRangeCrossTalk, (uint_t)VL6180X_RANGE_XTALK_MIN,
2143  (uint_t)VL6180X_RANGE_XTALK_MAX);
2144 
2145  cmd[lenCmd++] = LaeToFMuxI2CCmdIdTuneToFSensor;
2146  cmd[lenCmd++] = sensorIndex;
2147  cmd[lenCmd++] = regOffset;
2148 
2149  if( m_uFwVer >= 2 )
2150  {
2151  val_hi = (byte_t)((regCrossTalk >> 8) & 0xff);
2152  val_lo = (byte_t)(regCrossTalk & 0xff);
2153  cmd[lenCmd++] = val_hi;
2154  cmd[lenCmd++] = val_lo;
2155  }
2156  else
2157  {
2158  cmd[lenCmd++] = regCrossTalk;
2159  }
2160 
2161  rc = m_i2cBus.write_read(m_addrSubProc, cmd, lenCmd, rsp, lenRsp, TStd);
2162 
2163  if( rc == LAE_OK )
2164  {
2165  pf = rsp[0]; // pass/fail
2166  }
2167 
2168  unlock();
2169 
2170  return rc;
2171 }
#define VL6180X_RANGE_XTALK_MIN
minimum tof cross-talk
Definition: laeVL6180.h:140
#define VL6180X_RANGE_OFFSET_MAX
maximum tof offset
Definition: laeVL6180.h:137
virtual int write_read(uint_t addr, const byte_t wbuf[], size_t wlen, byte_t rbuf[], size_t rlen, long usec=0)
Perform a write/read transaction to/from an I2C slave endpoint device.
Definition: laeI2C.cxx:249
laelaps::LaeI2C & m_i2cBus
bound I2C bus instance
Definition: laeVL6180.h:988
void unlock()
Unlock the shared resource.
Definition: laeVL6180.h:1419
#define VL6180X_RANGE_XTALK_MAX
maximum tof cross-talk
Definition: laeVL6180.h:141
int cap(int a, int min, int max)
Cap value within limits [min, max].
Definition: laeUtils.h:176
void lock()
Lock the share resource.
Definition: laeVL6180.h:1408
uint_t m_uFwVer
firmware version number
Definition: laeVL6180.h:1388
#define VL6180X_RANGE_OFFSET_MIN
minimum tof offset
Definition: laeVL6180.h:136
static const long TStd
standard wait write_read (usec)
Definition: laeVL6180.h:1217
SensorInfoMap m_mapInfo
map of sensor properties by key
Definition: laeVL6180.h:1391
uint_t m_addrSubProc
I2C sub-processor address.
Definition: laeVL6180.h:1387
int LaeRangeMuxSubproc::configure ( const laelaps::LaeDesc desc)
virtual

Configure sensor array from product description.

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

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().

1652 {
1653  LaeDesc::MapDescRangeSensor::const_iterator iter;
1654  SensorInfoMap::iterator iter2;
1655 
1656  // subproc version
1657  uint_t uFwVer;
1658 
1659  // sensor identity
1660  VL6180xIdentification ident;
1661  bool bIdent;
1662 
1663  // sensor tuning values
1664  uint_t uRangeOffset;
1665  uint_t uRangeCrossTalk;
1666  double fAlsGain;
1667  uint_t uAlsIntPeriod;
1668  s8_t nOffset;
1669  bool bTunes;
1670 
1671  // sensor properties
1672  string strRadiationType;
1673  double fFoV;
1674  double fBeamDir;
1675  double fMin;
1676  double fMax;
1677 
1678  int rc;
1679 
1680  //
1681  // Read firmware version, if necessary.
1682  //
1683  if( m_uFwVer == 0 )
1684  {
1685  if( (rc = cmdGetFwVersion(uFwVer)) != LAE_OK )
1686  {
1687  LOGERROR("Failed to read ToFMux firmware version.");
1688  }
1689  }
1690 
1691  //
1692  // Product Time of Flight proximity sensors.
1693  //
1694  for(iter = desc.m_mapDescRangeSensor.begin();
1695  iter != desc.m_mapDescRangeSensor.end();
1696  ++iter)
1697  {
1698  // map key - index assoc. (channel number is index for now)
1699  m_mapInfo[iter->first] = LaeVL6180SensorInfo(iter->second->m_nChan,
1700  iter->second->m_nChan,
1701  iter->second->m_fDir,
1702  iter->second->m_fDeadzone,
1703  iter->second->m_strDesc);
1704  }
1705 
1706  //
1707  // Get identity on each sensor.
1708  //
1709  for(iter2 = m_mapInfo.begin(); iter2 != m_mapInfo.end(); ++iter2)
1710  {
1711  bIdent = false;
1712  bTunes = false;
1713 
1714  if( (rc = cmdGetIdent(iter2->first, ident)) == LAE_OK )
1715  {
1716  bIdent = true;
1717  }
1718  else
1719  {
1720  LOGERROR("VL6180 range %s sensor: Failed to read identify.",
1721  iter2->first.c_str());
1722  }
1723 
1724  rc = cmdGetTunes(iter2->first, uRangeOffset, uRangeCrossTalk,
1725  fAlsGain, uAlsIntPeriod);
1726 
1727  if( rc == LAE_OK )
1728  {
1729  bTunes = true;
1730  }
1731  else
1732  {
1733  LOGERROR("VL6180 range %s sensor: Failed to read tune parameters.",
1734  iter2->first.c_str());
1735  }
1736 
1737  nOffset = (s8_t)(uRangeOffset & 0xff);
1738 
1739  getSensorProps(iter2->first, strRadiationType,
1740  fFoV, fBeamDir, fMin, fMax);
1741 
1742  LOGDIAG2("VL6180 %s(%d) Sensor Info:\n"
1743  " Properties\n"
1744  " Location: %s\n"
1745  " Beam Direction: %.1lf degrees\n"
1746  " Radiation: %s\n"
1747  " FoV: %.1lf degrees\n"
1748  " Min Distance: %.3lf meters\n"
1749  " MAx Distance: %.3lf meters\n"
1750  " Identity\n"
1751  " Model: 0x%02x v%u.%u\n"
1752  " Module: v%u.%u\n"
1753  " Date/Time: %u/%u\n"
1754  " Tuning\n"
1755  " ToF Offset: %d(%u)\n"
1756  " ToF Cross-Talk: %u\n"
1757  " ALS Gain: %.2lf\n"
1758  " ALS Int. Period: %u msec",
1759  iter2->first.c_str(), iter2->second.m_nIndex,
1760  iter2->first.c_str(),
1761  radToDeg(fBeamDir),
1762  strRadiationType.c_str(),
1763  radToDeg(fFoV),
1764  fMin,
1765  fMax,
1766  ident.idModel, ident.idModelRevMajor, ident.idModelRevMinor,
1767  ident.idModuleRevMajor, ident.idModuleRevMinor,
1768  ident.idDate, ident.idTime,
1769  nOffset, uRangeOffset,
1770  uRangeCrossTalk,
1771  fAlsGain,
1772  uAlsIntPeriod);
1773  }
1774 
1775  LOGDIAG2("Configured Range Sensor Group from robot description.");
1776 
1777  return LAE_OK;
1778 }
int cmdGetTunes(const std::string &strKey, uint_t &uRangeOffset, uint_t &uRangeCrossTalk, double &fAlsGain, uint_t &uAlsIntPeriod)
Read exported tuning parameters command.
Definition: laeVL6180.cxx:2049
virtual int getSensorProps(const std::string &strKey, std::string &strRadiationType, double &fFoV, double &fBeamDir, double &fMin, double &fMax)
Get range sensor properties.
Definition: laeVL6180.cxx:2292
Container class to hold VL6180 time-of-flight sensor static information.
Definition: laeVL6180.h:280
virtual int cmdGetFwVersion(uint_t &uVerNum)
Get the firmware version command.
Definition: laeVL6180.cxx:1856
double radToDeg(double r)
Convert radians to degrees.
Definition: laeUtils.h:136
uint_t m_uFwVer
firmware version number
Definition: laeVL6180.h:1388
SensorInfoMap m_mapInfo
map of sensor properties by key
Definition: laeVL6180.h:1391
int cmdGetIdent(const std::string &strKey, VL6180xIdentification &ident)
Read sensor identification command.
Definition: laeVL6180.cxx:1882
MapDescRangeSensor m_mapDescRangeSensor
range sensor descriptions
Definition: laeDesc.h:526
int LaeRangeMuxSubproc::configure ( const laelaps::LaeTunes tunes)
virtual

Configure sensor array from tuning parameters.

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

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.

1781 {
1782  int nRangeOffset;
1783  int nRangeCrossTalk;
1784  double fAlsGain;
1785  int nAlsIntPeriod;
1786  int rc;
1787 
1788  SensorInfoMap::iterator iter;
1789 
1790  for(iter = m_mapInfo.begin(); iter != m_mapInfo.end(); ++iter)
1791  {
1792  tunes.getVL6180Params(iter->first, nRangeOffset, nRangeCrossTalk,
1793  fAlsGain, nAlsIntPeriod);
1794 
1795  //
1796  // Time-of-flight sensor tuning.
1797  //
1798  if( (nRangeOffset != VL6180X_FACTORY_DFT) &&
1799  (nRangeCrossTalk != VL6180X_FACTORY_DFT) )
1800  {
1801  rc = cmdTuneToFSensor(iter->first, (uint_t)nRangeOffset,
1802  (uint_t)nRangeCrossTalk);
1803 
1804  if( rc == LAE_OK )
1805  {
1806  LOGDIAG3("VL6180 range sensor %s: Time-of-flight sensor tuned.",
1807  iter->first.c_str());
1808  }
1809  else
1810  {
1811  LOGERROR("VL6180 range sensor %s: Failed to tune time-of-flight.",
1812  iter->first.c_str());
1813  return rc;
1814  }
1815  }
1816 
1817  //
1818  // Ambient light sensor tuning.
1819  //
1820  rc = cmdTuneAls(iter->first, fAlsGain, (uint_t)nAlsIntPeriod);
1821 
1822  if( rc == LAE_OK )
1823  {
1824  LOGDIAG3("VL6180 range sensor %s: Ambient light sensor tuned.",
1825  iter->first.c_str());
1826  }
1827  else
1828  {
1829  LOGERROR("VL6180 range sensor %s: Failed to tune ambient light sensor.",
1830  iter->first.c_str());
1831  return rc;
1832  }
1833  }
1834 
1835  LOGDIAG2("Tuned VL6180 range sensor group.");
1836 
1837  return rc;
1838 }
int cmdTuneAls(const std::string &strKey, double fAlsGain, uint_t uAlsIntPeriod)
Tune ambient light sensor command.
Definition: laeVL6180.cxx:2173
void getVL6180Params(const std::string &strName, int &nTofOffset, int &nTofCrossTalk, double &fAlsGain, int &nAlsIntPeriod) const
Get VL6180 range sensor tune parameters.
Definition: laeTune.cxx:421
int cmdTuneToFSensor(const std::string &strKey, uint_t uRangeOffset, uint_t uRangeCrossTalk)
Tune time-of-flight range sensor command.
Definition: laeVL6180.cxx:2112
SensorInfoMap m_mapInfo
map of sensor properties by key
Definition: laeVL6180.h:1391
#define VL6180X_FACTORY_DFT
use factory default
Definition: laeVL6180.h:170
void LaeRangeMuxSubproc::exec ( )
virtual

Execute one cycle to take measurements.

Context:
LaeThreadRange thread instance.

Reimplemented from sensor::vl6180::LaeRangeInterface.

Definition at line 1847 of file laeVL6180.cxx.

References cmdGetAmbientLight(), and cmdGetRanges().

1848 {
1849  cmdGetRanges();
1850 
1851 #ifdef LAE_USE_ALS
1853 #endif // LAE_USE_ALS
1854 }
int cmdGetAmbientLight()
Get ambient light measurments command.
Definition: laeVL6180.cxx:1995
int cmdGetRanges()
Get range distance measurments command.
Definition: laeVL6180.cxx:1934
int LaeRangeMuxSubproc::getAmbientLight ( const std::string &  strKey,
double &  fAmbient 
)
virtual

Get an ambient light illuminance measurement.

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.

Reimplemented from sensor::vl6180::LaeRangeInterface.

Definition at line 2259 of file laeVL6180.cxx.

References m_mapInfo, and m_vecLux.

2260 {
2261  SensorInfoMap::iterator pos;
2262 
2263  if( (pos = m_mapInfo.find(strKey)) == m_mapInfo.end() )
2264  {
2265  LOGERROR("VL6180 sensor %s not found.", strKey.c_str());
2266  return -LAE_ECODE_BAD_VAL;
2267  }
2268 
2269  int sensorIndex = pos->second.m_nIndex;
2270 
2271  fLux = m_vecLux[sensorIndex];
2272 
2273  return LAE_OK;
2274 }
SensorInfoMap m_mapInfo
map of sensor properties by key
Definition: laeVL6180.h:1391
std::vector< double > m_vecLux
measured ambient light (lux)
Definition: laeVL6180.h:1395
int LaeRangeMuxSubproc::getAmbientLight ( std::vector< std::string > &  vecNames,
std::vector< double > &  vecAmbient 
)
virtual

Get all sensor ambient light illuminance measurements.

Parameters
[out]vecNamesVector of sensor unique names.
[out]vecAmbientVector of associated sensor measured ambients (lux).
Returns
On success, OK(0) is returned.
On error, RC_ERROR(-1) is returned.

Reimplemented from sensor::vl6180::LaeRangeInterface.

Definition at line 2276 of file laeVL6180.cxx.

References m_mapInfo, and m_vecLux.

2278 {
2279  SensorInfoMap::iterator iter;
2280 
2281  vecNames.clear();
2282  vecLux.clear();
2283 
2284  for(iter = m_mapInfo.begin(); iter != m_mapInfo.end(); ++iter)
2285  {
2286  vecNames.push_back(iter->first);
2287  vecLux.push_back(m_vecLux[iter->second.m_nIndex]);
2288  }
2289 
2290 }
SensorInfoMap m_mapInfo
map of sensor properties by key
Definition: laeVL6180.h:1391
std::vector< double > m_vecLux
measured ambient light (lux)
Definition: laeVL6180.h:1395
int LaeRangeMuxSubproc::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.

Reimplemented from sensor::vl6180::LaeRangeInterface.

Definition at line 1621 of file laeVL6180.cxx.

References cmdGetFwVersion(), LAE_VER_MAJOR, LAE_VER_MINOR, and m_uFwVer.

1624 {
1625  int rc;
1626 
1627  rc = cmdGetFwVersion(m_uFwVer);
1628 
1629  uVerMajor = LAE_VER_MAJOR(RtDb.m_product.m_uProdHwVer);
1630  uVerMinor = LAE_VER_MINOR(RtDb.m_product.m_uProdHwVer);
1631  uFwVer = m_uFwVer;
1632 
1633  return rc;
1634 }
#define LAE_VER_MINOR(ver)
Get version minor number from version.
Definition: laelaps.h:177
virtual int cmdGetFwVersion(uint_t &uVerNum)
Get the firmware version command.
Definition: laeVL6180.cxx:1856
uint_t m_uFwVer
firmware version number
Definition: laeVL6180.h:1388
#define LAE_VER_MAJOR(ver)
Get version major number from version.
Definition: laelaps.h:168
int LaeRangeMuxSubproc::getRange ( const std::string &  strKey,
double &  fRange 
)
virtual

Get a range measurement.

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.

Reimplemented from sensor::vl6180::LaeRangeInterface.

Definition at line 2225 of file laeVL6180.cxx.

References m_mapInfo, and m_vecRanges.

2226 {
2227  SensorInfoMap::iterator pos;
2228 
2229  if( (pos = m_mapInfo.find(strKey)) == m_mapInfo.end() )
2230  {
2231  LOGERROR("VL6180 sensor %s not found.", strKey.c_str());
2232  return -LAE_ECODE_BAD_VAL;
2233  }
2234 
2235  int sensorIndex = pos->second.m_nIndex;
2236 
2237  fRange = m_vecRanges[sensorIndex];
2238 
2239  return LAE_OK;
2240 }
std::vector< double > m_vecRanges
measured distances (meters)
Definition: laeVL6180.h:1394
SensorInfoMap m_mapInfo
map of sensor properties by key
Definition: laeVL6180.h:1391
int LaeRangeMuxSubproc::getRange ( std::vector< std::string > &  vecNames,
std::vector< double > &  vecRanges 
)
virtual

Get all sensor range measurements.

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.

Reimplemented from sensor::vl6180::LaeRangeInterface.

Definition at line 2242 of file laeVL6180.cxx.

References m_mapInfo, and m_vecRanges.

2244 {
2245  SensorInfoMap::iterator iter;
2246 
2247  vecNames.clear();
2248  vecRanges.clear();
2249 
2250  for(iter = m_mapInfo.begin(); iter != m_mapInfo.end(); ++iter)
2251  {
2252  vecNames.push_back(iter->first);
2253  vecRanges.push_back(m_vecRanges[iter->second.m_nIndex]);
2254  }
2255 
2256  return LAE_OK;
2257 }
std::vector< double > m_vecRanges
measured distances (meters)
Definition: laeVL6180.h:1394
SensorInfoMap m_mapInfo
map of sensor properties by key
Definition: laeVL6180.h:1391
int LaeRangeMuxSubproc::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.

Reimplemented from sensor::vl6180::LaeRangeInterface.

Definition at line 2292 of file laeVL6180.cxx.

References m_mapInfo.

Referenced by configure().

2298 {
2299  SensorInfoMap::iterator pos;
2300 
2301  if( (pos = m_mapInfo.find(strKey)) == m_mapInfo.end() )
2302  {
2303  LOGERROR("VL6180 range sensor %s not found.", strKey.c_str());
2304  return -LAE_ECODE_BAD_VAL;
2305  }
2306 
2307  int nIndex;
2308  int nChan;
2309  double fDeadzone;
2310  std::string strDesc;
2311 
2312  pos->second.getProps(nIndex, nChan, strRadiationType, fFoV, fBeamDir,
2313  fDeadzone, fMin, fMax, strDesc);
2314 
2315  return LAE_OK;
2316 }
SensorInfoMap m_mapInfo
map of sensor properties by key
Definition: laeVL6180.h:1391
void sensor::vl6180::LaeRangeMuxSubproc::lock ( )
inlineprotected

Lock the share resource.

The lock()/unlock() primitives provide a thread safe mechanism.

Context:
Any.

Definition at line 1408 of file laeVL6180.h.

Referenced by cmdGetAmbientLight(), cmdGetFwVersion(), cmdGetIdent(), cmdGetRanges(), cmdGetTunes(), cmdTuneAls(), and cmdTuneToFSensor().

1409  {
1410  pthread_mutex_lock(&m_mutex);
1411  }
pthread_mutex_t m_mutex
mutex
Definition: laeVL6180.h:1398
int LaeRangeMuxSubproc::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.

Reimplemented from sensor::vl6180::LaeRangeInterface.

Definition at line 2318 of file laeVL6180.cxx.

References cmdGetIdent().

2321 {
2322  return cmdGetIdent(strKey, ident);
2323 }
int cmdGetIdent(const std::string &strKey, VL6180xIdentification &ident)
Read sensor identification command.
Definition: laeVL6180.cxx:1882
int LaeRangeMuxSubproc::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.

Reimplemented from sensor::vl6180::LaeRangeInterface.

Definition at line 2325 of file laeVL6180.cxx.

References cmdGetTunes().

2330 {
2331  return cmdGetTunes(strKey, uRangeOffset, uRangeCrossTalk,
2332  fAlsGain, uAlsIntPeriod);
2333 }
int cmdGetTunes(const std::string &strKey, uint_t &uRangeOffset, uint_t &uRangeCrossTalk, double &fAlsGain, uint_t &uAlsIntPeriod)
Read exported tuning parameters command.
Definition: laeVL6180.cxx:2049
int LaeRangeMuxSubproc::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.

Reimplemented from sensor::vl6180::LaeRangeInterface.

Definition at line 1840 of file laeVL6180.cxx.

References configure().

1841 {
1842  LOGDIAG2("Reloading VL6180 range sensor group tuning parameters...");
1843 
1844  return configure(tunes);
1845 }
virtual int configure(const laelaps::LaeDesc &desc)
Configure sensor array from product description.
Definition: laeVL6180.cxx:1651
void sensor::vl6180::LaeRangeMuxSubproc::unlock ( )
inlineprotected

Unlock the shared resource.

Context:
Any.

Definition at line 1419 of file laeVL6180.h.

Referenced by cmdGetAmbientLight(), cmdGetFwVersion(), cmdGetIdent(), cmdGetRanges(), cmdGetTunes(), cmdTuneAls(), and cmdTuneToFSensor().

1420  {
1421  pthread_mutex_unlock(&m_mutex);
1422  }
pthread_mutex_t m_mutex
mutex
Definition: laeVL6180.h:1398

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