main.cc
Go to the documentation of this file.
00001 
00019 #include <stdlib.h>
00020 #include <string>
00021 #include <iostream>
00022 #include <sicktoolbox/SickLD.hh>
00023 
00024 using namespace std;
00025 using namespace SickToolbox;
00026 
00027 int main (int argc, char *argv[]) {
00028 
00029   /* A string for the IP address */
00030   string sick_ip_addr(DEFAULT_SICK_IP_ADDRESS);
00031 
00032   /* Check the num of args */
00033   if(argc > 2 || (argc == 2 && strcasecmp(argv[1],"--help") == 0)) {
00034     cerr << "Usage: ld_more_config [SICK IP ADDRESS]" << endl
00035               << "Ex. ld_more_config 192.168.1.11" << endl;
00036     return -1;
00037   }
00038   
00039   /* Assign the IP address */
00040   if(argc == 2) {
00041     sick_ip_addr = argv[1];
00042   }
00043   
00044   /* Define the object */
00045   SickLD sick_ld(sick_ip_addr);
00046 
00047   /*
00048    * Initialize the Sick LD
00049    */
00050   try {
00051     sick_ld.Initialize();
00052   }
00053 
00054   catch(...) {
00055     cerr << "Initialize failed! Are you using the correct IP address?" << endl;
00056     return -1;
00057   }
00058   
00059   try {
00060   
00061     /* Assign absolute and then relative time */
00062     //uint16_t new_sick_time = 0;
00063     //sick_ld.SetSickTimeAbsolute(1500,new_sick_time);
00064     //cout << "\tNew sick time: " << new_sick_time << endl;    
00065     //sick_ld.SetSickTimeRelative(-500,new_sick_time);
00066     //cout << "\tNew sick time: " << new_sick_time << endl;
00067     
00068     /* Configure the Sick LD sensor ID */
00069     //sick_ld.PrintSickGlobalConfig();
00070     //sick_ld.SetSickSensorID(16);
00071     //sick_ld.PrintSickGlobalConfig();
00072     
00073     /* Configure the sick motor speed */
00074     //sick_ld.PrintSickGlobalConfig();
00075     //sick_ld.SetSickMotorSpeed(10);
00076     //sick_ld.PrintSickGlobalConfig();
00077     
00078     /* Configure the sick scan resolution */
00079     //sick_ld.PrintSickGlobalConfig();
00080     //sick_ld.SetSickScanResolution(0.5);
00081     //sick_ld.PrintSickGlobalConfig();
00082     
00083     /* Configure all the global parameters */
00084     //double start_angle = 45;
00085     //double stop_angle = 315;
00086     //sick_ld.PrintSickGlobalConfig();
00087     //sick_ld.PrintSickSectorConfig();
00088     //sick_ld.SetSickGlobalParamsAndScanAreas(10,0.5,&start_angle,&stop_angle,1);
00089     //sick_ld.PrintSickGlobalConfig();
00090     //sick_ld.PrintSickSectorConfig();
00091     
00092   }
00093 
00094   catch(...) {
00095     cerr << "An error occurred!" << endl;
00096   }
00097 
00098   /*
00099    * Uninitialize the device
00100    */
00101   try {
00102     sick_ld.Uninitialize();
00103   }
00104   
00105   catch(...) {
00106     cerr << "Uninitialize failed!" << endl;
00107     return -1;
00108   }
00109     
00110   /* Success! */
00111   return 0;
00112 
00113 }


sicktoolbox
Author(s): Jason Derenick , Thomas Miller
autogenerated on Thu Aug 27 2015 15:17:16