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 "lms1xx.h"
00019
00020 #include <iostream>
00021 #include <unistd.h>
00022
00023 int main()
00024 {
00025 LMS1xx laser;
00026 scanData data;
00027
00028 laser.connect("192.168.1.2");
00029 if(!laser.isConnected())
00030 {
00031 std::cout << "connection failend" << std::endl;
00032 return 0;
00033 }
00034
00035 std::cout << "Connected to laser" << std::endl;
00036
00037 std::cout << "Loging in ..." << std::endl;
00038 laser.login();
00039
00040 laser.stopMeas();
00041
00042 std::cout << "Geting scan configuration ..." << ::std::endl;
00043 scanCfg c = laser.getScanCfg();
00044
00045
00046
00047 c.angleResolution = 5000;
00048 c.scaningFrequency = 5000;
00049
00050 laser.setScanCfg(c);
00051
00052 scanDataCfg cc;
00053 cc.deviceName = false;
00054 cc.encoder = 0;
00055 cc.outputChannel = 3;
00056 cc.remission = true;
00057 cc.resolution = 0;
00058 cc.position = false;
00059 cc.outputInterval = 1;
00060
00061 laser.setScanDataCfg(cc);
00062
00063 int ret = 0;
00064 std::cout << "Start measurements ..." << std::endl;
00065 laser.startMeas();
00066
00067 std::cout << "Wait for ready status ..." << std::endl;
00068 ret = 0;
00069 while (ret != 7)
00070 {
00071 ret = laser.queryStatus();
00072 std::cout << "status : " << ret << std::endl;
00073 sleep(1);
00074 }
00075 std::cout << "Laser ready" << std::endl;
00076
00077 std::cout << "Start continuous data transmission ..." << std::endl;
00078 laser.scanContinous(1);
00079
00080 for(int i =0; i < 3; i++)
00081 {
00082 std::cout << "Receive data sample ..." << std::endl;
00083 laser.getData(data);
00084 }
00085
00086 std::cout << "Stop continuous data transmission ..." << std::endl;
00087 laser.scanContinous(0);
00088
00089 laser.stopMeas();
00090
00091 std::cout << "Disconnect from laser" << std::endl;
00092 laser.disconnect();
00093
00094 return 0;
00095 }