Giter Club home page Giter Club logo

Comments (3)

wjwwood avatar wjwwood commented on September 13, 2024

@esteve, do you have any idea about this? A naive guess is that it has something to do with the ability to pass different kinds of callbacks to the create_service method.

from rmw_connext.

esteve avatar esteve commented on September 13, 2024

@wjwwood this should fix it, but it's too verbose IMO:

  node->create_service<userland_msgs::AddTwoInts>(
    "service_name",
    static_cast<rclcpp::service::Service<userland_msgs::AddTwoInts>::CallbackWithHeaderType>(add));

from rmw_connext.

wjwwood avatar wjwwood commented on September 13, 2024

I'm not sure why I created this issue here, probably should be on rclcpp.

Anyways, your suggestion works, but I agree that it's too verbose:

diff --git a/userland/src/add_two_ints_server.cpp b/userland/src/add_two_ints_server.cpp
index 72a3573..377f5b8 100644
--- a/userland/src/add_two_ints_server.cpp
+++ b/userland/src/add_two_ints_server.cpp
@@ -47,7 +47,8 @@ int main(int argc, char ** argv)

   auto node = rclcpp::Node::make_shared("add_two_ints_server");

-  node->create_service<userland_msgs::AddTwoInts>("add_two_ints", add);
+  node->create_service<userland_msgs::AddTwoInts>("add_two_ints",
+    static_cast<rclcpp::service::Service<userland_msgs::AddTwoInts>::CallbackWithHeaderType>(add));

   rclcpp::spin(node);

diff --git a/userland/test/test_server.cpp b/userland/test/test_server.cpp
index 612e449..8190fdf 100644
--- a/userland/test/test_server.cpp
+++ b/userland/test/test_server.cpp
@@ -33,7 +33,8 @@ int main(int argc, char ** argv)

   auto node = rclcpp::Node::make_shared("test_server");

-  node->create_service<userland_msgs::AddTwoInts>("service_name", add);
+  node->create_service<userland_msgs::AddTwoInts>("service_name",
+    static_cast<rclcpp::service::Service<userland_msgs::AddTwoInts>::CallbackWithHeaderType>(add));

   rclcpp::spin(node);

I'm going to try and resolve it some other way.

from rmw_connext.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.