SICKAG / sick_scan_xd

Based on the sick_scan drivers for ROS1, sick_scan_xd merges sick_scan, sick_scan2 and sick_scan_base repositories. The driver supports both Linux (native, ROS1, ROS2) and Windows (native and ROS2).
Apache License 2.0
90 stars 83 forks source link

Using two LMS1000 from one main thread #269

Closed cblesing closed 5 months ago

cblesing commented 5 months ago

Hi everyone,

I have a simple question again. Is it possible to run/start two SICK LMS1000 from one main thread in my program? To do so, I have called the corresponding sick_scan_xd api methods that are needed for bring up the scanner twice. Here is what I do.

SickScanApiCreate(numberOfScannerParameters, scannerParameter) (called twice with coresponding params) SickScanApiInitByCli(apiHandle, numberOfScannerParameters, scannerParameter) (called twice with coresponding params) SickScanApiRegisterCartesianPointCloudMsg(apiHandle, cb) (called twice with coresponding params)

If I run my main programm, I only see in the terminal log that one SICK TcpRecvThread is startet.

I also tried to use the SickScanApiInitByLaunchFile and gave the two nodes seperate names like I would do in ROS. But also in this case I only see one SICK TcpRecvThread comming up.

Am I doing something wrong, or is it not possible to bring up two Scanners from one main programm? If it is possible could you please decribe to me how?

I am using an Ubuntu 22.04 machine and a switch to connect the LSM1000. As you might have seen I use C++ and have no possibility to use ROS. The "main thread" mentioned above is just a simple C++ programm that receives the incomming scan data and process them.

Thanks in advance!

rostest commented 5 months ago

Thanks for your feedback. The sick_scan_xd-API currently does not support the (single- or multithreaded) use of 2 or more lidars in one process. We do not recommend doing so, since the sick_scan_xd library is not guaranteed to be threadsafe.

To run multiple lidars simultaneously, please use ROS or run sick_scan_xd in multiple and separate processes.