Robotics StackExchange | Archived questions

Generated message types don't provide CallbackType

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.

Asked by Rufus on 2021-02-16 21:03:59 UTC

Comments

Answers