ROS2 async_send_request callback
I have created code similar to this example:
https://github.com/ros2/demos/blob/40...
However, in my code, when I call async_send_request
this->client_->async_send_request( request, callback );
I pass a callback of type
rclcpp::Client<cpp_rpispi::srv::Spixfer>::CallbackType && callback
However, in the callback, I am trying to publish to a topic, but the compiler states that the call to publish is not allowed since the callback has to be static, but the publisher is non-static.
So, how can I pass a non-static member function as the callback so I can publish a topic?
Thanks
UPDATE
Problem solved by using a local anonymous function instead.
Is there any way not using anonymous function?