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

ActionServer does not publish initial status #1072

Open
CraigBuilds opened this issue Jan 24, 2023 · 1 comment
Open

ActionServer does not publish initial status #1072

CraigBuilds opened this issue Jan 24, 2023 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@CraigBuilds
Copy link

CraigBuilds commented Jan 24, 2023

Bug report

  • Operating System:
    • Windows 10, Ubuntu 18.04 & 20.04
  • Installation type:
    • binaries
  • Version or commit hash:
  • DDS implementation:
    • RTI Connext 6.0.1
  • Client library (if applicable):
    • rclpy humble and foxy (but bug may exist in others)

Steps to reproduce issue

ros2 run examples_rclpy_minimal_action_server server
ros2 topic echo /fibonacci/_action/status
ros2 action send_goal /fibonacci example_interfaces/action/Fibonacci '{}'

Expected behavior

topic_echo should show status 1 (ACCEPTED) and then status 2 (EXECUTING)

Actual behavior

It jumps straight to EXECUTING

Additional information

This isn't just a problem with topic echo or the example node, I also have the same problem with my HMI (which uses the ActionClient) and my custom ros2 node.

A workaround is (for humble):

def handle_accepted_callback(goal_handle: ServerGoalHandle) -> None:
        goal_handle._action_server._handle.publish_status()

Or (for foxy)

from rclpy.impl.implementation_singleton import rclpy_action_implementation as _rclpy_action

def handle_accepted_callback(goal_handle: ServerGoalHandle) -> None:
        _rclpy_action.rclpy_action_publish_status(goal_handle._action_server._handle)

And then give this callback to the ActionServer

    ActionServer(
       ...
        handle_accepted_callback=handle_accepted_callback,
    )
@fujitatomoya
Copy link
Collaborator

Just FYI, ros2 run examples_rclpy_minimal_action_server server is not appropriate example to defer the goal execution, instead we could use ros2 run examples_rclpy_minimal_action_server server_defer which implements handle_accepted_callback.

even with server_defer, we can observe the reported behavior with rolling branch.

### start server_defer
root@tomoyafujita:~/docker_ws/ros2_colcon# ros2 run examples_rclpy_minimal_action_server server_defer 
[INFO] [1709017447.924342939] [minimal_action_server]: Received goal request
[INFO] [1709017447.925014705] [minimal_action_server]: Deferring execution...
[INFO] [1709017450.933514222] [minimal_action_server]: Executing goal...
[INFO] [1709017450.934203963] [minimal_action_server]: Returning result: array('i', [0, 1])

### send goal request
root@tomoyafujita:~/docker_ws/ros2_colcon# ros2 action send_goal /fibonacci example_interfaces/action/Fibonacci '{}'
...

### echo status topic
root@tomoyafujita:~/docker_ws/ros2_colcon# ros2 topic echo /fibonacci/_action/status --flow-style
status_list: [{goal_info: {goal_id: {uuid: [155, 120, 121, 141, 98, 179, 68, 250, 135, 43, 228, 201, 50, 85, 251, 181]}, stamp: {sec: 1709017557, nanosec: 860342776}}, status: 2}]
---
status_list: [{goal_info: {goal_id: {uuid: [155, 120, 121, 141, 98, 179, 68, 250, 135, 43, 228, 201, 50, 85, 251, 181]}, stamp: {sec: 1709017557, nanosec: 860342776}}, status: 4}]
---

i think that action client does not call publish_status() before execution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants