Fix robot connection check #85
Merged
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.
Hello, this PR fixes the robot connection check in ABB hardware interface (as mentioned in #78 (comment)).
Bug
Currently, the loop
counteris incremented before comparing it toNUM_CONNECTION_RETRIES. Thecountercan therefore never be equal toNUM_CONNECTION_RETRIESwithin the loop, so the following check can never be true:This means that even if robot connection fails, the hardware interface falsely reports a successful activation.
Bugfix
By switching to post-increment, we ensure that
counter == NUM_CONNECTION_RETRIESin the final loop and the activation error is raised if robot connection fails.Test
We can test this by running the following command without the robot or simulator connected, and waiting for the timeout:
ros2 launch abb_bringup abb_control.launch.py description_package:=abb_irb1200_support description_file:=irb1200_5_90.xacro launch_rviz:=false use_fake_hardware:=false configure_via_rws:=falseWithout this bugfix, the driver reports successful activation of robot hardware and controllers after connection timeout.
With this bugfix, the driver raises a hardware activation error.