Generated message types don't provide CallbackType

asked 2021-02-16 20:03:59 -0500

Rufus gravatar image

updated 2021-02-16 20:14:22 -0500

I am trying to use this specific overload for advertiseService using a custom lambda function. My attempt is as follows

  ros::ServiceServer my_service = 
    nh.advertiseService<my_pkg::MyService>(my_service_name,
      [&](my_pkg::MyService& call) -> bool
      {
        ...
      });

I get the error

error: no type named ‘CallbackType’ in ‘struct my_pkg::MyService’

Following the trail brings me to initBySpecType which indeed is requesting Spec::CallbackType where Spec is my_pkg::MyService.

Looking at the generated header for struct my_pkg::MyService, it indeed is missing a CallbackType.

Is anyone else experiencing the same issue?

Using another overload which explicitly specifies my_pkg::MyService::Request and my_pkg::MyService::Response works.

edit retag flag offensive close merge delete