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