Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #include <iostream>
00019
00020 #include <boost/lexical_cast.hpp>
00021
00022 #include <lms1xx.h>
00023
00024 void print_usage() {
00025
00026 std::cout << " Usage : " << std::endl;
00027 std::cout << " set_config ip resolution rate " << std::endl;
00028 std::cout << " Exqample : " << std::endl;
00029 std::cout << " set_config 192.168.1.2 0.25 50 " << std::endl;
00030 }
00031
00032 int main(int argc, char** argv) {
00033
00034 LMS1xx laser;
00035 scanCfg sCfg;
00036
00037 if(argc < 4) {
00038 print_usage();
00039 return 0;
00040 }
00041
00042 laser.connect(argv[1]);
00043
00044 if(!laser.isConnected()) {
00045 std::cout << "Unable to connect to device at address : " << argv[1] << std::endl;
00046 return 0;
00047 }
00048
00049 sCfg.angleResolution = (int)(boost::lexical_cast<double>(std::string(argv[2])) * 10000);
00050 sCfg.scaningFrequency = boost::lexical_cast<int>(std::string(argv[3])) * 100;
00051
00052 laser.login();
00053 laser.setScanCfg(sCfg);
00054 laser.saveConfig();
00055
00056 sCfg = laser.getScanCfg();
00057
00058 std::cout << "Configuration set to : " << std::endl;
00059 std::cout << "resolution : " << (double)sCfg.angleResolution/10000.0 << std::endl;
00060 std::cout << "frequency : " << (double)sCfg.scaningFrequency/100.0 << std::endl;
00061
00062 laser.disconnect();
00063
00064 return 0;
00065 }