ld/ld_more_config/src/main.cc
Go to the documentation of this file.
1 
19 #include <stdlib.h>
20 #include <string>
21 #include <iostream>
22 #include <sicktoolbox/SickLD.hh>
23 
24 using namespace std;
25 using namespace SickToolbox;
26 
27 int main (int argc, char *argv[]) {
28 
29  /* A string for the IP address */
30  string sick_ip_addr(DEFAULT_SICK_IP_ADDRESS);
31 
32  /* Check the num of args */
33  if(argc > 2 || (argc == 2 && strcasecmp(argv[1],"--help") == 0)) {
34  cerr << "Usage: ld_more_config [SICK IP ADDRESS]" << endl
35  << "Ex. ld_more_config 192.168.1.11" << endl;
36  return -1;
37  }
38 
39  /* Assign the IP address */
40  if(argc == 2) {
41  sick_ip_addr = argv[1];
42  }
43 
44  /* Define the object */
45  SickLD sick_ld(sick_ip_addr);
46 
47  /*
48  * Initialize the Sick LD
49  */
50  try {
51  sick_ld.Initialize();
52  }
53 
54  catch(...) {
55  cerr << "Initialize failed! Are you using the correct IP address?" << endl;
56  return -1;
57  }
58 
59  try {
60 
61  /* Assign absolute and then relative time */
62  //uint16_t new_sick_time = 0;
63  //sick_ld.SetSickTimeAbsolute(1500,new_sick_time);
64  //cout << "\tNew sick time: " << new_sick_time << endl;
65  //sick_ld.SetSickTimeRelative(-500,new_sick_time);
66  //cout << "\tNew sick time: " << new_sick_time << endl;
67 
68  /* Configure the Sick LD sensor ID */
69  //sick_ld.PrintSickGlobalConfig();
70  //sick_ld.SetSickSensorID(16);
71  //sick_ld.PrintSickGlobalConfig();
72 
73  /* Configure the sick motor speed */
74  //sick_ld.PrintSickGlobalConfig();
75  //sick_ld.SetSickMotorSpeed(10);
76  //sick_ld.PrintSickGlobalConfig();
77 
78  /* Configure the sick scan resolution */
79  //sick_ld.PrintSickGlobalConfig();
80  //sick_ld.SetSickScanResolution(0.5);
81  //sick_ld.PrintSickGlobalConfig();
82 
83  /* Configure all the global parameters */
84  //double start_angle = 45;
85  //double stop_angle = 315;
86  //sick_ld.PrintSickGlobalConfig();
87  //sick_ld.PrintSickSectorConfig();
88  //sick_ld.SetSickGlobalParamsAndScanAreas(10,0.5,&start_angle,&stop_angle,1);
89  //sick_ld.PrintSickGlobalConfig();
90  //sick_ld.PrintSickSectorConfig();
91 
92  }
93 
94  catch(...) {
95  cerr << "An error occurred!" << endl;
96  }
97 
98  /*
99  * Uninitialize the device
100  */
101  try {
102  sick_ld.Uninitialize();
103  }
104 
105  catch(...) {
106  cerr << "Uninitialize failed!" << endl;
107  return -1;
108  }
109 
110  /* Success! */
111  return 0;
112 
113 }
Provides a simple driver interface for working with the Sick LD-OEM/Sick LD-LRS long-range models via...
Definition: SickLD.hh:56
int main(int argc, char *argv[])
#define DEFAULT_SICK_IP_ADDRESS
Default Sick LD INet 4 address.
Definition: SickLD.hh:21
void Initialize()
Initializes the driver and syncs it with Sick LD unit. Uses sector config given in flash...
Definition: SickLD.cc:91
Defines the SickLD class for working with the Sick LD-OEM/LD-LRS long range LIDARs.
Encapsulates the Sick LIDAR Matlab/C++ toolbox.
Definition: SickLD.cc:44
SickLD * sick_ld
void Uninitialize()
Tear down the connection between the host and the Sick LD.
Definition: SickLD.cc:1659


sicktoolbox
Author(s): Jason Derenick , Thomas Miller
autogenerated on Tue Sep 10 2019 03:37:34