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

Extract only TCP protocol and communication code #259

Closed depauwjimmy closed 6 months ago

depauwjimmy commented 6 months ago

Hi,

I am currently experimenting with a TIM781 and this repository but i would like to integrate it inside my own project. As ROS_VERSION==0, it does not fit my need for the following reason :

As ROS_VERSION>0 i have to start another node on the side which i have to manage on top of my own. I would like to avoid doing that if possible. I haven't checked so i don't know if i can send ROS command to change internal configuration on the fly. Maybe i can use installed ROS workspace inside my own program without starting anything else, if possible, do you have an example of that?

What would work best for me is to use only the TCP layer code, add it to my project, do the ROS part and have a better control on when commands are sent. What files should i copy and modify to achieve that? I looked at everything in tcp, sick_scan_common_nw and other but it's not easy to know what i need and what i don't. Some things are also confusing, for example SopasAnswer and SopasEventMessage are declared twice.

Thanks for your insight.

rostest commented 6 months ago

Thanks for your feedback. In general we recommend to use sick_scan_xd in combination with ROS-1 or ROS-2. ROS is a powerful framework not only for robotics but also for general tasks like point cloud visualisation or interprocess communication. If ROS is an option, go for it. Note that ROS_VERSION>0 requires a fully installed ROS-1 or ROS-2.

Dynamic changes of the lidar configuration are not supported. Note that modifications in the lidar configuration may depend on conditions. Using ROS, you can use ros service "ColaMsg" to directly send SOPAS telegrams including configuration parameters to the lidar. See the TiM781 telegram listing for details.

If ROS is not an option (ROS_VERSION==0), we recommend to use the sick_scan_xd API as described at https://github.com/SICKAG/sick_scan_xd/blob/master/doc/sick_scan_api/sick_scan_api.md. It is not recommended to extract, modify or integrate parts of the sick_scan_xd source files. The sick_scan_xd driver provides a C-API, since most programming languages support C-bindings.

A launch file contains the configuration and parameters of a lidar. It is recommended to keep these parameters separate from other application specific configuration files.

If you are not using argc and argv from a main function, you can call SickScanInitByCli with a string array, e.g.

const char* argv[] = { "my_application", "sick_tim_7xx.launch", "hostname:=192.168.0.1" };
SickScanApiHandle apiHandle = SickScanApiCreate(3, argv);
SickScanApiInitByCli(apiHandle, 3, argv);

See the C++ examples at https://github.com/SICKAG/sick_scan_xd/blob/master/doc/sick_scan_api/sick_scan_api.md#usage-example.