Skip to content

Conversation

@ggorjup
Copy link
Contributor

@ggorjup ggorjup commented May 26, 2025

Hello, this PR fixes the robot connection check in ABB hardware interface (as mentioned in #78 (comment)).

Bug

Currently, the loop counter is incremented before comparing it to NUM_CONNECTION_RETRIES. The counter can therefore never be equal to NUM_CONNECTION_RETRIES within the loop, so the following check can never be true:

    if (counter == NUM_CONNECTION_TRIES)
    {
      RCLCPP_ERROR(LOGGER, "Failed to connect to robot");
      return CallbackReturn::ERROR;
    }

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_RETRIES in 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:=false

Without 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.

Copy link
Collaborator

@Yadunund Yadunund left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix.

@Yadunund Yadunund merged commit 05cbabe into PickNikRobotics:rolling Jul 14, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants