Use system tool to ping connection of a sick scanner #109
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Context
In some applications, we need to restart the scanners (from a PLC) without necessary restart the unit that run ROS driver.
Actual Behavior
If we restart the scanners while the ROS driver is running, the actual behavior is that no data are output because there is no way to check if the connection is dropped so the node is getting stuck. This is explained here : #79, #95.
Feature Behavior
From #79, @puck-fzi gave some options to implement a watchdog, so i tried to implement the "easier" one but not the best i concede. However, in our case its working!
So i used the system tool to ping the IP address of the scanner in a separate thread and check if a packet is received or not. If its not the case, shutdown the node and after that you can respawn with specific tag in a launch file or maybe with another way. The objective here is to check for a disconnection while the ROS driver is running.
Finally, i dont know if this pull could be merged to the principal branch but it could be useful for people who had the same issue.
Thank you!