Skip to content

Conversation

@danmartzla
Copy link
Contributor

@danmartzla danmartzla commented Jun 30, 2024

Added the roslibpy.ActionClient object to send actions goals to ROS2-based systems.
This implementation has limited capabilities (related to RobotWebTools/rosbridge_suite#909) such as:

  • Goal cancelation is not functional.
  • Goal rejection/acceptance are not being notified to the Action client.

What type of change is this?

  • Bug fix in a backwards-compatible manner.
  • New feature in a backwards-compatible manner.
  • Breaking change: bug fix or new feature that involve incompatible API changes.
  • Other (e.g. doc update, configuration, etc)

Checklist

  • I added a line to the CHANGELOG.rst file in the Unreleased section under the most fitting heading (e.g. Added, Changed, Removed).
  • I ran all tests on my computer and it's all green (i.e. invoke test).
  • I ran lint on my computer and there are no errors (i.e. invoke check).
  • I have added tests that prove my fix is effective or that my feature works.
  • I have added necessary documentation (if appropriate)

Copy link

@sea-bass sea-bass left a comment

Choose a reason for hiding this comment

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

This all looks great to me -- just a few minor formatting things and I think this V1 support will be a great addition. Thank you!

@danmartzla
Copy link
Contributor Author

This all looks great to me -- just a few minor formatting things and I think this V1 support will be a great addition. Thank you!

Hi! I already fixed your suggested minor changes. Thanks.

@sea-bass
Copy link

sea-bass commented Oct 2, 2024

Sorry, but I'm not a maintainer of this repo so I can't actually approve your changes. I was just looking because I implemented the rosbridge side of this work.

@sea-bass
Copy link

sea-bass commented Oct 3, 2024

Sorry @danmartzla, I forgot to mention that I recently landed a small change to the protocol that allows for cleaner action cancellation. It may require a small change since now the action_result message also contains a status field telling you whether the action was successful, canceled, aborted, etc.: RobotWebTools/rosbridge_suite#953

Also @gonzalocasas Would you be able to review this PR?

@danmartzla
Copy link
Contributor Author

I've adapted this minor change to work with the latest rosbridge_suite updates.

However, sending a cancelation request from a roslibpy "Action Client" seems not to be working. The "rosbridge_server" debug logs do not report any cancelation request (or any other received message). The JSON message seems to be correct based on the documentation:

https://github.com/danmartzla/roslibpy/blob/bcd403c12f32da1118a6c71d84602a237592bf72/src/roslibpy/core.py#L598-L604

@sea-bass
Copy link

sea-bass commented Jan 6, 2025

It does look right... I wonder if you need the send_action_goals_in_new_thread parameter in the server set to True for this to work?

@danmartzla
Copy link
Contributor Author

It does look right... I wonder if you need the send_action_goals_in_new_thread parameter in the server set to True for this to work?

OK. I was totally unaware about this parameter of the "rosbridge_server". I can confirm that it is working well when launching the server this way:
ros2 launch rosbridge_server rosbridge_websocket_launch.xml send_action_goals_in_new_thread:="true"

I'm adding this as a comment in the example code : https://github.com/danmartzla/roslibpy/blob/13ae184e691f3024c15bcc1e6a3f857c89affb65/docs/files/ros2-action-client.py#L41-L42

@sea-bass
Copy link

sea-bass commented Jan 6, 2025

Awesome, great to hear!

There is also an equivalent call_services_in_new_thread which allows multiple service calls to be processed concurrently.

Not necessary for this example, of course, but just noting.

Copy link

@sea-bass sea-bass left a comment

Choose a reason for hiding this comment

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

@gonzalocasas this has been around a while and seems to work well. Please consider merging this great contribution.

@yuriyfedyuk
Copy link

@danmartzla First of all thank you for such great feature. During the testing we faced the same issue that you had, we are not able to cancel action. We use ROS2 humble and we build rosbridge and roslibpy from the latest sources.
Here is how we launch rosbridge server
root@9db9713f3160:/opt/ros_ws# ros2 launch rosbridge_server rosbridge_websocket_launch.xml send_action_goals_in_new_thread:=true [INFO] [launch]: All log files can be found below /root/.ros/log/2025-02-01-19-31-13-527917-9db9713f3160-34804 [INFO] [launch]: Default logging verbosity is set to INFO [INFO] [rosbridge_websocket-1]: process started with pid [34805] [INFO] [rosapi_node-2]: process started with pid [34807] [rosbridge_websocket-1] [WARN] [1738438274.037011958] [rosbridge_websocket]: The 'default_call_service_timeout' parameter is currently set to 0.0, which means service calls will block indefinitely if no response is received. Please note that in the Jazzy and later releases, the default value for this parameter will be updated to 5.0 seconds. [rosbridge_websocket-1] [WARN] [1738438274.037679806] [rosbridge_websocket]: The 'call_services_in_new_thread' parameter is currently set to False, which means service calls will block the main thread. Please note that in the Jazzy and later releases, the default value for this parameter will be updated to True. [rosbridge_websocket-1] [INFO] [1738438274.040429291] [rosbridge_websocket]: Rosbridge WebSocket server started on port 9090

@danmartzla @sea-bass Could you please describe your environment? do you use humble or newest version?

@yuriyfedyuk
Copy link

yuriyfedyuk commented Feb 2, 2025 via email

@sea-bass
Copy link

sea-bass commented Feb 3, 2025

@yuriyfedyuk Asking just in case, but is the action server that you're communicating to via rosbridge capable of handling cancellations? If it is not, then sending a cancel message via rosbridge will do nothing.

Have you tried with e.g., this server?
https://github.com/ros2/examples/blob/rolling/rclpy/actions/minimal_action_server/examples_rclpy_minimal_action_server/server_single_goal.py

@yuriyfedyuk
Copy link

yuriyfedyuk commented Feb 3, 2025 via email

@sea-bass sea-bass mentioned this pull request Mar 18, 2025
@danmartzla
Copy link
Contributor Author

Hi all,

It has been quite a while since I first opened this PR. Is it possible that the owner has abandoned this repo?

@tetov
Copy link
Contributor

tetov commented May 2, 2025

I'm looking into this as well and sent a message to @gonzalocasas to make him aware of this PR. :)

@gonzalocasas
Copy link
Collaborator

It has been quite a while since I first opened this PR. Is it possible that the owner has abandoned this repo?

Sorry the massive delay, the repo is definitely not abandoned, I just had a lot on my plate for a while. Will review and we can probably merge very soon

@sea-bass
Copy link

Sorry the massive delay, the repo is definitely not abandoned, I just had a lot on my plate for a while. Will review and we can probably merge very soon

Bump. This issue was raised again 3 weeks ago on the rosbridge_suite repo, and I just pointed them to this branch

@danmartzla danmartzla changed the title Added ROS2 ActionClient w/ limited functionality Added ROS2 ActionClient support Jun 18, 2025
@EzraBrooks
Copy link
Contributor

@gonzalocasas Bump again! If you need any support on this, I have some time I can contribute.

@EzraBrooks
Copy link
Contributor

Hi @gonzalocasas, pinging again.

I really appreciate your work maintaining this library, but without ROS 2 Action support it's pretty limited. Even ROS# has Actions support now.

@bjsowa @sea-bass If this repository is stuck, how would you feel about forking into RobotWebTools to cohabitate with rosbridge and roslibjs?

@bjsowa
Copy link
Member

bjsowa commented Jul 21, 2025

@bjsowa @sea-bass If this repository is stuck, how would you feel about forking into RobotWebTools to cohabitate with rosbridge and roslibjs?

I think moving this to the RWT organization would be a great idea. That said, forking the repo would unfortunately lose the history of PRs and issues, which isn't ideal. A better option would be to transfer the repository-assuming @gonzalocasas is open to it.

Also, I’m not yet a member of the RobotWebTools organization-would appreciate an invite!

@gonzalocasas
Copy link
Collaborator

If a transfer to the RWT org would be a possibility, I'd be totally up for it!

@sea-bass
Copy link

This plan sounds like a great idea!

@MatthijsBurgh would you have the power to transfer the repo and add @bjsowa (who has been maintaining rosbridge and web_video_server) as an org member?

@MatthijsBurgh
Copy link

Which repo? As this is a PR from one repo to another one?

I have added @bjsowa to the organization. The teams are a mess, so we might need to update them later on.

@bjsowa
Copy link
Member

bjsowa commented Jul 22, 2025

Which repo? As this is a PR from one repo to another one?

I have added @bjsowa to the organization. The teams are a mess, so we might need to update them later on.

This one, not the fork.

To transfer a repository to an organization, you need admin access to the repo and ability to create repositories in the organization. The easiest way would be probably to add @gonzalocasas to the organization and let them handle the transfer.

@MatthijsBurgh
Copy link

To what repos does @gonzalocasas need access to on top of the permissions to migrate the repo?

@bjsowa
Copy link
Member

bjsowa commented Jul 22, 2025

To what repos does @gonzalocasas need access to on top of the permissions to migrate the repo?

For the transfer just the "Create repository" permission is needed.

@MatthijsBurgh
Copy link

Is enabled for now

@MatthijsBurgh
Copy link

@gonzalocasas You have been invited to the RobotWebTools organization. Please accept the invitation and migrate the repository

@gonzalocasas
Copy link
Collaborator

Done!

@sea-bass
Copy link

sea-bass commented Jul 28, 2025

Oh hey, my approval counts now!

EDIT: It seems like the changelog verification PR needs a repo secret transfered over for auth to work properly... or rather, we should make a new one.

@sea-bass sea-bass merged commit 75a63b8 into RobotWebTools:main Jul 28, 2025
6 of 7 checks passed
@EzraBrooks
Copy link
Contributor

Thanks y'all! Glad we could get this across the finish line!

@zugaldia
Copy link

zugaldia commented Oct 6, 2025

Are there any plans to issue a new release that includes this change? Looks like the latest release is from January.

@gonzalocasas
Copy link
Collaborator

@zugaldia yes, but I'd like to get this PR #143 merged before cutting a new release, which would be roslibpy 2.0

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.

9 participants