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


LMS1xx
Author(s): Konrad Banachowicz
autogenerated on Wed Nov 13 2013 12:49:49