PepperlFuchs / pf_lidar_ros_driver

ROS driver for Pepperl+Fuchs R2000 and R2300 laser scanners
https://www.pepperl-fuchs.com/global/en/23097.htm
Apache License 2.0
37 stars 37 forks source link

Restarting the node several times starts causing persistent protocol error #119

Closed sarguez closed 11 months ago

sarguez commented 11 months ago

Hello,

When I kill and restart the node several times, I start getting this after the third one:

[/r2000_node  INFO 1698241970.008605855]: Device found: R2000
protocol error: 120 New connection would exceed limit on number of connections(3>=3)
[/r2000_node ERROR 1698241970.015934572]: Could not acquire communication handle
[/r2000_node ERROR 1698241970.015972343]: Unable to initialize device

This problem persists until I powercycle the scanner itself.

I suspect that there may be some connection left to the laser that is not cleaned up upon killing the node.

hsd-dev commented 11 months ago

Thanks for reporting the issue. Which ROS distro and which branch did you test the driver with?

sarguez commented 11 months ago

Hello, I tested with ROS noetic, on tag: 1.2.1

hsd-dev commented 11 months ago

The connection handle is being released here actually:

https://github.com/PepperlFuchs/pf_lidar_ros_driver/blob/df8047e2b4f075032a42fa07074d09e13a9e089c/src/pf_driver/src/pf/pf_interface.cpp#L155

which gets called after terminating the node

https://github.com/PepperlFuchs/pf_lidar_ros_driver/blob/df8047e2b4f075032a42fa07074d09e13a9e089c/src/pf_driver/src/ros/ros_main.cpp#L105

I will test this tomorrow morning.

ptruka commented 11 months ago

Hi @sarguez I just tried to recreate your problem

  1. Driver is running.
  2. Node is killed with CTRL+C and started again immediately via roslaunch
  3. Driver is running again. I repeated those steps 10x and found no issue.

Edit: Test with R2000 --> I can reproduce your issue, we are working on a fix. Thanks for reporting!

hsd-dev commented 11 months ago

@sarguez fixed in https://github.com/PepperlFuchs/pf_lidar_ros_driver/pull/120. Could you please confirm?

sarguez commented 11 months ago

@ipa-hsd Hello, thanks for the quick fix. I tested it now as well, it works.

hsd-dev commented 11 months ago

Actually the "fix" has caused an issue with the reconnect feature. I am working on it. Once that feature is restored, I will close the issue.

hsd-dev commented 11 months ago

The reconnect feature is stored.