26 int main(
int argc,
char* argv[]) {
31 unsigned int values[SickLMS2xx::SICK_MAX_NUM_MEASUREMENTS] = {0};
32 unsigned int num_values = 0;
33 unsigned int scan_idx = 0;
34 unsigned int telegram_idx = 0;
37 if ((argc != 2 && argc != 3) || (argc == 2 && strcasecmp(argv[1],
"--help") == 0)) {
38 cout <<
"Usage: lms2xx_partial_scan PATH [BAUD RATE]" << endl
39 <<
"Ex: lms2xx_partial_scan /dev/ttyUSB0 9600" << endl;
51 if ((desired_baud = SickLMS2xx::StringToSickBaud(argv[2])) == SickLMS2xx::SICK_BAUD_UNKNOWN) {
52 cerr <<
"Invalid baud value! Valid values are: 9600, 19200, 38400, and 500000" << endl;
70 cerr <<
"Initialize failed! Are you using the correct device path?" << endl;
77 if (sick_lms_2xx.
GetSickAvailability() & SickLMS2xx::SICK_FLAG_AVAILABILITY_REAL_TIME_INDICES) {
89 sick_lms_2xx.
SetSickVariant(SickLMS2xx::SICK_SCAN_ANGLE_100,SickLMS2xx::SICK_SCAN_RESOLUTION_25);
94 for (
unsigned int i=0; i < 12; i++) {
105 sick_lms_2xx.
GetSickPartialScan(values,num_values,scan_idx,NULL,NULL,NULL,&telegram_idx);
106 cout <<
"\t Start angle: " << setw(4) << 0.25*scan_idx <<
", Num. Values: " << num_values <<
", Msg Idx: " << telegram_idx << endl;
114 cerr <<
"An error occurred!" << endl;
120 cout <<
"Please set the Sick LMS to an availability w/ real-time indices..." << endl;
121 cout <<
"Hint: Use the lms_config utility/example! :o)"<< endl;
132 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...