Skip to content

DockRobot fails without reason if the robot is already docked in the requested charging dock #5144

@josephduchesne

Description

@josephduchesne

Bug report

Required Info:

  • Operating System:
    • Ubuntu 24.04
  • Computer:
    • Thinkpad T480
  • ROS2 Version:
    • Jazzy
  • Version or commit hash:
    • 1.3.6-1noble.20250430.062618
  • DDS implementation:
    • CycloneDDS

Steps to reproduce issue

  • trigger action DockRobot on a charging dock (this succeeds)
  • trigger action DockRobot the same charging dock (this fails)

Expected behavior

If the robot is already docked in the charging dock, and docking request should succeed without moving the robot.

An alternative (more complex) behavior would be to return an error code that could then be used to determine if "already docked where you wanted" is a success or failure in whatever is calling the docking action.

Actual behavior

The robot fails to dock the second time.

Reproduction instructions

No special setup should be needed other than the robot must be considered docked when the 2nd DockRobot action is called.

Additional information

I am running into this on a custom subclass of ChargingDock, but the bug occurs before any custom code is run (in docking_server.cpp, which I'm not modifying).

The bug occurs here:
https://github.com/ros-navigation/navigation2/blob/main/nav2_docking/opennav_docking/src/docking_server.cpp#L252

IMO it's just an oversight where dockRobot() is returning without accounting for the fact that it's in an action handler callback and should succeed or fail the goal rather than just hanging up on the action client.

It might be sufficient to add:

result->success = true;
docking_action_server_->succeeded_current(result);

This bug's behavior is quite silly when translated to other contexts:

  • Teacher: "Please do this week's homework assignment"
  • Student: "I handed it in already!"
  • Teacher: "You fail!"

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions