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