GithubHelp home page GithubHelp logo

sickag / sick_scan_base Goto Github PK

View Code? Open in Web Editor NEW
20.0 11.0 16.0 15.85 MB

Generic C++ library for SICK laser scanner. Currently we support Windows and Ubuntu 18.04LTS for x86 architectures with this software. Within the demo the gathered data is stored at regular intervals as CSV data and as an image file in JPEG format. The image file shows the scan data in the top view.

License: Apache License 2.0

CMake 0.06% C++ 98.22% C 1.18% Batchfile 0.09% Python 0.43% Shell 0.02%
mrs1xxx mrs1104 tim551 tim561 tim571 tim5xx sick lidar laserscanner lms4000

sick_scan_base's Introduction

IMPORTANT: This repository will not be maintained further. The sources have been completely transferred to the repository https://github.com/SICKAG/sick_scan_xd. The repository will be deleted after 12/31/2022 in 2023 without further notice.

sick_scan_base

Generic driver for SICK laser scanner

Generic C++ library for SICK laser scanner. Currently we support Windows and Ubuntu 18.04LTS for x86 architectures with this software. Within the demo the gathered data is stored at regular intervals as CSV data and as an image file in JPEG format. The image file shows the scan data in the top view.

Remark

During the last years we have developed different repositories within the driver development with the projects sick_scan, sick_scan2 and sick_scan_base, with which many lidars and radars of our company can be used under ROS1, ROS2 and generically under C++. For harmonization, due to customer requests and to increase clarity, we decided to combine these developments in the future. As a result of this work, at the end of 2021 we have created the repository sick_scan_xd, where we will continue future developments. We recommend using this new repository for development so that you can continue to benefit from our improvements and additions to our drivers.

Supported Hardware

This driver should work with all of the following products.

device name part no. description tested?
MRS1104 1081208 4 layer max. range: 64 m, ang. resol. 0.25 [deg] hor., 2.50 [deg] ver. ✔ [stable]
Scan-Rate: 50 Hz, 4x12.5 Hz
TiM433 prototype 1 layer range: 0.05 m ... 15 m, ang. resol. 0.33 [deg], 240 [deg] ✔ [prototype]
Scan-Rate: 15.0 Hz
TiM443 prototype 1 layer range: 0.05 m ... 15 m, ang. resol. 0.33 [deg], 240 [deg] ✔ [prototype]
Scan-Rate: 15.0 Hz
TiM551 1060445 1 layer max. range: 10 m, ang. resol. 1.00[deg] ✔ [stable]
Scan-Rate: 15 Hz
TiM561 1071419 1 layer max. range: 10 m, ang. resol. 0.33 [deg] ✔ [stable]
Scan-Rate: 15 Hz
TiM571 1079742 1 layer max. range: 25 m, ang. resol. 0.33 [deg] ✔ [stable]
Scan-Rate: 15 Hz
TiM781 1096807 1 layer max. range: 25 m, ang. resol. 0.33 [deg] ✔ [stable]
Scan-Rate: 15 Hz
TiM781S 1096363 1 layer max. range: 25 m, ang. resol. 0.33 [deg] ✔ [stable]
Scan-Rate: 15 Hz
LMS511-10100 PRO e.g. 1046135 1 layer max. range: 80 m, ang. resol. 0.167 [deg] ✔ [stable]
Scan-Rate: 100 Hz
LMS4xxx-Family e.g. 1091423 1 layer max. range: 3 m, ang. resol. 0,0833 [deg] ✔ [stable]
Scan-Rate: 600 Hz

Installation

Windows installation

To install sick_scan_base on Windows, follow the steps below:

  1. If not yet done, install Visual Studio. Visual Studio 2019 Community or Professional Edition is recommended.

  2. If not yet done, install boost and pthread using Visual Studios package manager vcpkg:

    • Install vcpkg:
    • Install required packages:
      vcpkg.exe install pthread:x86-windows
      vcpkg.exe install pthread:x64-windows
      vcpkg.exe install boost:x64-windows
      
    • Include vcpkg in your path:
      set PATH=c:\vcpkg\installed\x64-windows\bin;%PATH%
      
  3. Clone repository https://github.com/SICKAG/sick_scan_base:

    git clone https://github.com/SICKAG/sick_scan_base.git
    
  4. Build sick_generic_caller with cmake and Visual Studio 2019:

    cd sick_scan_base
    set _os=x64
    set _cmake_string=Visual Studio 16 2019
    set _msvc=Visual Studio 2019
    set _cmake_build_dir=build
    if not exist %_cmake_build_dir% mkdir %_cmake_build_dir%
    pushd %_cmake_build_dir%
    cmake -G "%_cmake_string%" ..
    popd
    

    Open file build\sick_scan_base.sln in Visual Studio and build all targets (shortcut F7).

Ubuntu installation

To install on Ubuntu, follow the steps below:

  1. Clone repository https://github.com/SICKAG/sick_scan_base:

    git clone https://github.com/SICKAG/sick_scan_base.git
  2. Build sick_generic_caller by using cmake

    cd sick_scan_base
    mkdir -p ./build
    cd ./build
    cmake -G "Unix Makefiles" ..
  3. Compile the software and build sick_generic_caller:

    make

Running

  1. Start software e.g. with
sick_generic_caller ./launch/sick_mrs_1xxx.launch hostname:=192.168.0.72

In general the software starts with the following options:

sick_generic_caller <launch-file> [<tag1>:=<value1>] [<tag2>:=<value>] ... [<tagn>:=<valuen>]

The tag/value pairs overwrite the settings in the launch file.

Check results

The software starts, connects to the scanner and writes data to the demo directory at regular intervals. It generates a top view scan image and a csv data file.

The HTML file image_viewer.html can be loaded into your favorite browser for checking purposes. The generated scan image is then shown in the browser.

You can find reference outputs in the demo directory.

Parameters

For the launch-file settings and the tag/values pairs the following keywords are supported:

Keyword Meaning Default value Hint
scanner_type Scanner family ??? see list above
min_ang Start scan angle in [rad] -2.3998277
max_ang End scan angle in [rad] +2.3998277
intensity_resolution_16bit Switch between 8Bit/16Bit "false" do not change
hostname Ip address of scanner 192.168.0.1 change to scanner ip address in your network (see faq)
port port number 2112 do not change, check firewall rules if there is blocking traffic
timelimit Timelimit in [sec] 5 do not change

Supported operating systems

This driver supports the following x86-based operating systems:

  • Ubuntu 18.04 with gcc
  • Windows 10 with Visual Studio Compiler (VS2017, VS2019)

Simulation

For unittests without sensor hardware, a LMS511 device can be simulated using the python script test/emulator/test_server.py. This script implements a simple tcp server for test purposes. It opens a listening tcp socket, connects to tcp clients, receives cola telegrams and sends predefined responses to the client.

Please note that this is just a simple test server for basic unittests of sick_scan_base drivers. It does not emulate any real lidar sensors!

Simulation on Windows

Run script run_simu_lms_5xx.cmd in folder test/scripts or execute the following commands:

REM Start test server
cd .\build
start "testserver" python ../test/emulator/test_server.py --scandata_file=../test/emulator/scandata/20210302_lms511.pcapng.scandata.txt --scandata_frequency=20.0 --tcp_port=2112
@timeout /t 1
REM Run sick_generic_caller
.\Debug\sick_generic_caller.exe ../launch/sick_lms_5xx.launch hostname:=127.0.0.1 sw_pll_only_publish:=False

Open file image_viewer.html in folder demo in your browser to view a jpg-image of the current scan.

Note, that python version 3 incl. runtime dlls must be accessable, f.e. by extending the PATH environment variable:

set PYTHON_DIR=%ProgramFiles(x86)%/Microsoft Visual Studio/Shared/Python37_64
set PATH=%PYTHON_DIR%;%PYTHON_DIR%/Scripts;c:\vcpkg\installed\x64-windows\bin;%PATH%

Simulation on Linux

Run script run_simu_lms_5xx.bash in folder test/scripts or execute the following commands:

python3 ./test/emulator/test_server.py --scandata_file=./test/emulator/scandata/20210302_lms511.pcapng.scandata.txt --scandata_frequency=20.0 --tcp_port=2112 &
sleep 1
./build_x64/sick_generic_caller ./launch/sick_lms_5xx.launch hostname:=127.0.0.1 sw_pll_only_publish:=False &

Open file image_viewer.html in folder demo in a browser (f.e. firefox) to view a jpg-image of the current scan.

Keywords

MRS1104 MRS1000 MRS1xxx sick_scan SICK LiDAR SICK Laser SICK Laserscanner TiM4xx TiM433 TiM443 TiM5xx TiM551 TiM561 TiM571

Support

  • In case of technical support please open a new issue. For optimal support, add the following information to your request:
  1. Scanner model name,
  2. Ros node startup log,
  3. Sopas file of your scanner configuration. The instructions at http://sickusablog.com/create-and-download-a-sopas-file/ show how to create the Sopas file.
  • In case of application support please use https://supportportal.sick.com .
  • Issue Handling: Issues, for which no reply was received from the questioner for more than 7 days, are closed by us because we assume that the user has solved the problem.

Trouble Shooting

The software is very similar to the ROS driver sick_scan. For FAQ and troubleshooting please also have a look at https://github.com/SICKAG/sick_scan

FAQ

"ERROR: Tcp::open: Failed to open TCP connection to 192.168.0.1, aborting."

❓ Question: sick_generic_caller gives you an answer like:

"ERROR: Tcp::open: Failed to open TCP connection to 192.168.0.1, aborting."

✅ Answer:

  1. Try to ping your device:

    ping 192.168.0.1
  2. Disconnect your scanner and retry ping

    ping 192.168.0.1

    The result of ping contains a pattern like

     ... Destination Host Unreachable
  3. Reconnect your device and try to ping:

    ping 192.168.0.1

If you do not know the ip address, try to find the ip address in your subnet:

apt-get install fping

scan your network (for example, subnet 192.168.10.0/24):

192.168.0.1/24

search for all ip addresses from 192.168.0.0 to 192.168.0.255

The result is similar to:

192.168.0.4 is alive
192.168.0.22 is alive

and a lot of unreachable entries. In the example the ip address 192.168.0.4 is the laserscanner MRS1104 and the ip address 192.168.0.22 is the computer running linux. Check this with

ifconfig|grep 192.168.0.22

IP Address of Laser Scanner

❓ Question: My scanner does not use the default ip address. What shall I do?

✅ Answer: There are two options doing this:

  • Permanently:
    Replace the following entry with your ip address.
  <param name="hostname" type="string" value="192.168.0.1" />
  • Temporarily
    Use a command line argument in addition to the launch file argument:
   hostname:=192.168.0.2

Timeout Warning

❓ Question: During start phase the are warning/error message like

no answer received after 5000 ms. Maybe sopas mode is wrong.

and some more warning/error messages:

✅ Answer: In this case the driver tries to start the scanner in binary mode. If this is not possible, warnings and error messages are generated. The driver switches the scanner from ASCII mode to binary mode and then restarts communication. The messages can therefore be ignored. For a long-term solution, we recommend switching from ASCII to binary communication with SOPAS ET under Windows.

Own Data Handling

❓ Question: I would like to process data with my own methods.

✅ Answer: Search for keyword "PUBLISH_DATA:" in the code and replace the code for writing jpeg-files and CSV-files with your own source code.

Known Issues

  • The intensity values in the csv demo file are currently 0.
  • If the scanner type is not selected correctly in the launchfile (e.g. launch->mrs_1xxx hardware->tim_5xx) starts the software and then crashes when receiving the first packet with a "bad pointer".

Creators

Michael Lehning

on behalf of SICK AG


Lehning Logo

sick_scan_base's People

Contributors

datadancer avatar heizmresickag avatar herrmanntell avatar michael1309 avatar rostest avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sick_scan_base's Issues

Blocked at sock->loopOnce() after disconnecting sensor.

I wanna test reconnection functionality of my own lib, so I tried to disconnect sensor while the driver runs well on my lib.

However, it is just blocked at function sock->loopOnce() (sock is an instance of sick_scan::SickScanCommonTcp).

Is there anyway I can stop the block? Or how to just stop a tcp sockect and start a new one with ease and properly?

Feeding the data into a 3rd party application

More often, people ask how to feed the collected data from the lidar into their own application.

For this one can use different of the interprocess communication:

For example, you can use C#, Python, or C++ (e.g., with QT) to integrate the driver into your own GUI.

You can collect the data in the generic driver and send it, for example, via a local loop as a UDP data stream to the target application. Alternatively, you can use shared memory or other means of inter-process communication.

On the receiver side of this data stream, you can then build the GUI as you wish.

Redefinition problems when trying to use 'sick_scan_base' for other libs.

Description:

I was trying to encapsulate sick_scan_base for my own lib which uses SickTim561.
I modified 'CMakeLists.txt' for compilation and installing and everything works fine.
However, when i tried '#include <sick_scan/sick_generic_laser.h>', some redefinition errors happen.

Error messages:

1>libboost_system-vc141-mt-x32-1_68.lib(error_code.obj) : error LNK2005: "public: virtual class boost::system::error_condition __thiscall boost::system::detail::system_error_category::default_error_condition(int)const " (?default_error_condition@system_error_category@detail@system@boost@@ube?AVerror_condition@34@H@Z) already defined in sick_scan.lib(rossimu.obj)

1>libboost_system-vc141-mt-x32-1_68.lib(error_code.obj) : error LNK2005: "public: virtual class std::basic_string<char,struct std::char_traits,class std::allocator > __thiscall boost::system::detail::generic_error_category::message(int)const " (?message@generic_error_category@detail@system@boost@@ube?AV?$basic_string@DU?$char_traits@D@std@@v?$allocator@D@2@@std@@h@Z) already defined in sick_scan.lib(rossimu.obj)

1>libboost_system-vc141-mt-x32-1_68.lib(error_code.obj) : error LNK2005: "public: virtual class std::basic_string<char,struct std::char_traits,class std::allocator > __thiscall boost::system::detail::system_error_category::message(int)const " (?message@system_error_category@detail@system@boost@@ube?AV?$basic_string@DU?$char_traits@D@std@@v?$allocator@D@2@@std@@h@Z) already defined in sick_scan.lib(rossimu.obj)

1>D:\visionnav-libraries\ForkingPerceptionModule2D\out\build32\bin\RelWithDebInfo\LaserDriver.dll : fatal error LNK1169: one or more multiply defined symbols found

Trials:

I tried everything I could come up, including adding "#ifndef #define #endif", but none helped. And I looked up the source code and found some functions may be the source of problems. The functions are like:
void ros::init(int &, char * *, class std::basic_string<char, struct std::char_traits, class std::allocator > const &, unsigned int)
{
Time::init();
}
But I still can't figure out how to solve this problem.

timestamp scan_reference

Hello,

I was wondering why the timestamp_sec and timestamp_nanosec does not update in the scan_refernce .csv file? I tried with TiM571 and LMS4000. Do you have any clues?

//stg710

Make on RPI4

Hello,

I tried the given steps on a brand new RPI4 with Raspian.
I installed

  • Cmake
  • latest boost lib (1.7.0)

However, I got this message:

image

Is there anything I can do?

BR

It seems that the frequency of the scan demo too low.

Hello, I used a LMS511-20100 to test the demo, but it seems that the frequency of data updates is too low.
I set the frequency of LMS511 at 25Hz, but the data updates in scan.csv need about 1 second.
Is there any way to set the data updates frequency?

LMS 1xx support

I did not see the LMS1xx in the list of supported devices. I would like to use this library to interface with this device. I saw that it is supported in the sick_scan library, but I don't want to use ROS.

Would the LMS1xx work with this library, and if not, could some minor changes make it work ?

Thanks for the help !

Bash file not running

When I try to run the .bash file, i ended up with this error.

Screenshot from 2021-04-07 14-22-10

Is there anything I need to rectify?
Working on Ubuntu 20.04, ROS Noetic and connected to SICK TIM 581 LiDAR

Stack buffer overflow vulnerability in sick_scan_base allows attackers to cause a denial of service (crash) via the parameter related to __name

The statement strcpy(nameVal, argv_tmp[i] + strlen(nameId)); in sick_generic_caller does not check the length of the second argument, causing a stack buffer overflow vulnerability.
To reproduce:

./sick_generic_caller launch/sick_tim_5xx.launch __name:=`perl -e "print 'A'x8096"`
ROS_INFO: sick_generic_caller V. 1.7.7
ROS_INFO: Program arguments: ./sick_generic_caller
ROS_INFO: Program arguments: launch/sick_tim_5xx.launch
ROS_INFO: Segmentation fault

Activate stand by

Hello,
I am trying to activate the stand by mode for a LMS511 scanner working on Windows 10. I have implemented the method SickScanCommon::ActivateStandBy():

std::vector<unsigned char> reqBinary;
this->convertAscii2BinaryCmd(sopasCmdVec[CMD_SET_ACCESS_MODE_3].c_str(), &reqBinary);
std::vector<unsigned char> replyDummy;
int result = sendSopasAndCheckAnswer(reqBinary, &replyDummy, CMD_SET_ACCESS_MODE_3);	  
if (result != 0)		  
    return false;
this->convertAscii2BinaryCmd(sopasCmdVec[CMD_ACTIVATE_STANDBY].c_str(), &reqBinary);
result = sendSopasAndCheckAnswer(reqBinary, &replyDummy, CMD_ACTIVATE_STANDBY);
if (result != 0)
    printf("\nSOPAS - Error activating stand by!\n");
else
    printf("\nSOPAS - Stand by activated.\n");
return result;

It correctly sets the scanner in stand by mode because the led turns red and I can check it in SOPAS. However I obtain an error at sendSopasAndCheckAnswer
Error Sopas answer mismatch Error acticvating Standby Answer= >>>sSN LMDscandata
How can I know if stand by was activated?

Memory Leak when running sick_scan_caller

I tried running sick_scan_caller, and everything went fine.
But I noticed that the memory it cost went up and didn't seem to stop rising.
So I tried using Dr.Memory to detect memory leak, and the report shows that it does.
Report is shown in next chat box.
Btw, my device is sick tim 561, and the program was running on Windows10.
So how could we fix this?

Development status

Is work on this still ongoing? Would love to have a driver for TiM or LMS family of scanners without having to use ROS.

How to reconnect within a short period of time?

I'm now conducting reconnection by establishing a new connection, which cost me about 30s to wait.
Is there an official API to do this? And is it able to reduce the reconnecting time to less than 10s?

Pthread issue Windows 10

Hi,

I have been trying to get this compiling on Windows 10 without luck.

Here is what I did:

  1. Download boost 1.65.1
  2. Modify CMakeLists.txt to find boost.
set(Boost_INCLUDE_DIRS "C:/local/boost_1_65_1")
set(Boost_DIR "C:/local/boost_1_65_1")
set(Boost_LIBRARY_DIR "C:/local/boost_1_65_1/lib64-msvc-14.1")

target_link_libraries(sick_generic_caller libboost_system-vc141-mt-s-1_65_1.lib libboost_thread-vc141-mt-s-1_65_1.lib libboost_filesystem-vc141-mt-s-1_65_1.lib)

  1. mkdir build && cd build
  2. cmake .. -A x64
  3. Open visual studio and compile
2>C:\Projects\sick_scan_base-master\roswrap\src\cfgsimu\sick_scan\time_modi.cpp(466): error C3861: 'usleep': identifier not found2>rossimu.cpp2>Unknown compiler version - please run the configure tests and report the results2>Please define _WIN32_WINNT or _WIN32_WINDOWS appropriately. For example:2>- add -D_WIN32_WINNT=0x0501 to the compiler command line; or2>- add _WIN32_WINNT=0x0501 to your project's Preprocessor Definitions.2>Assuming _WIN32_WINNT=0x0501 (i.e. Windows XP target).2>C:\Projects\sick_scan_base-master\include\sick_scan/tcp/SickThread.hpp(9): fatal error C1083: Cannot open include file: 'pthread.h': No such file or directory2>duration.cpp2>Unknown compiler version - please run the configure tests and report the results

After sniffing around in the code I cannot find any ifdefs regarding pthread. So I have no idea how this is supposed to work on Windows. I guess there is https://sourceware.org/pthreads-win32/ and https://docs.microsoft.com/en-us/previous-versions/tn-archive/bb463209(v=technet.10)?redirectedfrom=MSDN But before I try those options I would like to know if they are required or if I am missing something.

Best Regards
Alexander Poole

Cmake issue on windows 10

Hi, i am getting the error while cloning.
Screenshot 2021-10-14 112209

Is that the reason why i am getting the error of:
'cmake' is not recognized as an internal or external command,
operable program or batch file.
while trying to build sick_generic_caller with cmake and Visual Studio 2019.

Any ways that i can resolve this issue? thank you.

Sick_scan on Windows 10

Hello,

I'm working on a TIM240 and I would like to use sick_scan on Windows 10. I had some trouble first because some librairies (inet.h, socket.h) are for Unix.
Sick send me a link to a closed issue which can help me : #6

I saw your recommandations and I installed vcpkg, boost and pthread. But I don't understand the next step about build.bat.
which build.bat ? Where I can find it ?
sick_scan issue

Thank you in advance for your response.
Best regards,
Julien REY.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.