Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cancel_action_goal results in action_result with no status #920

Closed
mirons5678 opened this issue Apr 12, 2024 · 3 comments · Fixed by #953
Closed

cancel_action_goal results in action_result with no status #920

mirons5678 opened this issue Apr 12, 2024 · 3 comments · Fixed by #953
Labels

Comments

@mirons5678
Copy link

Description

If I send send_action_goal message and let the action run to completion I get back an action_result with a values field that contains a status of 4 (i.e. SUCCEEDED), e.g.:

{
  "op": "action_result",
  "action": "/robot/navigate_to_pose",
  "values": {
    "status": 4,
    "result": {
      "result": {}
    }
  },
  "result": true,
  "id": "2"
}

However, if I send a cancel_action_goal message before the action has completed, I get back an action_result with a values field that does not contain a status (I expected to see status 5 (i.e. CANCELED)).

  • Library Version: Built from source (7d78af1)
  • ROS Version: Humble
  • Platform / OS: Ubuntu 22.04

Steps To Reproduce

Send send_action_goal followed by cancel_action_goal. Am running rosbridge with send_action_goals_in_new_thread:=true

Expected Behavior

Expect to receive an action_result with values field with status 5 (CANCELED), e.g.

{
  "op": "action_result",
  "action": "/robot/navigate_to_pose",
  "values": {
    "status": 5,
    "result": {
      "result": {}
    }
  },
  "result": true,
  "id": "2"
}

Actual Behavior

Actually receive an action_result with values field with no status, e.g.

{
  "op": "action_result",
  "action": "/robot/navigate_to_pose",
  "values": "None",
  "result": false,
  "id": "1"
}

Also see the following error log from the rosbridge server:

[rosbridge_websocket-1] [ERROR] [1712917839.725245716] [rosbridge_websocket]: [Client c19854d4-a8e8-49d2-9736-3b500c846d61] send_action_goal Exception: send_action_goal:/robot/navigate_to_pose:49724a1e-dffc-4a4d-a8f6-a66cbe77d5ec
@mirons5678 mirons5678 added the bug label Apr 12, 2024
@sea-bass sea-bass self-assigned this Sep 28, 2024
@sea-bass sea-bass removed their assignment Sep 28, 2024
@sea-bass
Copy link
Contributor

I tried something to fix this, but I couldn't get it working with CANCELED. If you're ok with it returning ABORTED and no result, there is #952

@sea-bass
Copy link
Contributor

sea-bass commented Sep 28, 2024

I think the issue with my above attempt, which didn't quite work, is that if you post an action_result message, it seems to always succeed the goal.

The current workaround of aborting a goal when a cancel is sent doesn't seem correct; rather, we should wait until the action returns, check its status, and update the goal in rosbridge accordingly. So the real integration test would be that you create a ROS 2 action server that is cancellable, and see if the cancel request goes through, and you get a return with the right status.

HOWEVER, this idea will likely need to change the protocol so the action_result payload actually has a status associated with it. Right now the protocol has a result: bool, which needs to change to the integer enum matching this specification, and needs to be piped along properly.

@sea-bass
Copy link
Contributor

sea-bass commented Sep 29, 2024

Update: I just tried again in #953 -- could you check if this works for you?

I'm not sure how you're sending the messages, but currently roslibjs also will need to be updated to handle this extra status field added in the above PR.

If all went well, the result should look like:

{
  "op": "action_result",
  "action": "/robot/navigate_to_pose",
  "values": {
    "result": {}
  },
  "status": 5,
  "result": true,
  "id": "2"
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants