How to pass a variable as an argument to ROS2 service?
Hello everyone,
I would like to know if it's possible to an additional argument to a ROS2 service. The example that I follow only uses request and response as the function arguments.
https://docs.ros.org/en/foxy/Tutorial...
Here in the above example, the service function is defined as:
void add(const std::shared_ptr<example_interfaces::srv::AddTwoInts::Request> request,
std::shared_ptr<example_interfaces::srv::AddTwoInts::Response> response)
In my case, I want to pass an additional argument to that service function, a variable that is defined within the main(). Is it possible? If not, what's it the correct way of doing so?
PS: I am trying to implement my Python services in C++ therefore if what I am trying to do is more feasible in another way please feel free to help out.
Thanks!