-
Notifications
You must be signed in to change notification settings - Fork 185
Service Introspection #990
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
cc8cb4f
introspection prototyping
ihasdapie 16607a6
more prototyping
ihasdapie 1076d8c
introspection message published but segfaulting after first one publi…
ihasdapie 3a9b27d
working demo with hardcoded typesupport
ihasdapie 23f5881
try rosidl_service_introspection
ihasdapie 9c0b42e
service introspection hooked into all four service events
ihasdapie 6dca2e8
use new rmw_client_t.writer_guid
ihasdapie 652cff9
use correct typesupport and actually populate message info field
ihasdapie 3c8eb75
move rcl_client_impl_s into client_impl.h to improve ergonomics for s…
ihasdapie 3fd6e2c
move src/introspection.h to include/introspection.h
ihasdapie d1a6e61
support enable/disable service introspection events and content
ihasdapie fa4cd78
clang-format
ihasdapie 2070595
use case statement fallthrough
ihasdapie 5a1a990
consolidate service introspection enable/disable to service introspec…
ihasdapie 78f85f0
remove rosidl_typesupport_introspection_c dependency
ihasdapie 0933ee6
request clock from user for service introspection timestamps
ihasdapie File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,170 @@ | ||
| // Copyright 2022 Open Source Robotics Foundation, Inc. | ||
| // | ||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||
| // you may not use this file except in compliance with the License. | ||
| // You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, software | ||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| // See the License for the specific language governing permissions and | ||
| // limitations under the License. | ||
|
|
||
| #ifndef RCL__SERVICE_INTROSPECTION_H_ | ||
| #define RCL__SERVICE_INTROSPECTION_H_ | ||
|
|
||
| #ifdef __cplusplus | ||
| extern "C" | ||
| { | ||
| #endif | ||
|
|
||
| #include "rcl/publisher.h" | ||
| #include "rcl/service.h" | ||
| #include "rcl/client.h" | ||
| #include "rcl/time.h" | ||
| #include "rmw/rmw.h" | ||
| #include "stdbool.h" | ||
|
|
||
| #define RCL_SERVICE_INTROSPECTION_TOPIC_POSTFIX "/_service_event" | ||
|
|
||
| typedef struct rcl_service_introspection_utils_s { | ||
ihasdapie marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| rcl_clock_t * clock; | ||
| rcl_publisher_t * publisher; | ||
| rosidl_message_type_support_t * request_type_support; | ||
| rosidl_message_type_support_t * response_type_support; | ||
| char * service_name; | ||
| char * service_type_name; | ||
| char * service_event_topic_name; | ||
|
|
||
|
|
||
| // enable/disable service introspection during runtime | ||
| bool _enabled; | ||
| // enable/disable passing along service introspection content during runtime | ||
| bool _content_enabled; | ||
| } rcl_service_introspection_utils_t; | ||
ihasdapie marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
|
|
||
| RCL_PUBLIC | ||
| RCL_WARN_UNUSED | ||
| rcl_service_introspection_utils_t | ||
| rcl_get_zero_initialized_introspection_utils(); | ||
|
|
||
| RCL_PUBLIC | ||
| RCL_WARN_UNUSED | ||
| rcl_ret_t | ||
| rcl_service_introspection_init( | ||
ihasdapie marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| rcl_service_introspection_utils_t * introspection_utils, | ||
| const rosidl_service_type_support_t * service_type_support, | ||
| const char * service_name, | ||
| const rcl_node_t * node, | ||
| const rcl_clock_t * clock, | ||
| rcl_allocator_t * allocator); | ||
|
|
||
| RCL_PUBLIC | ||
| RCL_WARN_UNUSED | ||
| rcl_ret_t | ||
| rcl_service_introspection_fini( | ||
| rcl_service_introspection_utils_t * introspection_utils, | ||
| rcl_allocator_t * allocator, | ||
| rcl_node_t * node); | ||
ihasdapie marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| RCL_PUBLIC | ||
| RCL_WARN_UNUSED | ||
| rcl_ret_t | ||
| rcl_introspection_send_message( | ||
| const rcl_service_introspection_utils_t * introspection_utils, | ||
| uint8_t event_type, | ||
| const void * ros_response_request, | ||
| int64_t sequence_number, | ||
| const uint8_t uuid[16], // uuid is uint8_t but the guid is int8_t | ||
| const rcl_allocator_t * allocator); | ||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
| /* Enables service introspection by reconstructing the introspection clock and publisher | ||
| * | ||
| * Does nothing and returns RCL_RET_OK if already enabled | ||
| */ | ||
| RCL_LOCAL | ||
| RCL_WARN_UNUSED | ||
| rcl_ret_t | ||
| rcl_service_introspection_enable( | ||
| rcl_service_introspection_utils_t * introspection_utils, | ||
| const rcl_node_t * node, | ||
| rcl_allocator_t * allocator); | ||
|
|
||
| /* Disabled service introspection by fini-ing and freeing the introspection clock and publisher | ||
| * | ||
| * Does nothing and returns RCL_RET_OK if already disabled | ||
| * | ||
| * | ||
| * | ||
| */ | ||
|
|
||
| RCL_LOCAL | ||
| RCL_WARN_UNUSED | ||
| rcl_ret_t | ||
| rcl_service_introspection_disable( | ||
| rcl_service_introspection_utils_t * introspection_utils, | ||
| rcl_node_t * node, | ||
| const rcl_allocator_t * allocator); | ||
ihasdapie marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
|
|
||
|
|
||
|
|
||
| /* | ||
| * Enables/disables service introspection for client/service | ||
| * These functions are thin wrappers around rcl_service_introspection_{enable, disable} | ||
| * | ||
| * | ||
| * | ||
| */ | ||
| RCL_PUBLIC | ||
| RCL_WARN_UNUSED | ||
| rcl_ret_t | ||
| rcl_service_introspection_configure_service_events( | ||
| rcl_service_t * service, | ||
| rcl_node_t * node, | ||
| bool enable); | ||
ihasdapie marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| RCL_PUBLIC | ||
| RCL_WARN_UNUSED | ||
| rcl_ret_t | ||
| rcl_service_introspection_configure_client_events( | ||
| rcl_client_t * client, | ||
| rcl_node_t * node, | ||
| bool enable); | ||
|
|
||
|
|
||
| /* | ||
| * | ||
| */ | ||
| RCL_PUBLIC | ||
| void | ||
| rcl_service_introspection_configure_client_content(rcl_client_t * client, bool enable); | ||
|
|
||
| RCL_PUBLIC | ||
| void | ||
| rcl_service_introspection_configure_service_content(rcl_service_t * service, bool enable); | ||
ihasdapie marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
|
|
||
|
|
||
| // TODO(ihasdapie): Do we want some getters for if content and/or introspection enabled/disabled? | ||
ihasdapie marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
| #ifdef __cplusplus | ||
| } | ||
| #endif | ||
|
|
||
|
|
||
| #endif // RCL__SERVICE_INTROSPECTION_H_ | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.