26 int main(
int argc,
char* argv[])
32 unsigned int values[SickLMS2xx::SICK_MAX_NUM_MEASUREMENTS] = {0};
33 unsigned int num_values = 0;
34 unsigned int telegram_idx = 0;
35 unsigned int real_time_idx = 0;
38 if ((argc != 2 && argc != 3) || (argc == 2 && strcasecmp(argv[1],
"--help") == 0)) {
39 cout <<
"Usage: lms2xx_real_time_indices PATH [BAUD RATE]" << endl
40 <<
"Ex: lms2xx_real_time_indices /dev/ttyUSB0 9600" << endl;
52 if ((desired_baud = SickLMS2xx::StringToSickBaud(argv[2])) == SickLMS2xx::SICK_BAUD_UNKNOWN) {
53 cerr <<
"Invalid baud value! Valid values are: 9600, 19200, 38400, and 500000" << endl;
71 cerr <<
"Initialize failed! Are you using the correct device path?" << endl;
78 if (sick_lms_2xx.
GetSickAvailability() & SickLMS2xx::SICK_FLAG_AVAILABILITY_REAL_TIME_INDICES) {
85 for (
unsigned int i=0; i < 10; i++) {
88 sick_lms_2xx.
GetSickScan(values,num_values,NULL,NULL,NULL,&telegram_idx,&real_time_idx);
89 cout <<
"\t Num. Values: " << num_values <<
", Msg Idx: " << telegram_idx
90 <<
", Real-time Idx: " << real_time_idx << endl;
98 cerr <<
"An error occurred!" << endl;
105 cout <<
"Please set the Sick LMS to an availability w/ real-time indices..." << endl;
106 cout <<
"Hint: Use the lms_config utility/example! :o)"<< endl;
117 cerr <<
"Uninitialize failed!" << endl;
SickLMS2xx * sick_lms_2xx
int main(int argc, char *argv[])
Definition of class SickLMS2xx. Code by Jason C. Derenick and Thomas H. Miller. Contact derenick(at)l...