ros2cs icon indicating copy to clipboard operation
ros2cs copied to clipboard

Implement ROS2 actions

Open RobertoRoos opened this issue 8 months ago • 7 comments

Title says it all: it would be cool to support ROS2 actions.

Potentially duplicates https://github.com/RobotecAI/ros2-for-unity/issues/48

I'm currently trying to write this, PR will hopefully follow.

An overview on how the different APIs look so far:

Langague Publisher Service Action
Python
from std_msgs.msg import String

self.create_publisher(String, 'topic', 10)
from example_interfaces.srv import AddTwoInts

self.create_service(AddTwoInts, 'add_two_ints', self.add_two_ints_callback)
from action_tutorials_interfaces.action import Fibonacci

ActionServer(
            self,
            Fibonacci,
            'fibonacci',
            self.execute_callback)
C++
#include "std_msgs/msg/string.hpp"

this->create_publisher<std_msgs::msg::String>("topic", 10);
#include "example_interfaces/srv/add_two_ints.hpp"

this->create_service<example_interfaces::srv::AddTwoInts>("add_two_ints", &add);
#include "action_tutorials_interfaces/action/fibonacci.hpp"

rclcpp_action::create_server<Fibonacci>(
      this,
      "fibonacci",
      std::bind(&FibonacciActionServer::handle_goal, this, _1, _2),
      std::bind(&FibonacciActionServer::handle_cancel, this, _1),
      std::bind(&FibonacciActionServer::handle_accepted, this, _1));
C#
using std_msgs.msg;

node.CreatePublisher<String>("chatter");
using example_interfaces.srv;

node.CreateService<AddTwoInts_Request, AddTwoInts_Response>("add_two_ints", recv_callback);
Missing

RobertoRoos avatar Nov 28 '23 12:11 RobertoRoos