Laelaps  2.3.5
RoadNarrows Robotics Small Outdoor Mobile Robot Project
laelaps_tof.cxx
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////////////
2 //
3 // Package: Laelaps
4 //
5 // Program: laelaps_tof
6 //
7 // File: laelaps_tof.cxx
8 //
9 /*! \file
10  *
11  * $LastChangedDate: 2015-01-15 12:45:22 -0700 (Thu, 15 Jan 2015) $
12  * $Rev: 3857 $
13  *
14  * \brief Test and calibrate Laelaps Time-of-Flight sensors.
15  *
16  * \author Robin Knight (robin.knight@roadnarrows.com)
17  *
18  * \par Copyright
19  * \h_copy 2015-2018. RoadNarrows LLC.\n
20  * http://www.roadnarrows.com\n
21  * All Rights Reserved
22  */
23 /*
24  * @EulaBegin@
25  *
26  * Unless otherwise stated explicitly, all materials contained are copyrighted
27  * and may not be used without RoadNarrows LLC's written consent,
28  * except as provided in these terms and conditions or in the copyright
29  * notice (documents and software) or other proprietary notice provided with
30  * the relevant materials.
31  *
32  * IN NO EVENT SHALL THE AUTHOR, ROADNARROWS LLC, OR ANY
33  * MEMBERS/EMPLOYEES/CONTRACTORS OF ROADNARROWS OR DISTRIBUTORS OF THIS SOFTWARE
34  * BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR
35  * CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS
36  * DOCUMENTATION, EVEN IF THE AUTHORS OR ANY OF THE ABOVE PARTIES HAVE BEEN
37  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38  *
39  * THE AUTHORS AND ROADNARROWS LLC SPECIFICALLY DISCLAIM ANY WARRANTIES,
40  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
41  * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN
42  * "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE NO OBLIGATION TO
43  * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
44  *
45  * @EulaEnd@
46  */
47 ////////////////////////////////////////////////////////////////////////////////
48 
49 #include <unistd.h>
50 #include <termios.h>
51 #include <string.h>
52 #include <stdio.h>
53 #include <stdlib.h>
54 #include <stdarg.h>
55 
56 #include <iostream>
57 #include <fstream>
58 #include <string>
59 
60 #include "rnr/rnrconfig.h"
61 #include "rnr/log.h"
62 #include "rnr/opts.h"
63 #include "rnr/pkg.h"
64 
65 #include "Laelaps/laelaps.h"
66 #include "Laelaps/laeUtils.h"
67 #include "Laelaps/laeSysDev.h"
68 #include "Laelaps/laeI2C.h"
69 #include "Laelaps/laeI2CMux.h"
70 #include "Laelaps/laeVL6180.h"
71 
72 #include "version.h"
73 
74 using namespace std;
75 using namespace laelaps;
76 using namespace sensor::vl6180;
77 
78 /*!
79  * \ingroup apps
80  * \defgroup laelaps_tof laelaps_tof
81  * \{
82  */
83 
84 #define APP_EC_OK 0 ///< success exit code
85 #define APP_EC_ARGS 2 ///< command-line options/arguments error exit code
86 #define APP_EC_EXEC 4 ///< execution exit code
87 
88 static char *Argv0; ///< the command
89 static bool_t OptsNoAuto = false; ///< don't auto-run
90 static int OptsTimePeriod = 500; ///< sense time period (msec)
91 static char *OptsMeasure = (char *)"range"; ///< measure range
92 static bool_t OptsCalibOffset = false; ///< do [not] calibrate range offset
93 static bool_t OptsCalibXTalk = false; ///< do [not] calibrate range crosstalk
94 
95 static const char *ToFName[] =
96 {
97  "front", "left_front", "left", "left_rear",
98  "rear", "right_rear", "right", "right_front"
99 };
100 
101 static const double ToFDir[] =
102 {
103  degToRad(0.0), degToRad(15.0), degToRad(90.0), degToRad(165.0),
104  degToRad(180.0), degToRad(195.0), degToRad(270.0), degToRad(345.0)
105 };
106 
107 enum MeasType
108 {
109  MeasTypeDistance,
110  MeasTypeAmbient,
111  MeasTypeBoth
112 };
113 
114 static int SensorId;
115 static int Measure;
116 static LaeI2C I2CBus;
117 static LaeI2CMux I2CMux(I2CBus);
118 static LaeVL6180Mux *ToFSensor;
119 
120 static const char *Sep = \
121 "----------------------------------------------------------------------------";
122 
123 //
124 // Forward declarations.
125 //
126 static int OptsCvtArgMeas(const char *argv0, const char *sOptName,
127  char *optarg, void *pOptVal);
128 
129 /*!
130  * \brief Program information.
131  */
132 static OptsPgmInfo_T PgmInfo =
133 {
134  // usage_args
135  "{<Id> | <Name>}",
136 
137  // synopsis
138  "Test and calibrate Laelaps Time-of-Flight sensors.",
139 
140  // long_desc =
141  "The %P command tests and calibrates the Laelaps Time-of-Flight sensors. "
142  "The standard Laelaps comes with 3 forward facing ToFs, with an additional "
143  "5 sensors available as an upgrade option. Sensors are identified by "
144  "the number Id number of symbolic Name.\n"
145  " Id Name Direction Package\n"
146  " -- ----------- --------- -------\n"
147  " 0 front 0 degrees std\n"
148  " 1 left_front 15 degrees std\n"
149  " 2 left 90 degrees opt\n"
150  " 3 left_rear 165 degrees opt\n"
151  " 4 rear 180 degrees opt\n"
152  " 5 right_rear 195 degrees opt\n"
153  " 6 right 270 degrees opt\n"
154  " 7 right_front 345 degrees std\n\n"
155  "The ROS node laelaps_control cannot be running while using this tool.",
156 
157  // diagnostics
158  NULL
159 };
160 
161 /*!
162  * \brief Command line options information.
163  */
164 static OptsInfo_T OptsInfo[] =
165 {
166  // --calib-crosstalk
167  {
168  "calib-crosstalk", // long_opt
169  OPTS_NO_SHORT, // short_opt
170  no_argument, // has_arg
171  true, // has_default
172  &OptsCalibXTalk, // opt_addr
173  OptsCvtArgBool, // fn_cvt
174  OptsFmtBool, // fn_fmt
175  NULL, // arg_name
176  // opt desc
177  "Perform range sensor cross-talk compensation calibration "
178  "procedures. After calibration, %P measurements automatically begin."
179  },
180 
181  // --calib-offset
182  {
183  "calib-offset", // long_opt
184  OPTS_NO_SHORT, // short_opt
185  no_argument, // has_arg
186  true, // has_default
187  &OptsCalibOffset, // opt_addr
188  OptsCvtArgBool, // fn_cvt
189  OptsFmtBool, // fn_fmt
190  NULL, // arg_name
191  // opt desc
192  "Perform range sensor part-to-part offset calibration "
193  "procedures. After calibration, %P measurements automatically begin."
194  },
195 
196  // -m, --measure
197  {
198  "measure", // long_opt
199  'm', // short_opt
200  required_argument, // has_arg
201  true, // has_default
202  &OptsMeasure, // opt_addr
203  OptsCvtArgMeas, // fn_cvt
204  OptsFmtStr, // fn_fmt
205  NULL, // arg_name
206  // opt desc
207  "Sensor measurement(s). One of:\n range ambient both."
208  },
209 
210  // --no-auto
211  {
212  "no-auto", // long_opt
213  OPTS_NO_SHORT, // short_opt
214  no_argument, // has_arg
215  true, // has_default
216  &OptsNoAuto, // opt_addr
217  OptsCvtArgBool, // fn_cvt
218  OptsFmtBool, // fn_fmt
219  NULL, // arg_name
220  // opt desc
221  "Don't auto-sense at the given millisecond time period. In this mode the "
222  "user must provide keyboard input to control when to sense."
223  },
224 
225  // -t, --time-period
226  {
227  "time-period", // long_opt
228  't', // short_opt
229  required_argument, // has_arg
230  true, // has_default
231  &OptsTimePeriod, // opt_addr
232  OptsCvtArgInt, // fn_cvt
233  OptsFmtInt, // fn_fmt
234  NULL, // arg_name
235  // opt desc
236  "Auto-sense at the given millisecond time period rate."
237  },
238 
239  {NULL, }
240 };
241 
242 static int OptsCvtArgMeas(const char *argv0, const char *sOptName,
243  char *optarg, void *pOptVal)
244 {
245  // pOptVal is OptsMeasure
246  OptsCvtArgStr(argv0, sOptName, optarg, pOptVal);
247 
248  if( !strcmp(OptsMeasure, "range") )
249  {
250  Measure = MeasTypeDistance;
251  }
252  else if( !strcmp(OptsMeasure, "ambient") )
253  {
254  Measure = MeasTypeAmbient;
255  }
256  else if( !strcmp(OptsMeasure, "both") )
257  {
258  Measure = MeasTypeBoth;
259  }
260  else
261  {
262  OptsInvalid(Argv0, "'%s': Invalid '%s' measurement value.",
263  optarg, sOptName);
264  }
265 
266  return OK;
267 }
268 
269 static int tofNameToInt(const string &str, int &val)
270 {
271  size_t i;
272 
273  for(i = 0; i < arraysize(ToFName); ++i)
274  {
275  if( !strcmp(ToFName[i], str.c_str()) )
276  {
277  val = (int)i;
278  return OK;
279  }
280  }
281 
282  return RC_ERROR;
283 }
284 
285 static int strToInt(const string &str, int &val)
286 {
287  long long int val1; // must use 64-bit for arm 32-bit compilers
288 
289  if( sscanf(str.c_str(), "%lli", &val1) != 1 )
290  {
291  return RC_ERROR;
292  }
293 
294  val = (int)val1;
295 
296  return OK;
297 }
298 
299 int getch()
300 {
301  struct termios old = {0};
302  char c = 0;
303 
304  if( tcgetattr(0, &old) < 0 )
305  {
306  return EOF;
307  }
308 
309  old.c_lflag &= ~ICANON;
310  old.c_lflag &= ~ECHO;
311  old.c_cc[VMIN] = 1;
312  old.c_cc[VTIME] = 0;
313 
314  if( tcsetattr(0, TCSANOW, &old) < 0 )
315  {
316  return EOF;
317  }
318 
319  if( read(0, &c, 1) < 0 )
320  {
321  return EOF;
322  }
323 
324  old.c_lflag |= ICANON;
325  old.c_lflag |= ECHO;
326 
327  if( tcsetattr(0, TCSADRAIN, &old) < 0 )
328  {
329  }
330 
331  return c;
332 }
333 
334 int kbhit()
335 {
336  int c;
337 
338  while( (c = getch()) == 0 );
339 
340  return c;
341 }
342 
343 static int connectSensor(int n)
344 {
345  //
346  // Laelaps peripherals I2C bus.
347  //
348  if( I2CBus.open(LaeDevI2C) < 0 )
349  {
350  LOGSYSERROR("%s.", LaeDevI2C);
351  return -LAE_ECODE_NO_DEV;
352  }
353 
354  //
355  // Time of Flight proximity sensors.
356  //
357  ToFSensor = new LaeVL6180Mux(I2CMux, SensorId, ToFDir[SensorId], 0.0,
358  ToFName[SensorId]);
359 
360  if( ToFSensor->initSensor() < 0 )
361  {
362  LOGERROR("Sensor %d %s: Failed to initialize.",
363  SensorId, ToFName[SensorId]);
364  return -LAE_ECODE_NO_EXEC;
365  }
366 
367  return LAE_OK;
368 }
369 
370 static int readSensorInfo()
371 {
372  struct VL6180xIdentification id;
373 
374  if( ToFSensor->readId(id) < 0 )
375  {
376  LOGERROR("Failed to read sensor identification.");
377  return -LAE_ECODE_IO;
378  }
379 
380  printf("%s\n", Sep);
381  printf("VL6180 Sensor Info:\n");
382  printf(" Name: %s\n", ToFSensor->getNameId().c_str());
383  printf(" Desc: %s\n", ToFSensor->getDesc().c_str());
384  printf(" Model: 0x%02x v%u.%u\n",
385  id.idModel, id.idModelRevMajor, id.idModelRevMinor);
386  printf(" Module: v%u.%u\n", id.idModuleRevMajor, id.idModuleRevMinor);
387  printf(" Date/Time: %u/%u\n", id.idDate, id.idTime);
388 
389  return LAE_OK;
390 }
391 
392 static int calibrateSensorCrossTalk()
393 {
394  int nOffsetPre;
395  double fAvgPre;
396  int nOffsetPost;
397  double fAvgPost;
398  int nCrossTalk;
399  int c;
400  int rc;
401 
402  printf(
403 "\n"
404 "Range sensor cross-talk compensation calibration.\n"
405 " Note: Perform range part-to-part offset calibration, "
406 "if required, first.\n\n");
407 
408  // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
409  // Cross-talk compensation calibration
410  // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
411  printf("%s\n", Sep);
412  printf("Calibrate Cross-Talk Compensation\n\n");
413 
414  printf("Setup: Place a black target (<= 3%% reflectance) at a distance\n");
415  printf(" of 100mm from sensor (or front of glass cover if present).\n");
416 
417  printf("\nPress any key to when ready ('q' to quit): ");
418  fflush(stdout);
419  c = kbhit();
420  if( (c == 'q') || (c == EOF) )
421  {
422  return -LAE_ECODE_NO_EXEC;
423  }
424 
425  printf("\n Calibrating...\r");
426  fflush(stdout);
427 
428  rc = ToFSensor->calibCrossTalk(nCrossTalk);
429 
430  if( rc < 0 )
431  {
432  printf("Error: Failed to calibrate cross-talk compensation.\n");
433  return -LAE_ECODE_NO_EXEC;
434  }
435 
436  printf("Cross-Talk Calibration Summary:\n");
437  printf(" Cross-Talk\n");
438  printf(" Post-Calib: %3d\n", nCrossTalk);
439  printf(" Note: Cross-talk compensation is stored in volatile register\n"
440  " SYSRANGE_CROSSTALK_COMPENSATION_RATE (0x%04x)\n"
441  " Tune parameter <tof_crosstalk>\n",
442  VL6180X_SYSRANGE_CROSSTALK_COMPENSATION_RATE);
443 
444  printf("\n");
445 
446  return LAE_OK;
447 }
448 
449 static int calibrateSensorOffset()
450 {
451  int nOffsetPre;
452  double fAvgPre;
453  int nOffsetPost;
454  double fAvgPost;
455  int nCrossTalk;
456  int c;
457  int rc;
458 
459  printf(
460 "\n"
461 "Range sensor part-to-part offset calibration.\n\n" );
462 
463  // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
464  // Offset calibration
465  // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
466  printf("%s\n", Sep);
467  printf("Calibrate Part-To-Part Offset\n\n");
468 
469  printf("Setup: Place a white target (>= 88%% reflectance) at a distance\n");
470  printf(" of 50mm from sensor (or front of glass cover if present).\n");
471 
472  printf("\nPress any key to when ready ('q' to quit): ");
473  fflush(stdout);
474  c = kbhit();
475  if( (c == 'q') || (c == EOF) )
476  {
477  return -LAE_ECODE_NO_EXEC;
478  }
479 
480  printf("\n Calibrating...\r");
481  fflush(stdout);
482 
483  rc = ToFSensor->calibOffset(nOffsetPre, fAvgPre, nOffsetPost, fAvgPost);
484 
485  if( rc < 0 )
486  {
487  printf("Error: Failed to calibrate offset.\n");
488  return -LAE_ECODE_NO_EXEC;
489  }
490 
491  printf("Offset Calibration Summary:\n");
492  printf(" Offset Average\n");
493  printf(" Pre-Calib: %3d %.3lf\n", nOffsetPre, fAvgPre);
494  printf(" Post-Calib: %3d %.3lf\n", nOffsetPost, fAvgPost);
495  printf(" Note: Offset is stored in volatile register\n"
496  " SYSRANGE_PART_TO_PART_RANGE_OFFSET (0x%04x)\n"
497  " Tune parameter <tof_offset>\n",
498  VL6180X_SYSRANGE_PART_TO_PART_RANGE_OFFSET);
499  printf("\n");
500 
501  return LAE_OK;
502 }
503 
504 static void readSensorCalibTuneRegs()
505 {
506  byte_t regRangeOffset;
507  u16_t regRangeCrossTalk;
508  byte_t regAlsGain;
509  u16_t regAlsIntPeriod;
510 
511  ToFSensor->readShadowRegs(regRangeOffset, regRangeCrossTalk,
512  regAlsGain, regAlsIntPeriod);
513  printf("%s\n", Sep);
514  printf("VL6180 Sensor Calibration/Tuning Register Values:\n");
515  printf(" Range Offset: %u\n", regRangeOffset);
516  printf(" Range Cross Talk: %u\n", regRangeCrossTalk);
517  printf(" ALS Analog Gain: %u\n", regAlsGain);
518  printf(" ALS Integration Period: %u\n", regAlsIntPeriod);
519 }
520 
521 static void printHdr(int what)
522 {
523  switch( what )
524  {
525  case MeasTypeAmbient:
526  printf(" lux\n");
527  break;
528  case MeasTypeBoth:
529  printf(" meters lux\n");
530  break;
531  case MeasTypeDistance:
532  default:
533  printf(" meters\n");
534  break;
535  }
536 }
537 
538 static void printMeasurement(int seqnum, int what, double fMeters, double fFlux)
539 {
540  printf("%7d ", seqnum);
541 
542  // distance
543  if( (what == MeasTypeDistance) || (what == MeasTypeBoth) )
544  {
545  if( fMeters > VL6180X_RANGE_MAX )
546  {
547  printf(" no_obj ");
548  }
549  else if( fMeters == VL6180X_ERR_MEAS )
550  {
551  printf(" error ");
552  }
553  else
554  {
555  printf(" %6.3lf ", fMeters);
556  }
557  }
558 
559  if( (what == MeasTypeAmbient) || (what == MeasTypeBoth) )
560  {
561  if( fFlux == VL6180X_ERR_MEAS )
562  {
563  printf(" error ");
564  }
565  else
566  {
567  printf(" %6.1lf ", fMeters);
568  }
569  }
570 
571  printf("\r");
572  fflush(stdout);
573 }
574 
575 static int measure()
576 {
577  int seqnum;
578  double fMeters = 0.0, fLux = 0.0;
579  int c;
580 
581  printf("%s\n", Sep);
582 
583  if( OptsNoAuto )
584  {
585  printf("Press any key to start measurements ('q' to quit): ");
586  fflush(stdout);
587  if( kbhit() == EOF )
588  {
589  return APP_EC_OK;
590  }
591  printf("\n\n");
592  }
593  else
594  {
595  //printf("Press 'q' to quit.\n\n");
596  }
597 
598  printHdr(Measure);
599 
600  for(seqnum=0; ; ++seqnum)
601  {
602  switch( Measure )
603  {
604  case MeasTypeAmbient:
605  fLux = ToFSensor->measureAmbientLight();
606  printMeasurement(seqnum, Measure, 0.0, fLux);
607  break;
608  case MeasTypeBoth:
609  fMeters = ToFSensor->measureRange();
610  fLux = ToFSensor->measureAmbientLight();
611  printMeasurement(seqnum, Measure, fMeters, fLux);
612  break;
613  case MeasTypeDistance:
614  default:
615  fMeters = ToFSensor->measureRange();
616  printMeasurement(seqnum, Measure, fMeters, 0.0);
617  break;
618  }
619 
620  if( OptsNoAuto )
621  {
622  c = kbhit();
623  if( (c == 'q') || (c == EOF) )
624  {
625  break;
626  }
627  }
628  //else if( getch() == 'q' )
629  //{
630  // break;
631  //}
632  else
633  {
634  usleep(1000*OptsTimePeriod);
635  }
636  }
637 
638  return LAE_OK;
639 }
640 
641 /*!
642  * \brief Main initialization.
643  *
644  * \param argc Command-line argument count.
645  * \param argv Command-line argument list.
646  *
647  * \par Exits:
648  * Program terminates on conversion error.
649  */
650 static void mainInit(int argc, char *argv[])
651 {
652  // name of this process
653  Argv0 = basename(argv[0]);
654 
655  // parse input options
656  argv = OptsGet(Argv0, &PkgInfo, &PgmInfo, OptsInfo, true, &argc, argv);
657 
658  if( argc == 0 )
659  {
660  fprintf(stderr, "%s: No sensor number <N> specified.\n", Argv0);
661  fprintf(stderr, "Try '%s --help' for more information.\n", Argv0);
662  exit(APP_EC_ARGS);
663  }
664  else if( strToInt(argv[0], SensorId) < 0 )
665  {
666  if( tofNameToInt(argv[0], SensorId) < 0 )
667  {
668  fprintf(stderr, "%s: '%s': Bad sensor Id/Name.\n", Argv0, argv[0]);
669  fprintf(stderr, "Try '%s --help' for more information.\n", Argv0);
670  exit(APP_EC_ARGS);
671  }
672  }
673  else if( (SensorId < ToFSensor0Chan) || (SensorId > ToFSensor7Chan) )
674  {
675  fprintf(stderr, "%s: %d: Sensor number out of range.\n", Argv0, SensorId);
676  fprintf(stderr, "Try '%s --help' for more information.\n", Argv0);
677  exit(APP_EC_ARGS);
678  }
679 }
680 
681 /*!
682  * \brief Main.
683  *
684  * \param argc Command-line argument count.
685  * \param argv Command-line argument list.
686  *
687  * \return Returns 0 on succes, non-zero on failure.
688  */
689 int main(int argc, char* argv[])
690 {
691  int rc; // return code
692 
693  mainInit(argc, argv);
694 
695  if( connectSensor(SensorId) < 0 )
696  {
697  return APP_EC_EXEC;
698  }
699 
700  readSensorInfo();
701 
702  if( OptsCalibOffset )
703  {
704  calibrateSensorOffset();
705  }
706 
707  if( OptsCalibXTalk )
708  {
709  calibrateSensorCrossTalk();
710  }
711 
712  readSensorCalibTuneRegs();
713 
714  rc = measure();
715 
716  I2CBus.close();
717 
718  return rc == LAE_OK? APP_EC_OK: APP_EC_EXEC;
719 }
720 
721 /*!
722  * \}
723  */
int main(int argc, char *argv[])
Main.
#define VL6180X_RANGE_MAX
maximum range (m)
Definition: laeVL6180.h:131
static char * Argv0
the command
Definition: laelaps_tof.cxx:88
double degToRad(double d)
Convert degrees to radians.
Definition: laeUtils.h:124
control register mask
Definition: laeI2CMux.h:100
static void mainInit(int argc, char *argv[])
Main initialization.
static char * OptsMeasure
measure range
Definition: laelaps_tof.cxx:91
Laelaps PCA9548A I2C multiplexer switch interface.
#define APP_EC_OK
success exit code
Definition: laelaps_tof.cxx:84
VL6180 Time of Flight Class.
Definition: laeVL6180.h:368
int calibCrossTalk(int &nCrossTalk)
Calibrate cross-talk compensation.
Definition: laeVL6180.cxx:1037
Laelaps I2C class interface.
int calibOffset(int &nOffsetPre, double &fAvgPre, int &nOffsetPost, double &fAvgPost)
Calibrate part-to-part offset.
Definition: laeVL6180.cxx:878
Laelaps Time-of-Flight sensors. The ToFs are used as a virtual bumper for close-in obstacle detection...
int initSensor(bool bForce=false)
Initialize sensor with recommended settings and defaults.
Definition: laeVL6180.cxx:232
virtual int open(const std::string &strDevName)
Open I2C bus device.
Definition: laeI2C.cxx:114
#define APP_EC_EXEC
execution exit code
Definition: laelaps_tof.cxx:86
static int OptsTimePeriod
sense time period (msec)
Definition: laelaps_tof.cxx:90
The <b><i>Laelaps</i></b> namespace encapsulates all <b><i>Laelaps</i></b> related constructs...
Definition: laeAlarms.h:64
int readId(struct VL6180xIdentification &id)
Read sensor identification.
Definition: laeVL6180.cxx:529
static const PkgInfo_T PkgInfo
Definition: version.h:45
void readShadowRegs()
Read shadows register values and update derived data.
Definition: laeVL6180.cxx:496
std::string getDesc()
Get sensor short description.
Definition: laeVL6180.h:535
Laelaps common utilities.
std::string getNameId()
Get sensor assigned name id.
Definition: laeVL6180.h:525
static bool_t OptsNoAuto
don&#39;t auto-run
Definition: laelaps_tof.cxx:89
#define APP_EC_ARGS
command-line options/arguments error exit code
Definition: laelaps_tof.cxx:85
Package version information.
static OptsPgmInfo_T PgmInfo
Program information.
Laelaps system devices.
static bool_t OptsCalibXTalk
do [not] calibrate range crosstalk
Definition: laelaps_tof.cxx:93
#define VL6180X_ERR_MEAS
error meassurement
Definition: laeVL6180.h:164
static OptsInfo_T OptsInfo[]
Command line options information.
virtual int close()
Close I2C bus device.
Definition: laeI2C.cxx:144
double measureRange(u32_t msecWait=0xffff)
Measure the sensed target range.
Definition: laeVL6180.cxx:547
static bool_t OptsCalibOffset
do [not] calibrate range offset
Definition: laelaps_tof.cxx:92
double measureAmbientLight(u32_t msecWait=0xffff)
Measure the sensed ambient light illuminance.
Definition: laeVL6180.cxx:696
Top-level package include file.