ROS 2 joy_linux: better dev_name handling #301
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.
Addresses various problems with the
dev_name
parameter, which does not work as flexibly and reliably as we would like.Originally, if
dev_name
was specified, the node looked for a device with this identifier during initialization. If it could not be found, the node fell back to the device specified injoy_dev
.With my changes:
dev_name
will be matched against device identifiers as a substring, which is more flexible.dev_name
is not found during initialization, the node won't connect to the default device, but rather will keep waiting for the name to match, retrying every second.joy_dev
parameter practically won't have any effect ifjoy_name
is specified. The node will keep searching for the name.This makes it possible to specify a gamepad model that you expect to be connected to the PC. The node will then only connect to this type of gamepad and keep reconnecting if the connection is dropped. It is resilient to faulty USB connectors, since during reconnection we have no guarantee that the same
/dev/input/jsN
will be allocated.Unrelated change: publish zeros to
/joy
in the moment the device is disconnected.