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
95 stars 85 forks source link

Error by running "SickScanApiInitByCli" with Python #225

Closed schweluSICKAG closed 8 months ago

schweluSICKAG commented 10 months ago

Hello, we want to use SickScanApiInitByCli from a Python environment with a code like this:

` self.sick_scan_library = SickScanApiLoadLibrary(["build/"], "libsick_scan_shared_lib.so") self.api_handle = SickScanApiCreate(self.sick_scan_library) args=["executable_placeholder", "/home/rosuser/sick_scan_ws/sick_scan_xd/launch/sick_multiscan.launch", "hostname:=12.3.11.188", "udp_receiver_ip:=12.3.7.101"]

cargs = (ctypes.c_char_p * len(args))() cargs[:] = [arg.encode('utf-8') for arg in args]

self.sick_scan_library.SickScanApiInitByCli(self.api_handle, len(cargs), cargs) `

When running the code, we receive this error:

[Error]: ## ERROR parseLaunchfileSetParameter(): Tag-Value setting not valid. Use pattern: := (e.g. hostname:=192.168.0.4) (Check the entry: )

Prior to the error, we receive many lines in which it appears to be parsing the launchfile, followed by many lines where it appears to be re-printing those configured values. example:

_msgpack_validator_valid_segments string 0 1 2 3 4 5 6 7 8 9 10 11 msgpack_validator_layer_filter string 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ros_qos int -1 laserscan_layerfilter string 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0

The line about laserscan_layer_filter is always the final one before the "Check the entry:" error. It seems sometimes the entry is blank and sometimes it's an inscrutable string for example:

[Error]: ## ERROR parseLaunchfileSetParameter(): Tag-Value setting not valid. Use pattern: := (e.g. hostname:=192.168.0.4) (Check the entry: pN�q%V)

Is there maybe an example available on how to run SickScanApiInitByCli using Python?

rostest commented 10 months ago

Thanks for your feedback. In https://github.com/SICKAG/sick_scan_xd/blob/master/doc/sick_scan_api/sick_scan_api.md you can find a minimalistic usage example in Python and a complete usage example in Python. Both examples use SickScanApiInitByLaunchfile to initialize a lidar with launchfile and parameter, e.g.:

cli_args = " ".join(sys.argv[1:])
SickScanApiInitByLaunchfile(sick_scan_library, api_handle, cli_args)

or more directly like

SickScanApiInitByLaunchfile(sick_scan_library, api_handle, "/home/rosuser/sick_scan_ws/sick_scan_xd/launch/sick_multiscan.launch hostname:=12.3.11.188 udp_receiver_ip:=12.3.7.101")