A Gift To Be Simple - simple_actions

tl;dr: simple_actions is a new package for simplifying working with ROS 2 actions in C++ and Python.

In my work with ROS 2, I’ve found working with actions to be very frustrating compared with ROS 1. In ROS 1, you could use SimpleActionServer to implement an action with a single callback. The standard tutorial for ROS 2 has four callbacks that you must implement.

One does not simply write a single callback

Similarly, getting the result from an action client can require defining 2 different callbacks and/or understanding futures.

I don't know what futures are and at this point I'm too afraid to ask

To top it off, the patterns for writing servers/clients diverge a bit for rclcpp and rclpy. E.g. In rclcpp you specify the result callback when you send the goal, but in rclpy you do this in the goal response callback.

That’s where simple_actions comes in. It contains C++/Python implementations of “Simple” action servers and clients with streamlined functionality.

Does it remove some features of the core action libraries? Of course. It’s meant to only be used when you have a single action executing at a time. It always accepts goals. It is simpler with a preference given to ease-of-use and quick prototyping.

Issues/Pull requests welcome. Binaries for foxy/galactic/humble/rolling will be available with the next syncs.

Other links:

14 Likes

Thanks for this!

In my eyes, keeping the option of an “easy” way to learn or use ROS 2 is important to help newcomers (to ROS 2, to programming, etc).
I’m also lazy and, most of the time, a simple action server written in Python is enough.