Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support service 2/2 --- rosbag2 service play (#1481)
* Implement service play Signed-off-by: Barry Xu <barry.xu@sony.com> * Maintain the future queue of the request by timeout Signed-off-by: Barry Xu <barry.xu@sony.com> * Use get_message_typesupport_handle() instead of deprecated get_typesupport_handle() Signed-off-by: Barry Xu <barry.xu@sony.com> * Resolve the conflicts caused by the rebase Signed-off-by: Barry Xu <barry.xu@sony.com> * Address review comments from Fujita-san Signed-off-by: Barry Xu <barry.xu@sony.com> * Move codes to new function remove_complete_request_future Signed-off-by: Barry Xu <barry.xu@sony.com> * Move codes to new function remove_all_timeout_request_future() Signed-off-by: Barry Xu <barry.xu@sony.com> * Add warning log and lock protection Signed-off-by: Barry Xu <barry.xu@sony.com> * Optimize code in PlayerImpl::publish_message() Signed-off-by: Barry Xu <barry.xu@sony.com> * Changed the code logic for determining whether to use request data of client or service Signed-off-by: Barry Xu <barry.xu@sony.com> * Add warning log and tests Signed-off-by: Barry Xu <barry.xu@sony.com> * Correct the parameter descriptions and remove unnecessary code Signed-off-by: Barry Xu <barry.xu@sony.com> * Extend the parameters for the "play" command Add new parameters '--exclude-topics' and '--exclude-services'. Signed-off-by: Barry Xu <barry.xu@sony.com> * Move implmentation of struct client_id_hash to cpp Signed-off-by: Barry Xu <barry.xu@sony.com> * Address some minor review comments Signed-off-by: Barry Xu <barry.xu@sony.com> * Replace std::variant<SharedPlayerPublisher, SharedPlayerClient>> Signed-off-by: Barry Xu <barry.xu@sony.com> * Added code for cleaning up pending requests Signed-off-by: Barry Xu <barry.xu@sony.com> * Avoid creating publisher or client for filtered topic Signed-off-by: Barry Xu <barry.xu@sony.com> * Update code on filtering message for mcap Signed-off-by: Barry Xu <barry.xu@sony.com> * Use explicit namespace for topic name and update tests Signed-off-by: Barry Xu <barry.xu@sony.com> * Update for the rebase Signed-off-by: Barry Xu <barry.xu@sony.com> * Simplify variable names Signed-off-by: Barry Xu <barry.xu@sony.com> * Adjust the default timeout and queue length for request future Signed-off-by: Barry Xu <barry.xu@sony.com> * Cleanup and optimization in mcap_storage.cpp - Rewrite topic_filter to make clean and concise implementation. - Also addressed multiple performance related issues in topic_filter. - Delete MCAP_COMPILE_DEFS ROSBAG2_STORAGE_MCAP_HAS_STORAGE_FILTER_TOPIC_REGEX compilation flag since it is become absolute on Rolling, and we are not using anymore the same version of the mcap storage plugin for older ROS 2 distros. Signed-off-by: Michael Orlov <michael.orlov@apex.ai> * Move mcap topic_filter tests to a separate file Signed-off-by: Michael Orlov <michael.orlov@apex.ai> * Add TestResetFilter and CanSelectWithTopicsListOnly to the mcap storage Signed-off-by: Michael Orlov <michael.orlov@apex.ai> * Add CanSelectWithServiceEventsListOnly test to the mcap storage Signed-off-by: Michael Orlov <michael.orlov@apex.ai> * Cleanups and renames in the sqlite_storage.cpp Signed-off-by: Michael Orlov <michael.orlov@apex.ai> * Move SQLite3 topic_filter tests to a separate file Signed-off-by: Michael Orlov <michael.orlov@apex.ai> * Bugfix in sqlite topic filters when service_events or topics lists empty - Also add new tests `CanSelectWithTopicsListOnly` and `CanSelectWithServiceEventsListOnly` to cover changes. Signed-off-by: Michael Orlov <michael.orlov@apex.ai> * Rename test_sqlite3_topic_filter.cpp for consistency Signed-off-by: Michael Orlov <michael.orlov@apex.ai> * Change API to use rcl_serialized_message_t to avoid 2 extra message copy - Changed API for `async_send_request(..)`, `is_include_request_message(..)` and `get_msg_event_type(..)`` to use `rcl_serialized_message_t` instead of the `rclcpp::SerializedMessage` to avoid 2 extra message copy. - Renamed `introspection_include_metadata_and_contents(..)` to the `service_event_include_metadata_and_contents(..)`. - Altered `check_service_event_include_metadata_and_contents` unit test to use real serialized service event for verification and comparison. Signed-off-by: Michael Orlov <michael.orlov@apex.ai> * Misc minor fixes from previous rounds of review and new findings (1) - Mostly renames, cleanup in style wording and optimization in constructors Signed-off-by: Michael Orlov <michael.orlov@apex.ai> * Address ament_flake8 warning in regards whitespaces in the blank lines Signed-off-by: Michael Orlov <michael.orlov@apex.ai> * Simplify logic in is_topic_selected_by_white_list_or_regex(..) Signed-off-by: Michael Orlov <michael.orlov@apex.ai> Co-authored with: Barry Xu <barry.xu@sony.com> Co-authored-by: Barry Xu <barry.xu@sony.com> * Check is_topic_in_black_list_or_exclude_regex(..) first Co-authored-by: Barry Xu <barry.xu@sony.com> Signed-off-by: Michael Orlov <michael.orlov@apex.ai> * Add test coverage for the cases when exclude lists overlap with include Signed-off-by: Michael Orlov <michael.orlov@apex.ai> * Bugfix for incorrectly including all services when regex is not empty - Also add test coverage with new tests FilterTopicsAndServicesWithRegexAndNonexistentTopicsList and FilterTopicsAndServicesWithRegexAndNonexistentServicesList Signed-off-by: Michael Orlov <michael.orlov@apex.ai> * Rename test_sqlite3_topic_filter in CMakeList.txt Signed-off-by: Michael Orlov <michael.orlov@apex.ai> * Update spin & termination and add service ready check before play Signed-off-by: Barry Xu <barry.xu@sony.com> * Fix the issue of published_messages_from_multiple_services_are_recorded failing randomly Increase the waiting time for the record to start spinning. Signed-off-by: Barry Xu <barry.xu@sony.com> * Make service_event_ts_lib as private member again - Motivation: The shared pointer to the service event type support library shall be a member variable to make sure that library loaded during the liveliness of the instance of this class, since we have a raw pointers to its inner members. Signed-off-by: Michael Orlov <michael.orlov@apex.ai> * Cleanup in PlayerServiceClient::async_send_request(ser_message) - Rewrite raw pointers arithmetic. Assumption that size_t represent size of the void* may not necessarily be true on all platforms. - Use shared pointer with custom deleter for deserialized message. - Assumption that we can take first element from bounded sequence by dereferencing raw pointer to the bounded sequence may not be necessarily be true and up to the underlying rmw and transport layer implementation. Use dedicated request_member.get_function(request_sequence_ptr, 0) function instead. - Add sanity checks `for service_event_members_` in PlayerServiceClient constructor. Signed-off-by: Michael Orlov <michael.orlov@apex.ai> * Refactoring. Do full deserialization and only once - Rationale: We can't rely on assumption that we can safely partially deserialize service event to the ServiceEventInfo structure. Signed-off-by: Michael Orlov <michael.orlov@apex.ai> * Specify service request from which introspection message and fix uncrustify errors Signed-off-by: Barry Xu <barry.xu@sony.com> * Revert uncrustify changes from previous commit. - Rationale: We are moving to the new version of the uncrustify in rolling and still haven't done it yet fully for the baseline. The discrepancy in style for other untouched files like logging.hpp shall be addressed in a separate PR. Signed-off-by: Michael Orlov <michael.orlov@apex.ai> * Rename service_request_from to the service_requests_source - Also rename enum class ServiceRequestFrom to the ServiceRequestsSource Signed-off-by: Michael Orlov <michael.orlov@apex.ai> * Add Player::wait_for_sent_service_requests_to_finish() API - We need this API to be able to write deterministic and non-flaky tests Signed-off-by: Michael Orlov <michael.orlov@apex.ai> * Mitigate potential issues related to the operations reordering on ARM Signed-off-by: Michael Orlov <michael.orlov@apex.ai> * Make tests play_service_requests_from_service(client) deterministic - Get rid of timeout inside tests and use newly added player->wait_for_sent_service_requests_to_finish(service_name) API. Signed-off-by: Michael Orlov <michael.orlov@apex.ai> * Misc findings and improvements 1 Signed-off-by: Michael Orlov <michael.orlov@apex.ai> * Rename get_services_clients() to the get_service_clients() Signed-off-by: Michael Orlov <michael.orlov@apex.ai> * Add a new CLI parameter "--publish-service-requests" for Player Also added a new option publish_service_requests to the PlayOptions. Note: By default rosbag2 player will publish service events only. Signed-off-by: Barry Xu <barry.xu@sony.com> Signed-off-by: Michael Orlov <michael.orlov@apex.ai> * Fix an issue on filtering topic when prepare publishers Co-authored-by: Barry Xu <barry.xu@sony.com> Signed-off-by: Michael Orlov <michael.orlov@apex.ai> * Cleanup in play_without_publish_service_requests - Long story short: Make it deterministic and run fast. Signed-off-by: Michael Orlov <michael.orlov@apex.ai> * Wrap code which can throw with try-catch in the publish_message(..) Signed-off-by: Michael Orlov <michael.orlov@apex.ai> * Delete some part of the code which became absolute and shall not be used Signed-off-by: Michael Orlov <michael.orlov@apex.ai> * Update test codes Signed-off-by: Barry Xu <barry.xu@sony.com> * Remove code on meaningless waiting for published_messages_from_multiple_services_are_recorded Signed-off-by: Barry Xu <barry.xu@sony.com> * Update the code following the rebase Signed-off-by: Barry Xu <barry.xu@sony.com> * Remove a unnecessary check and simplify the code Signed-off-by: Barry Xu <barry.xu@sony.com> * Cleanup in service replay related tests Signed-off-by: Michael Orlov <michael.orlov@apex.ai> * Regenerate Python stub files (.pyi) after altering python API in PR Signed-off-by: Michael Orlov <michael.orlov@apex.ai> * Increase the timeout of waiting for the service to be ready Signed-off-by: Barry Xu <barry.xu@sony.com> * Update the code for waiting on all futures of one service client Signed-off-by: Barry Xu <barry.xu@sony.com> * Cleanup API for wait_for_sent_requests_to_finish(..) Signed-off-by: Michael Orlov <michael.orlov@apex.ai> * Fixes for Windows CI build failure - Add storage factory object as member variable to the test fixture class. The storage factory object shall persist while returned storage object persist. Signed-off-by: Michael Orlov <michael.orlov@apex.ai> * Fix a typo Signed-off-by: Barry Xu <barry.xu@sony.com> * Increase timeout value to stabilize a test Signed-off-by: Barry Xu <barry.xu@sony.com> * Fix a bug in PlayerImpl::wait_for_sent_service_requests_to_finish Signed-off-by: Barry Xu <barry.xu@sony.com> * Disable test_burst for RTI DDS due to the failure with missing requests - The test `burst_bursting_only_filtered_services` fails only with rmw_connext_dds for unknown reasons and tends to be flaky. Sometimes we receive only one service request instead of 2. Signed-off-by: Michael Orlov <michael.orlov@apex.ai> * Revert "Disable test_burst for RTI DDS due to the failure with missing requests" This reverts commit aaaac74. Signed-off-by: Michael Orlov <michael.orlov@apex.ai> * Disable burst_bursting_only_filtered_services for rmw_connextdds - The test `burst_bursting_only_filtered_services` fails only with rmw_connext_dds for unknown reasons and tends to be flaky. Sometimes we receive only one service request instead of 2. Signed-off-by: Michael Orlov <michael.orlov@apex.ai> --------- Signed-off-by: Barry Xu <barry.xu@sony.com> Signed-off-by: Michael Orlov <michael.orlov@apex.ai> Co-authored-by: Michael Orlov <michael.orlov@apex.ai>
- Loading branch information