Repository navigation
Add service client support. - #8
Conversation
|
Still not totally sure about service client On one hand without it there is a situation where application can call Alternatively if this was removed, Service reply drop callback could be added to client structure so application would be informed of this case. |
- Refactor service server and client callbacks to include their instances instad of only user_data. This frees up user_data in case we want to have single callback handling multiple services. - Update picoparams and examples with above changes. - Include service call drop callback that the user can provide. - Clean up some comments.
|
After doing |
|
Hey @xopxe, thanks for testing. Looks like zenoh-pico/api/macros.h is not available in c++. I tried to fix it in the last commit. |
|
Actually I am wrong. There are c++ overloaded functions declared a bit further down. So it seems it is something with the includes? |
|
Just before reading the last comment I pulled the "Fix for c++" and it compiled succesfully. |
|
I've been testing, and could it be that the namespace for the key expression is actually in Also, it seems that the key is recomputed on every service call. I see that "native" RCL clients have a |
|
Hey @xopxe. Your questions actually lead me to see that we were missing topic and service name separator conversion when making key expressions. It is added in the latest commit. I don't know if this was your issue, please let me know. Very good point about generating the key only once. What do you think about generating it the first time and saving in the service structure. Then check on each service call if we have it already. Like that user doesn't need to call any new function. EDIT: |
|
@xopxe I checked again the services in ROS when running in this case So in current version it's not supported to create service server key expression without node (you could now set node name pointer to 0 before declaring the service). The other ones are supported. You spotted correctly we should actually check for existence of node->name. Thank you! |
|
Sorry for the noise, after checking better I see the topic and service key expressions don't need to be mangled so I removed that part. |

This PR adds service client structures and ability to call ROS services. Inspired by #7
Example usage in examples/srv_client_add2ints.c
Tested only on Linux for now. Used
ros2 run demo_nodes_cpp add_two_ints_serveron ROS host.Fix generated hashes for service types. Generator script was using hashes from _Request and _Response types.