Fix status message dropped when received before goal response callback (Fixes #2782) - #3275
Aaravanand00 wants to merge 1 commit into
Conversation
When an action server starts executing and publishes a status message before the client-side send_goal response callback has finished creating the GoalHandle, the status update was ignored because goal_id was not yet in goal_handles_. Fix by storing early status messages in a pending_statuses_ map and applying them immediately when the GoalHandle is registered in goal_handles_. Fixes ros2#2782 Closes ros2#2781 Signed-off-by: Aaravanand <aaravanand@gmail.com>
|
Hi @fujitatomoya Fixed Issue #2782 by storing early status messages in a |
|
This is more a workaround than a proper fix. The underlying issue is that the rcl layer does not report the events in the correct order. |
@jmachowinski makes sense. |
|
This PR would then get reduced to only the fix, the workaround must not be needed if it is properly fixed in rcl. rcl_action_client_wait_set_get_entities_ready is the function that needs to be fixed. |
ros2/rcl#1337 ptal... I have removed the workaround from rclcpp and implemented the proper fix in the rcl layer as you suggested. The wait_set function now strictly prioritizes goal responses over status updates, ensuring the correct event order. If this looks good, we can close this PR in favor of the new one.... |
Description
This PR fixes Issue #2782 (
Status is Never Set to Executing if ros2 action rclcpp_action) and adds the corresponding unit test case (status_message_before_goal_response) for Issue #2781.Cause of Bug (#2782):
When
async_send_goalis called, theGoalHandleis only added togoal_handles_after theSendGoalservice response callback completes on the client side. If an action server starts executing immediately and publishes aGoalStatusMessage(STATUS_EXECUTING) on the action status topic before the client-side service response callback runs,handle_status_messagecheckedgoal_handles_.count(goal_id) == 0, logged"Received status for unknown goal. Ignoring...", and dropped the status update!Fix:
rclcpp_action::Clientnow maintains apending_statuses_map to store early status messages received prior toGoalHandlecreation.SendGoalservice response callback creates theGoalHandleand registers it ingoal_handles_, it checkspending_statuses_and immediately applies any pending status update (e.g.STATUS_EXECUTING).TEST_F(TestClientAgainstServer, status_message_before_goal_response)inrclcpp_action/test/test_client.cppto verify this behavior.Fixes #2782
Closes #2781
Is this user-facing behavior change?
Yes,
rclcpp_actionclient now correctly updates goal status toSTATUS_EXECUTINGwhen status messages arrive before the goal response callback completes.Did you use Generative AI?
Yes Ai Agent was used to construct the verify code formatting.