Repository navigation
C clients/services - #30
Conversation
|
The documentation should be fairly coherent now (?). |
| * rcl_node_options_t node_ops = rcl_node_get_default_options(); | ||
| * rcl_ret_t ret = rcl_node_init(&node, "node_name", &node_ops); | ||
| * // ... error handling | ||
| * rosidl_service_type_support_t * ts = ROSIDL_GET_MESSAGE_TYPE_SUPPORT( |
There was a problem hiding this comment.
Should be ROSIDL_GET_SERVICE_TYPE_SUPPORT?
|
I got through the headers with only minor comments and questions (I'll try to make a pr tonight to address the obvious changes). As for your OP questions:
Probably, since calling send_request and send_response should probably be thread safe, like publish is.
They are passed through to the rmw layer and at least one of the functions does need the original node handle to unregister types or something like that. We could argue that the client/service/publisher/etc should hold on to the dds participant or what ever it needs and use it during fini. The problem then becomes ownership of the pointer to that object. Since node has to be passed to the client's fini function, it's obvious that the node needs to be valid, otherwise it might make sense to fini the node and then the client (which would obviously be an issue if the client's fini function used a thing that is owned by the node that just got fini).
This is probably historical. I think we either were copying the style of the matching DDS function or we have some part of the take function chain that doesn't have many error codes (just ok or error), so taken was passed separately back and we copied that behavior. Either way I think using an error code would be ok, since we also do this for timeout. The only semantic squabble is that take can technically succeed even if no data is taken so it's not quite correct to say that taking no data is a failure.
I don't know. If the type of |
|
"They are passed through to the rmw layer and at least one of the functions does need the original node handle to unregister types or something like that. We could argue that the client/service/publisher/etc should hold on to the dds participant or what ever it needs and use it during fini. The problem then becomes ownership of the pointer to that object. Since node has to be passed to the client's fini function, it's obvious that the node needs to be valid, otherwise it might make sense to fini the node and then the client (which would obviously be an issue if the client's fini function used a thing that is owned by the node that just got fini)." I guess I was confused because the function signatures rmw_destroy_client and rmw_destroy_service don't include a rmw_node pointer: https://github.com/ros2/rmw/blob/master/rmw/include/rmw/rmw.h#L120 |
|
whoops, didn't see your thing about making a PR for the obvious stuff so I took care of it in 174feb6. More small adjustments are always welcome... |
|
Oh, I was just going to make a pr to help you out, but if you already found time to fix it up then that's fine. Yeah I'm not sure about node being passed to the client service finis. Maybe they shouldn't. |
|
Regarding the node pointer in client_fini and service_fini: https://github.com/ros2/rmw_opensplice/blob/master/rmw_opensplice_cpp/src/rmw_service.cpp#L206 Regarding In rcl (current state of this PR): In rmw: In typesupport: I don't see why the |
Sounds good to me.
That sounds appropriate, especially if there is both a request and a response header. |
d5cd824 to
5655078
Compare
|
I think the C Services PRs are ready for review. I can try separating out the changes a bit more if it makes things easier. http://ci.ros2.org/job/ci_linux/1071/ |
|
@jacquelinekay I'm starting a review now. |
|
I fixed the warnings and the test failure in rclpy: http://ci.ros2.org/job/ci_linux/1073/ |
|
OSX passes after some fiddling with linking in the generators: Onto Windows! |
|
OK, this Windows CI job appears to have the same number of warnings and test failures as the nightly Release job: |
| /* After calling this function on a rcl_client_t, it can be used to send requests of the given | ||
| * type by calling rcl_send_request(). | ||
| * Once a response has been sent by the service, the response is available to the client when | ||
| * rcl_take_response() is called. |
There was a problem hiding this comment.
Is it more correct to say "Once a response has been sent by the service, a response may become available in the future and if so it can be retrieved using rcl_take_response()."? As it is currently worded it sounds like calling rcl_take_response is what makes it available, which I think is misleading.
|
Other than my comments, lgtm. Btw, won't this require a related change in |
|
Yep, that's one of the many PRs linked to #27 on Waffle: ros2/rclpy#7 The values for number of clients and number of services are currently both hardcoded as zero until Python services are implemented. |
| * \return RCL_RET_OK if the response was taken successfully, or | ||
| * RCL_RET_INVALID_ARGUMENT if any arguments are invalid, or | ||
| * RCL_RET_CLIENT_INVALID if the client is invalid, or | ||
| * RCL_RET_ERROR if an unspecified error occurs. |
There was a problem hiding this comment.
RCL_RET_CLIENT_TAKE_FAILED doesn't seem to be documented here. Also did we ever decide if that was better (preferable) to passing a bool * taken parameter?
Awesome, sorry I missed that connection. |
Fixed up include guard names to RMW
…_local_endpoints Ignore local endpoints: RCL
Connects to #27
Implement C clients and services.
Not ready for review quite yet, but I would welcome a preliminary review of the .h files and the tests.
TODO:
takenboolean is not exposed as an argument to thetakefunctions, like it is in rmw. Instead, if take failed, a new error code (CLIENT_TAKE_FAILED or SERVICE_TAKE_FAILED) is returned. Is this OK? I see thatrcl_takeinsubscription.hhas a pointer to atakenboolean in the function signature. I suppose thetakefunctions should at least be consistent with each other. @wjwwood any thoughts?