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 <[email protected]> * Maintain the future queue of the request by timeout Signed-off-by: Barry Xu <[email protected]> * Use get_message_typesupport_handle() instead of deprecated get_typesupport_handle() Signed-off-by: Barry Xu <[email protected]> * Resolve the conflicts caused by the rebase Signed-off-by: Barry Xu <[email protected]> * Address review comments from Fujita-san Signed-off-by: Barry Xu <[email protected]> * Move codes to new function remove_complete_request_future Signed-off-by: Barry Xu <[email protected]> * Move codes to new function remove_all_timeout_request_future() Signed-off-by: Barry Xu <[email protected]> * Add warning log and lock protection Signed-off-by: Barry Xu <[email protected]> * Optimize code in PlayerImpl::publish_message() Signed-off-by: Barry Xu <[email protected]> * Changed the code logic for determining whether to use request data of client or service Signed-off-by: Barry Xu <[email protected]> * Add warning log and tests Signed-off-by: Barry Xu <[email protected]> * Correct the parameter descriptions and remove unnecessary code Signed-off-by: Barry Xu <[email protected]> * Extend the parameters for the "play" command Add new parameters '--exclude-topics' and '--exclude-services'. Signed-off-by: Barry Xu <[email protected]> * Move implmentation of struct client_id_hash to cpp Signed-off-by: Barry Xu <[email protected]> * Address some minor review comments Signed-off-by: Barry Xu <[email protected]> * Replace std::variant<SharedPlayerPublisher, SharedPlayerClient>> Signed-off-by: Barry Xu <[email protected]> * Added code for cleaning up pending requests Signed-off-by: Barry Xu <[email protected]> * Avoid creating publisher or client for filtered topic Signed-off-by: Barry Xu <[email protected]> * Update code on filtering message for mcap Signed-off-by: Barry Xu <[email protected]> * Use explicit namespace for topic name and update tests Signed-off-by: Barry Xu <[email protected]> * Update for the rebase Signed-off-by: Barry Xu <[email protected]> * Simplify variable names Signed-off-by: Barry Xu <[email protected]> * Adjust the default timeout and queue length for request future Signed-off-by: Barry Xu <[email protected]> * 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 <[email protected]> * Move mcap topic_filter tests to a separate file Signed-off-by: Michael Orlov <[email protected]> * Add TestResetFilter and CanSelectWithTopicsListOnly to the mcap storage Signed-off-by: Michael Orlov <[email protected]> * Add CanSelectWithServiceEventsListOnly test to the mcap storage Signed-off-by: Michael Orlov <[email protected]> * Cleanups and renames in the sqlite_storage.cpp Signed-off-by: Michael Orlov <[email protected]> * Move SQLite3 topic_filter tests to a separate file Signed-off-by: Michael Orlov <[email protected]> * 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 <[email protected]> * Rename test_sqlite3_topic_filter.cpp for consistency Signed-off-by: Michael Orlov <[email protected]> * 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 <[email protected]> * 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 <[email protected]> * Address ament_flake8 warning in regards whitespaces in the blank lines Signed-off-by: Michael Orlov <[email protected]> * Simplify logic in is_topic_selected_by_white_list_or_regex(..) Signed-off-by: Michael Orlov <[email protected]> Co-authored with: Barry Xu <[email protected]> Co-authored-by: Barry Xu <[email protected]> * Check is_topic_in_black_list_or_exclude_regex(..) first Co-authored-by: Barry Xu <[email protected]> Signed-off-by: Michael Orlov <[email protected]> * Add test coverage for the cases when exclude lists overlap with include Signed-off-by: Michael Orlov <[email protected]> * 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 <[email protected]> * Rename test_sqlite3_topic_filter in CMakeList.txt Signed-off-by: Michael Orlov <[email protected]> * Update spin & termination and add service ready check before play Signed-off-by: Barry Xu <[email protected]> * 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 <[email protected]> * 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 <[email protected]> * 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 <[email protected]> * 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 <[email protected]> * Specify service request from which introspection message and fix uncrustify errors Signed-off-by: Barry Xu <[email protected]> * 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 <[email protected]> * Rename service_request_from to the service_requests_source - Also rename enum class ServiceRequestFrom to the ServiceRequestsSource Signed-off-by: Michael Orlov <[email protected]> * 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 <[email protected]> * Mitigate potential issues related to the operations reordering on ARM Signed-off-by: Michael Orlov <[email protected]> * 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 <[email protected]> * Misc findings and improvements 1 Signed-off-by: Michael Orlov <[email protected]> * Rename get_services_clients() to the get_service_clients() Signed-off-by: Michael Orlov <[email protected]> * 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 <[email protected]> Signed-off-by: Michael Orlov <[email protected]> * Fix an issue on filtering topic when prepare publishers Co-authored-by: Barry Xu <[email protected]> Signed-off-by: Michael Orlov <[email protected]> * Cleanup in play_without_publish_service_requests - Long story short: Make it deterministic and run fast. Signed-off-by: Michael Orlov <[email protected]> * Wrap code which can throw with try-catch in the publish_message(..) Signed-off-by: Michael Orlov <[email protected]> * Delete some part of the code which became absolute and shall not be used Signed-off-by: Michael Orlov <[email protected]> * Update test codes Signed-off-by: Barry Xu <[email protected]> * Remove code on meaningless waiting for published_messages_from_multiple_services_are_recorded Signed-off-by: Barry Xu <[email protected]> * Update the code following the rebase Signed-off-by: Barry Xu <[email protected]> * Remove a unnecessary check and simplify the code Signed-off-by: Barry Xu <[email protected]> * Cleanup in service replay related tests Signed-off-by: Michael Orlov <[email protected]> * Regenerate Python stub files (.pyi) after altering python API in PR Signed-off-by: Michael Orlov <[email protected]> * Increase the timeout of waiting for the service to be ready Signed-off-by: Barry Xu <[email protected]> * Update the code for waiting on all futures of one service client Signed-off-by: Barry Xu <[email protected]> * Cleanup API for wait_for_sent_requests_to_finish(..) Signed-off-by: Michael Orlov <[email protected]> * 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 <[email protected]> * Fix a typo Signed-off-by: Barry Xu <[email protected]> * Increase timeout value to stabilize a test Signed-off-by: Barry Xu <[email protected]> * Fix a bug in PlayerImpl::wait_for_sent_service_requests_to_finish Signed-off-by: Barry Xu <[email protected]> * 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 <[email protected]> * Revert "Disable test_burst for RTI DDS due to the failure with missing requests" This reverts commit aaaac74. Signed-off-by: Michael Orlov <[email protected]> * 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 <[email protected]> --------- Signed-off-by: Barry Xu <[email protected]> Signed-off-by: Michael Orlov <[email protected]> Co-authored-by: Michael Orlov <[email protected]>
- Loading branch information