├── ros2bag ├── resource │ └── ros2bag ├── ros2bag │ ├── __init__.py │ ├── command │ │ ├── __init__.py │ │ └── bag.py │ └── verb │ │ ├── __init__.py │ │ ├── convert.py │ │ └── reindex.py ├── .gitignore ├── test │ ├── resources │ │ ├── empty_bag │ │ │ ├── empty_bag_0.db3-wal │ │ │ ├── empty_bag_0.db3 │ │ │ ├── empty_bag_0.db3-shm │ │ │ └── metadata.yaml │ │ ├── incomplete_qos_profile.yaml │ │ ├── incomplete_qos_duration.yaml │ │ └── qos_profile.yaml │ ├── test_xmllint.py │ ├── test_copyright.py │ ├── test_pep257.py │ └── test_flake8.py ├── pytest.ini ├── package.xml └── setup.py ├── rosbag2_interfaces ├── srv │ ├── Pause.srv │ ├── Resume.srv │ ├── Stop.srv │ ├── SplitBagfile.srv │ ├── TogglePaused.srv │ ├── GetRate.srv │ ├── IsPaused.srv │ ├── Snapshot.srv │ ├── PlayNext.srv │ ├── SetRate.srv │ ├── Seek.srv │ ├── Burst.srv │ └── Play.srv ├── msg │ ├── ReadSplitEvent.msg │ ├── MessagesLostEvent.msg │ ├── WriteSplitEvent.msg │ └── MessagesLostEventTopicStat.msg ├── CMakeLists.txt └── package.xml ├── rosbag2_tests ├── resources │ ├── empty_dir │ │ └── .gitkeep │ ├── mcap │ │ ├── cdr_test │ │ │ ├── cdr_test_0.mcap │ │ │ └── metadata.yaml │ │ ├── wrong_rmw_test │ │ │ ├── wrong_rmw_test_0.mcap │ │ │ └── metadata.yaml │ │ └── bag_with_topics_and_service_events_and_action │ │ │ └── bag_with_topics_and_service_events_and_action.mcap │ └── sqlite3 │ │ ├── cdr_test │ │ ├── cdr_test_0.db3 │ │ └── metadata.yaml │ │ ├── wrong_rmw_test │ │ ├── wrong_rmw_test_0.db3 │ │ └── metadata.yaml │ │ └── bag_with_topics_and_service_events_and_action │ │ └── bag_with_topics_and_service_events_and_action.db3 ├── cmake │ └── skip_ros1_tests_if_necessary.cmake └── package.xml ├── rosbag2_test_msgdefs ├── msg │ ├── BasicMsg.msg │ ├── nested_sub_dir │ │ └── AnotherBasicMsg.msg │ ├── ComplexMsg.msg │ ├── ComplexMsgDependsOnIdl.msg │ ├── BasicIdl.idl │ └── ComplexIdl.idl ├── srv │ ├── BasicSrv.srv │ ├── ComplexSrvIdl.srv │ └── ComplexSrvMsg.srv ├── action │ ├── BasicAction.action │ ├── ComplexActionIdl.action │ └── ComplexActionMsg.action ├── nested_sub_dir │ └── action │ │ └── BasicMsg.action ├── CMakeLists.txt └── package.xml ├── rosbag2_py ├── pytest.ini ├── rosbag2_py │ ├── py.typed │ ├── _reindexer.pyi │ ├── _message_definitions.pyi │ ├── _info.pyi │ ├── _compression_options.pyi │ ├── _reader.pyi │ └── _writer.pyi ├── test │ ├── resources │ │ ├── mcap │ │ │ ├── wbag │ │ │ │ ├── wbag_0.mcap │ │ │ │ ├── wbag_1.mcap │ │ │ │ ├── wbag_2.mcap │ │ │ │ ├── wbag_3.mcap │ │ │ │ └── wbag_4.mcap │ │ │ ├── talker │ │ │ │ ├── talker.mcap │ │ │ │ └── metadata.yaml │ │ │ ├── convert_a │ │ │ │ └── rewriter_a_0.mcap │ │ │ ├── convert_b │ │ │ │ ├── rewriter_b_0.mcap │ │ │ │ └── metadata.yaml │ │ │ └── reindex_test_bags │ │ │ │ └── multiple_files │ │ │ │ ├── multiple_files_0.mcap │ │ │ │ ├── multiple_files_1.mcap │ │ │ │ └── multiple_files_2.mcap │ │ └── sqlite3 │ │ │ ├── wbag │ │ │ ├── wbag_0.db3 │ │ │ ├── wbag_1.db3 │ │ │ ├── wbag_2.db3 │ │ │ ├── wbag_3.db3 │ │ │ └── wbag_4.db3 │ │ │ ├── talker │ │ │ ├── talker.db3 │ │ │ └── metadata.yaml │ │ │ ├── convert_a │ │ │ └── rewriter_a_0.db3 │ │ │ ├── convert_b │ │ │ ├── rewriter_b_0.db3 │ │ │ └── metadata.yaml │ │ │ └── reindex_test_bags │ │ │ └── multiple_files │ │ │ ├── multiple_files_0.db3 │ │ │ ├── multiple_files_1.db3 │ │ │ └── multiple_files_2.db3 │ └── test_reindexer.py ├── README.md └── src │ └── rosbag2_py │ ├── format_utils.hpp │ ├── service_event_info.hpp │ ├── pybind11.hpp │ ├── format_bag_metadata.hpp │ ├── action_info.hpp │ ├── format_action_info.hpp │ ├── format_service_info.hpp │ ├── format_utils.cpp │ └── _message_definitions.cpp ├── rosbag2_examples ├── rosbag2_examples_py │ ├── resource │ │ └── rosbag2_examples_py │ ├── rosbag2_examples_py │ │ └── __init__.py │ ├── setup.cfg │ ├── test │ │ ├── test_xmllint.py │ │ ├── test_copyright.py │ │ ├── test_pep257.py │ │ └── test_flake8.py │ ├── package.xml │ └── setup.py └── rosbag2_examples_cpp │ ├── package.xml │ └── src │ ├── compressed_bag_rewriter.cpp │ └── data_generator_executable.cpp ├── rosbag2_transport ├── test │ ├── srv │ │ └── SimpleTest.srv │ ├── resources │ │ ├── mcap │ │ │ ├── rewriter_a │ │ │ │ └── rewriter_a_0.mcap │ │ │ ├── rewriter_b │ │ │ │ ├── rewriter_b_0.mcap │ │ │ │ └── metadata.yaml │ │ │ └── test_bag_for_seek │ │ │ │ ├── test_bag_for_seek_0.mcap │ │ │ │ └── metadata.yaml │ │ ├── sqlite3 │ │ │ ├── rewriter_a │ │ │ │ └── rewriter_a_0.db3 │ │ │ ├── rewriter_b │ │ │ │ ├── rewriter_b_0.db3 │ │ │ │ └── metadata.yaml │ │ │ └── test_bag_for_seek │ │ │ │ ├── test_bag_for_seek_0.db3 │ │ │ │ └── metadata.yaml │ │ └── qos_profile_overrides.yaml │ └── rosbag2_transport │ │ └── rosbag2_play_test_fixture.hpp └── include │ └── rosbag2_transport │ ├── config_options_from_node_params.hpp │ └── reader_writer_factory.hpp ├── rosbag2_storage_mcap ├── CPPLINT.cfg ├── setup.cfg ├── test │ └── rosbag2_storage_mcap │ │ └── mcap_writer_options_zstd.yaml ├── plugin_description.xml ├── .clang-format ├── ros2bag_mcap_cli │ └── __init__.py └── package.xml ├── docs └── design │ ├── time_control_timelines.png │ ├── time_control_final_equations.png │ └── time_control_intermediate_equations.png ├── rosbag2_performance ├── rosbag2_performance_benchmarking_msgs │ ├── msg │ │ └── ByteArray.msg │ ├── CMakeLists.txt │ └── package.xml └── rosbag2_performance_benchmarking │ ├── config │ ├── storage │ │ ├── storage_resilient.yaml │ │ └── storage_optimized.yaml │ ├── producers │ │ ├── 100MBs_raw.yaml │ │ ├── 200MBs_raw.yaml │ │ ├── 300MBs_raw.yaml │ │ ├── mixed_110Mbs.yaml │ │ └── mixed_110Mbs_low_pubs_count.yaml │ └── benchmarks │ │ ├── test │ │ ├── test_no_transport.yaml │ │ └── test_benchmark_producers.yaml │ │ ├── default_no_transport.yaml │ │ └── default_benchmark_producers.yaml │ ├── docs │ └── rosbag2_performance_improvements.pdf │ ├── include │ ├── rosbag2_performance_benchmarking │ │ ├── producer_config.hpp │ │ ├── bag_config.hpp │ │ └── publisher_group_config.hpp │ └── msg_utils │ │ └── helpers.hpp │ ├── src │ └── results_writer.cpp │ └── package.xml ├── rosbag2_storage_sqlite3 ├── setup.cfg ├── plugin_description.xml ├── ros2bag_sqlite3_cli │ └── __init__.py ├── README.md └── package.xml ├── .gitignore ├── rosbag2 ├── CMakeLists.txt └── package.xml ├── rosbag2_cpp ├── test │ └── rosbag2_cpp │ │ ├── bags │ │ ├── only_topics.mcap │ │ ├── only_services.mcap │ │ ├── topics_and_services.db3 │ │ └── topics_and_services.mcap │ │ ├── converter_test_plugin.xml │ │ ├── fake_data.hpp │ │ ├── serializer_test_plugin.cpp │ │ ├── mock_cache_consumer.hpp │ │ ├── serializer_test_plugin.hpp │ │ ├── mock_metadata_io.hpp │ │ ├── mock_converter_factory.hpp │ │ ├── mock_storage_factory.hpp │ │ ├── mock_converter.hpp │ │ ├── converter_test_plugin.hpp │ │ └── converter_test_plugin.cpp ├── include │ └── rosbag2_cpp │ │ ├── types.hpp │ │ ├── converter_options.hpp │ │ ├── plugins │ │ └── plugin_utils.hpp │ │ └── serialization_format_converter_factory_interface.hpp └── package.xml ├── NOTICE ├── rosbag2_storage_default_plugins ├── CMakeLists.txt └── package.xml ├── mcap_vendor ├── patches │ └── 0001-fix-gcc15.patch ├── src │ └── main.cpp ├── package.xml └── README.md ├── rosbag2_compression ├── test │ └── rosbag2_compression │ │ ├── fake_plugin.xml │ │ ├── mock_metadata_io.hpp │ │ ├── fake_decompressor.cpp │ │ ├── mock_compression_factory.hpp │ │ ├── fake_decompressor.hpp │ │ ├── fake_compressor.hpp │ │ ├── mock_converter_factory.hpp │ │ ├── mock_storage_factory.hpp │ │ ├── mock_converter.hpp │ │ ├── fake_compression_factory.hpp │ │ └── fake_compressor.cpp ├── package.xml └── src │ └── rosbag2_compression │ └── compression_factory.cpp ├── rosbag2_storage ├── test │ └── rosbag2_storage │ │ ├── test_plugin.xml │ │ ├── test_constants.hpp │ │ └── test_ros_helper.cpp ├── src │ └── rosbag2_storage │ │ ├── default_storage_id.cpp │ │ └── base_io_interface.cpp ├── include │ └── rosbag2_storage │ │ ├── default_storage_id.hpp │ │ ├── ros_helper.hpp │ │ ├── storage_factory_interface.hpp │ │ ├── topic_metadata.hpp │ │ └── storage_traits.hpp └── package.xml ├── rosbag2_compression_zstd ├── plugin_description.xml └── package.xml ├── lz4_cmake_module ├── CMakeLists.txt ├── lz4_cmake_module-extras.cmake └── package.xml ├── zstd_cmake_module ├── CMakeLists.txt ├── zstd_cmake_module-extras.cmake └── package.xml ├── rosbag2_test_common ├── rosbag2_test_common │ └── __init__.py ├── include │ └── rosbag2_test_common │ │ ├── process_execution_helpers.hpp │ │ └── tested_storage_ids.hpp └── package.xml ├── DEVELOPING.md ├── CONTRIBUTING.md └── .github └── ISSUE_TEMPLATE ├── bug_report.md └── feature_request.md /ros2bag/resource/ros2bag: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /ros2bag/ros2bag/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /ros2bag/.gitignore: -------------------------------------------------------------------------------- 1 | *__pycache__* 2 | -------------------------------------------------------------------------------- /ros2bag/ros2bag/command/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /rosbag2_interfaces/srv/Pause.srv: -------------------------------------------------------------------------------- 1 | --- 2 | -------------------------------------------------------------------------------- /rosbag2_interfaces/srv/Resume.srv: -------------------------------------------------------------------------------- 1 | --- 2 | -------------------------------------------------------------------------------- /rosbag2_interfaces/srv/Stop.srv: -------------------------------------------------------------------------------- 1 | --- 2 | -------------------------------------------------------------------------------- /rosbag2_tests/resources/empty_dir/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /rosbag2_interfaces/srv/SplitBagfile.srv: -------------------------------------------------------------------------------- 1 | --- 2 | -------------------------------------------------------------------------------- /rosbag2_interfaces/srv/TogglePaused.srv: -------------------------------------------------------------------------------- 1 | --- 2 | -------------------------------------------------------------------------------- /ros2bag/test/resources/empty_bag/empty_bag_0.db3-wal: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /rosbag2_test_msgdefs/msg/BasicMsg.msg: -------------------------------------------------------------------------------- 1 | float32 c 2 | -------------------------------------------------------------------------------- /rosbag2_py/pytest.ini: -------------------------------------------------------------------------------- 1 | [pytest] 2 | junit_family=xunit2 3 | -------------------------------------------------------------------------------- /rosbag2_interfaces/srv/GetRate.srv: -------------------------------------------------------------------------------- 1 | --- 2 | float64 rate 3 | -------------------------------------------------------------------------------- /rosbag2_interfaces/srv/IsPaused.srv: -------------------------------------------------------------------------------- 1 | --- 2 | bool paused 3 | -------------------------------------------------------------------------------- /rosbag2_interfaces/srv/Snapshot.srv: -------------------------------------------------------------------------------- 1 | --- 2 | bool success 3 | -------------------------------------------------------------------------------- /rosbag2_examples/rosbag2_examples_py/resource/rosbag2_examples_py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /rosbag2_examples/rosbag2_examples_py/rosbag2_examples_py/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /rosbag2_test_msgdefs/msg/nested_sub_dir/AnotherBasicMsg.msg: -------------------------------------------------------------------------------- 1 | float32 c 2 | -------------------------------------------------------------------------------- /rosbag2_test_msgdefs/msg/ComplexMsg.msg: -------------------------------------------------------------------------------- 1 | rosbag2_test_msgdefs/BasicMsg b 2 | -------------------------------------------------------------------------------- /rosbag2_test_msgdefs/srv/BasicSrv.srv: -------------------------------------------------------------------------------- 1 | string req 2 | --- 3 | string resp 4 | -------------------------------------------------------------------------------- /rosbag2_transport/test/srv/SimpleTest.srv: -------------------------------------------------------------------------------- 1 | int64 input 2 | --- 3 | int64 output -------------------------------------------------------------------------------- /rosbag2_test_msgdefs/msg/ComplexMsgDependsOnIdl.msg: -------------------------------------------------------------------------------- 1 | rosbag2_test_msgdefs/BasicIdl a 2 | -------------------------------------------------------------------------------- /rosbag2_interfaces/srv/PlayNext.srv: -------------------------------------------------------------------------------- 1 | --- 2 | bool success # can only play-next while playback is paused 3 | -------------------------------------------------------------------------------- /rosbag2_py/rosbag2_py/py.typed: -------------------------------------------------------------------------------- 1 | See https://peps.python.org/pep-0561/ for details about py.typed files. 2 | -------------------------------------------------------------------------------- /rosbag2_interfaces/srv/SetRate.srv: -------------------------------------------------------------------------------- 1 | float64 rate 2 | --- 3 | bool success # true if valid rate (> 0) was set 4 | -------------------------------------------------------------------------------- /rosbag2_storage_mcap/CPPLINT.cfg: -------------------------------------------------------------------------------- 1 | # We manage include order with clang-format 2 | filter=-build/include_order 3 | -------------------------------------------------------------------------------- /rosbag2_test_msgdefs/action/BasicAction.action: -------------------------------------------------------------------------------- 1 | string goal 2 | --- 3 | string result 4 | --- 5 | string feedback 6 | -------------------------------------------------------------------------------- /docs/design/time_control_timelines.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ros2/rosbag2/HEAD/docs/design/time_control_timelines.png -------------------------------------------------------------------------------- /rosbag2_performance/rosbag2_performance_benchmarking_msgs/msg/ByteArray.msg: -------------------------------------------------------------------------------- 1 | byte[] data # array of data 2 | -------------------------------------------------------------------------------- /rosbag2_test_msgdefs/nested_sub_dir/action/BasicMsg.action: -------------------------------------------------------------------------------- 1 | string goal 2 | --- 3 | string result 4 | --- 5 | string feedback 6 | -------------------------------------------------------------------------------- /rosbag2_test_msgdefs/srv/ComplexSrvIdl.srv: -------------------------------------------------------------------------------- 1 | rosbag2_test_msgdefs/BasicIdl req 2 | --- 3 | rosbag2_test_msgdefs/BasicIdl resp 4 | -------------------------------------------------------------------------------- /rosbag2_test_msgdefs/srv/ComplexSrvMsg.srv: -------------------------------------------------------------------------------- 1 | rosbag2_test_msgdefs/BasicMsg req 2 | --- 3 | rosbag2_test_msgdefs/BasicMsg resp 4 | -------------------------------------------------------------------------------- /rosbag2_storage_mcap/setup.cfg: -------------------------------------------------------------------------------- 1 | [options.entry_points] 2 | ros2bag.storage_plugin_cli_extension = 3 | mcap = ros2bag_mcap_cli 4 | -------------------------------------------------------------------------------- /docs/design/time_control_final_equations.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ros2/rosbag2/HEAD/docs/design/time_control_final_equations.png -------------------------------------------------------------------------------- /rosbag2_py/test/resources/mcap/wbag/wbag_0.mcap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ros2/rosbag2/HEAD/rosbag2_py/test/resources/mcap/wbag/wbag_0.mcap -------------------------------------------------------------------------------- /rosbag2_py/test/resources/mcap/wbag/wbag_1.mcap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ros2/rosbag2/HEAD/rosbag2_py/test/resources/mcap/wbag/wbag_1.mcap -------------------------------------------------------------------------------- /rosbag2_py/test/resources/mcap/wbag/wbag_2.mcap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ros2/rosbag2/HEAD/rosbag2_py/test/resources/mcap/wbag/wbag_2.mcap -------------------------------------------------------------------------------- /rosbag2_py/test/resources/mcap/wbag/wbag_3.mcap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ros2/rosbag2/HEAD/rosbag2_py/test/resources/mcap/wbag/wbag_3.mcap -------------------------------------------------------------------------------- /rosbag2_py/test/resources/mcap/wbag/wbag_4.mcap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ros2/rosbag2/HEAD/rosbag2_py/test/resources/mcap/wbag/wbag_4.mcap -------------------------------------------------------------------------------- /rosbag2_storage_sqlite3/setup.cfg: -------------------------------------------------------------------------------- 1 | [options.entry_points] 2 | ros2bag.storage_plugin_cli_extension = 3 | sqlite3 = ros2bag_sqlite3_cli 4 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .idea/ 2 | .ipynb_checkpoints/ 3 | cmake-build-*/ 4 | build/ 5 | venv/ 6 | **/.pytest_cache/ 7 | __pycache__/ 8 | *.db3-* 9 | **/.vscode/ -------------------------------------------------------------------------------- /ros2bag/test/resources/empty_bag/empty_bag_0.db3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ros2/rosbag2/HEAD/ros2bag/test/resources/empty_bag/empty_bag_0.db3 -------------------------------------------------------------------------------- /rosbag2/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.20) 2 | project(rosbag2) 3 | 4 | find_package(ament_cmake REQUIRED) 5 | ament_package() 6 | -------------------------------------------------------------------------------- /rosbag2_cpp/test/rosbag2_cpp/bags/only_topics.mcap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ros2/rosbag2/HEAD/rosbag2_cpp/test/rosbag2_cpp/bags/only_topics.mcap -------------------------------------------------------------------------------- /rosbag2_py/test/resources/mcap/talker/talker.mcap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ros2/rosbag2/HEAD/rosbag2_py/test/resources/mcap/talker/talker.mcap -------------------------------------------------------------------------------- /rosbag2_py/test/resources/sqlite3/wbag/wbag_0.db3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ros2/rosbag2/HEAD/rosbag2_py/test/resources/sqlite3/wbag/wbag_0.db3 -------------------------------------------------------------------------------- /rosbag2_py/test/resources/sqlite3/wbag/wbag_1.db3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ros2/rosbag2/HEAD/rosbag2_py/test/resources/sqlite3/wbag/wbag_1.db3 -------------------------------------------------------------------------------- /rosbag2_py/test/resources/sqlite3/wbag/wbag_2.db3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ros2/rosbag2/HEAD/rosbag2_py/test/resources/sqlite3/wbag/wbag_2.db3 -------------------------------------------------------------------------------- /rosbag2_py/test/resources/sqlite3/wbag/wbag_3.db3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ros2/rosbag2/HEAD/rosbag2_py/test/resources/sqlite3/wbag/wbag_3.db3 -------------------------------------------------------------------------------- /rosbag2_py/test/resources/sqlite3/wbag/wbag_4.db3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ros2/rosbag2/HEAD/rosbag2_py/test/resources/sqlite3/wbag/wbag_4.db3 -------------------------------------------------------------------------------- /docs/design/time_control_intermediate_equations.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ros2/rosbag2/HEAD/docs/design/time_control_intermediate_equations.png -------------------------------------------------------------------------------- /ros2bag/test/resources/empty_bag/empty_bag_0.db3-shm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ros2/rosbag2/HEAD/ros2bag/test/resources/empty_bag/empty_bag_0.db3-shm -------------------------------------------------------------------------------- /rosbag2_cpp/test/rosbag2_cpp/bags/only_services.mcap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ros2/rosbag2/HEAD/rosbag2_cpp/test/rosbag2_cpp/bags/only_services.mcap -------------------------------------------------------------------------------- /rosbag2_py/test/resources/sqlite3/talker/talker.db3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ros2/rosbag2/HEAD/rosbag2_py/test/resources/sqlite3/talker/talker.db3 -------------------------------------------------------------------------------- /rosbag2_interfaces/srv/Seek.srv: -------------------------------------------------------------------------------- 1 | builtin_interfaces/Time time 2 | --- 3 | bool success # return true if valid time in bag duration, and successful seek 4 | -------------------------------------------------------------------------------- /rosbag2_tests/resources/mcap/cdr_test/cdr_test_0.mcap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ros2/rosbag2/HEAD/rosbag2_tests/resources/mcap/cdr_test/cdr_test_0.mcap -------------------------------------------------------------------------------- /rosbag2_tests/resources/sqlite3/cdr_test/cdr_test_0.db3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ros2/rosbag2/HEAD/rosbag2_tests/resources/sqlite3/cdr_test/cdr_test_0.db3 -------------------------------------------------------------------------------- /ros2bag/test/resources/incomplete_qos_profile.yaml: -------------------------------------------------------------------------------- 1 | /test_topic: 2 | history: keep_all 3 | depth: 0 4 | reliability: reliable 5 | durability: volatile 6 | -------------------------------------------------------------------------------- /rosbag2_cpp/test/rosbag2_cpp/bags/topics_and_services.db3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ros2/rosbag2/HEAD/rosbag2_cpp/test/rosbag2_cpp/bags/topics_and_services.db3 -------------------------------------------------------------------------------- /rosbag2_performance/rosbag2_performance_benchmarking/config/storage/storage_resilient.yaml: -------------------------------------------------------------------------------- 1 | write: 2 | pragmas: ["journal_mode = WAL", "synchronous = NORMAL"] 3 | -------------------------------------------------------------------------------- /NOTICE: -------------------------------------------------------------------------------- 1 | rosbag2 2 | 3 | Copyright Holders: 4 | Copyright (c) 2018, Open Source Robotics Foundation, Inc. 5 | Copyright (c) 2018, Bosch Software Innovations GmbH 6 | -------------------------------------------------------------------------------- /rosbag2_cpp/test/rosbag2_cpp/bags/topics_and_services.mcap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ros2/rosbag2/HEAD/rosbag2_cpp/test/rosbag2_cpp/bags/topics_and_services.mcap -------------------------------------------------------------------------------- /rosbag2_py/test/resources/mcap/convert_a/rewriter_a_0.mcap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ros2/rosbag2/HEAD/rosbag2_py/test/resources/mcap/convert_a/rewriter_a_0.mcap -------------------------------------------------------------------------------- /rosbag2_py/test/resources/mcap/convert_b/rewriter_b_0.mcap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ros2/rosbag2/HEAD/rosbag2_py/test/resources/mcap/convert_b/rewriter_b_0.mcap -------------------------------------------------------------------------------- /rosbag2_py/test/resources/sqlite3/convert_a/rewriter_a_0.db3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ros2/rosbag2/HEAD/rosbag2_py/test/resources/sqlite3/convert_a/rewriter_a_0.db3 -------------------------------------------------------------------------------- /rosbag2_py/test/resources/sqlite3/convert_b/rewriter_b_0.db3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ros2/rosbag2/HEAD/rosbag2_py/test/resources/sqlite3/convert_b/rewriter_b_0.db3 -------------------------------------------------------------------------------- /rosbag2_test_msgdefs/msg/BasicIdl.idl: -------------------------------------------------------------------------------- 1 | module rosbag2_test_msgdefs { 2 | module msg { 3 | struct BasicIdl { 4 | float x; 5 | }; 6 | }; 7 | }; 8 | -------------------------------------------------------------------------------- /rosbag2_examples/rosbag2_examples_py/setup.cfg: -------------------------------------------------------------------------------- 1 | [develop] 2 | script_dir=$base/lib/rosbag2_examples_py 3 | [install] 4 | install_scripts=$base/lib/rosbag2_examples_py 5 | -------------------------------------------------------------------------------- /rosbag2_tests/resources/mcap/wrong_rmw_test/wrong_rmw_test_0.mcap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ros2/rosbag2/HEAD/rosbag2_tests/resources/mcap/wrong_rmw_test/wrong_rmw_test_0.mcap -------------------------------------------------------------------------------- /rosbag2_tests/resources/sqlite3/wrong_rmw_test/wrong_rmw_test_0.db3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ros2/rosbag2/HEAD/rosbag2_tests/resources/sqlite3/wrong_rmw_test/wrong_rmw_test_0.db3 -------------------------------------------------------------------------------- /rosbag2_transport/test/resources/mcap/rewriter_a/rewriter_a_0.mcap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ros2/rosbag2/HEAD/rosbag2_transport/test/resources/mcap/rewriter_a/rewriter_a_0.mcap -------------------------------------------------------------------------------- /rosbag2_transport/test/resources/mcap/rewriter_b/rewriter_b_0.mcap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ros2/rosbag2/HEAD/rosbag2_transport/test/resources/mcap/rewriter_b/rewriter_b_0.mcap -------------------------------------------------------------------------------- /ros2bag/pytest.ini: -------------------------------------------------------------------------------- 1 | [pytest] 2 | junit_family=xunit2 3 | # flake8 in Ubuntu 22.04 prints this warning; we ignore it for now 4 | filterwarnings=ignore:SelectableGroups:DeprecationWarning 5 | -------------------------------------------------------------------------------- /rosbag2_interfaces/srv/Burst.srv: -------------------------------------------------------------------------------- 1 | uint64 num_messages # Number of messages to burst; zero to burst the whole bag 2 | --- 3 | uint64 actually_burst # Number of messages actually burst 4 | -------------------------------------------------------------------------------- /rosbag2_transport/test/resources/sqlite3/rewriter_a/rewriter_a_0.db3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ros2/rosbag2/HEAD/rosbag2_transport/test/resources/sqlite3/rewriter_a/rewriter_a_0.db3 -------------------------------------------------------------------------------- /rosbag2_transport/test/resources/sqlite3/rewriter_b/rewriter_b_0.db3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ros2/rosbag2/HEAD/rosbag2_transport/test/resources/sqlite3/rewriter_b/rewriter_b_0.db3 -------------------------------------------------------------------------------- /ros2bag/test/resources/incomplete_qos_duration.yaml: -------------------------------------------------------------------------------- 1 | /test_topic: 2 | history: keep_all 3 | depth: 0 4 | reliability: reliable 5 | durability: volatile 6 | deadline: 7 | sec: 2 8 | -------------------------------------------------------------------------------- /rosbag2_test_msgdefs/action/ComplexActionIdl.action: -------------------------------------------------------------------------------- 1 | rosbag2_test_msgdefs/BasicIdl goal 2 | --- 3 | rosbag2_test_msgdefs/BasicIdl result 4 | --- 5 | rosbag2_test_msgdefs/BasicIdl feedback 6 | -------------------------------------------------------------------------------- /rosbag2_test_msgdefs/action/ComplexActionMsg.action: -------------------------------------------------------------------------------- 1 | rosbag2_test_msgdefs/BasicMsg goal 2 | --- 3 | rosbag2_test_msgdefs/BasicMsg result 4 | --- 5 | rosbag2_test_msgdefs/BasicMsg feedback 6 | -------------------------------------------------------------------------------- /rosbag2_storage_default_plugins/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.20) 2 | project(rosbag2_storage_default_plugins) 3 | 4 | find_package(ament_cmake REQUIRED) 5 | ament_package() 6 | -------------------------------------------------------------------------------- /rosbag2_transport/test/resources/mcap/test_bag_for_seek/test_bag_for_seek_0.mcap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ros2/rosbag2/HEAD/rosbag2_transport/test/resources/mcap/test_bag_for_seek/test_bag_for_seek_0.mcap -------------------------------------------------------------------------------- /rosbag2_transport/test/resources/sqlite3/test_bag_for_seek/test_bag_for_seek_0.db3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ros2/rosbag2/HEAD/rosbag2_transport/test/resources/sqlite3/test_bag_for_seek/test_bag_for_seek_0.db3 -------------------------------------------------------------------------------- /rosbag2_py/rosbag2_py/_reindexer.pyi: -------------------------------------------------------------------------------- 1 | import rosbag2_py._storage 2 | 3 | class Reindexer: 4 | def __init__(self) -> None: ... 5 | def reindex(self, arg0: rosbag2_py._storage.StorageOptions) -> None: ... 6 | -------------------------------------------------------------------------------- /rosbag2_py/test/resources/mcap/reindex_test_bags/multiple_files/multiple_files_0.mcap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ros2/rosbag2/HEAD/rosbag2_py/test/resources/mcap/reindex_test_bags/multiple_files/multiple_files_0.mcap -------------------------------------------------------------------------------- /rosbag2_py/test/resources/mcap/reindex_test_bags/multiple_files/multiple_files_1.mcap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ros2/rosbag2/HEAD/rosbag2_py/test/resources/mcap/reindex_test_bags/multiple_files/multiple_files_1.mcap -------------------------------------------------------------------------------- /rosbag2_py/test/resources/mcap/reindex_test_bags/multiple_files/multiple_files_2.mcap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ros2/rosbag2/HEAD/rosbag2_py/test/resources/mcap/reindex_test_bags/multiple_files/multiple_files_2.mcap -------------------------------------------------------------------------------- /rosbag2_py/test/resources/sqlite3/reindex_test_bags/multiple_files/multiple_files_0.db3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ros2/rosbag2/HEAD/rosbag2_py/test/resources/sqlite3/reindex_test_bags/multiple_files/multiple_files_0.db3 -------------------------------------------------------------------------------- /rosbag2_py/test/resources/sqlite3/reindex_test_bags/multiple_files/multiple_files_1.db3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ros2/rosbag2/HEAD/rosbag2_py/test/resources/sqlite3/reindex_test_bags/multiple_files/multiple_files_1.db3 -------------------------------------------------------------------------------- /rosbag2_py/test/resources/sqlite3/reindex_test_bags/multiple_files/multiple_files_2.db3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ros2/rosbag2/HEAD/rosbag2_py/test/resources/sqlite3/reindex_test_bags/multiple_files/multiple_files_2.db3 -------------------------------------------------------------------------------- /rosbag2_performance/rosbag2_performance_benchmarking/docs/rosbag2_performance_improvements.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ros2/rosbag2/HEAD/rosbag2_performance/rosbag2_performance_benchmarking/docs/rosbag2_performance_improvements.pdf -------------------------------------------------------------------------------- /rosbag2_py/rosbag2_py/_message_definitions.pyi: -------------------------------------------------------------------------------- 1 | class LocalMessageDefinitionSource: 2 | def __init__(self) -> None: ... 3 | def get_full_text(self, *args, **kwargs): ... 4 | def get_full_text_ext(self, *args, **kwargs): ... 5 | -------------------------------------------------------------------------------- /rosbag2_performance/rosbag2_performance_benchmarking/config/storage/storage_optimized.yaml: -------------------------------------------------------------------------------- 1 | # note: this is the default now, using this file does not change how the storage behaves 2 | write: 3 | pragmas: ["journal_mode = MEMORY", "synchronous = OFF"] 4 | -------------------------------------------------------------------------------- /rosbag2_storage_mcap/test/rosbag2_storage_mcap/mcap_writer_options_zstd.yaml: -------------------------------------------------------------------------------- 1 | noCRC: false 2 | noChunking: false 3 | noMessageIndex: false 4 | noSummary: false 5 | chunkSize: 786432 6 | compression: "Zstd" 7 | compressionLevel: "Fast" 8 | forceCompression: true -------------------------------------------------------------------------------- /rosbag2_test_msgdefs/msg/ComplexIdl.idl: -------------------------------------------------------------------------------- 1 | #include "rosbag2_test_msgdefs/msg/BasicIdl.idl" 2 | 3 | module rosbag2_test_msgdefs { 4 | module msg { 5 | struct ComplexIdl { 6 | rosbag2_test_msgdefs::msg::BasicIdl a; 7 | }; 8 | }; 9 | }; 10 | -------------------------------------------------------------------------------- /rosbag2_tests/resources/mcap/bag_with_topics_and_service_events_and_action/bag_with_topics_and_service_events_and_action.mcap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ros2/rosbag2/HEAD/rosbag2_tests/resources/mcap/bag_with_topics_and_service_events_and_action/bag_with_topics_and_service_events_and_action.mcap -------------------------------------------------------------------------------- /rosbag2_tests/resources/sqlite3/bag_with_topics_and_service_events_and_action/bag_with_topics_and_service_events_and_action.db3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ros2/rosbag2/HEAD/rosbag2_tests/resources/sqlite3/bag_with_topics_and_service_events_and_action/bag_with_topics_and_service_events_and_action.db3 -------------------------------------------------------------------------------- /rosbag2_interfaces/msg/ReadSplitEvent.msg: -------------------------------------------------------------------------------- 1 | # The full path of the file that was finished and closed 2 | string closed_file 3 | 4 | # The full path of the new file that was opened to continue playback 5 | string opened_file 6 | 7 | # The fully qualified node name of the event sender 8 | string node_name 9 | -------------------------------------------------------------------------------- /rosbag2_interfaces/msg/MessagesLostEvent.msg: -------------------------------------------------------------------------------- 1 | # The fully qualified node name of the event sender 2 | string node_name 3 | 4 | # Per topic statistics about messages lost since the last event. Topics with no lost messages 5 | # will not be included 6 | MessagesLostEventTopicStat[] messages_lost_statistics 7 | -------------------------------------------------------------------------------- /rosbag2_interfaces/msg/WriteSplitEvent.msg: -------------------------------------------------------------------------------- 1 | # The full path of the file that was finished and closed 2 | string closed_file 3 | 4 | # The full path of the new file that was created to continue recording 5 | string opened_file 6 | 7 | # The fully qualified node name of the event sender 8 | string node_name 9 | -------------------------------------------------------------------------------- /rosbag2_interfaces/msg/MessagesLostEventTopicStat.msg: -------------------------------------------------------------------------------- 1 | # The name of the topic on which the messages were lost 2 | string topic_name 3 | 4 | # The number of messages lost since the last event on a DDS transport layer 5 | uint64 messages_lost_in_transport 6 | 7 | # The number of messages lost since the last event in the Rosbag2 recorder 8 | uint64 messages_lost_in_recorder 9 | -------------------------------------------------------------------------------- /rosbag2_storage_sqlite3/plugin_description.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | Plugin to write to SQLite3 databases 8 | 9 | 10 | -------------------------------------------------------------------------------- /rosbag2_storage_mcap/plugin_description.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | rosbag2 storage plugin using the MCAP file format 8 | 9 | 10 | -------------------------------------------------------------------------------- /rosbag2_performance/rosbag2_performance_benchmarking_msgs/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.20) 2 | 3 | project(rosbag2_performance_benchmarking_msgs) 4 | 5 | find_package(ament_cmake REQUIRED) 6 | find_package(rosidl_default_generators REQUIRED) 7 | 8 | rosidl_generate_interfaces(${PROJECT_NAME} 9 | "msg/ByteArray.msg" 10 | DEPENDENCIES 11 | ) 12 | 13 | ament_export_dependencies(rosidl_default_runtime) 14 | ament_package() 15 | -------------------------------------------------------------------------------- /rosbag2_interfaces/srv/Play.srv: -------------------------------------------------------------------------------- 1 | # See rosbag2_transport::PlayOptions::start_offset 2 | builtin_interfaces/Time start_offset 3 | # See rosbag2_transport::PlayOptions::playback_duration 4 | builtin_interfaces/Duration playback_duration 5 | # See rosbag2_transport::PlayOptions::playback_until_timestamp 6 | builtin_interfaces/Time playback_until_timestamp 7 | --- 8 | # returns false when another playback execution is running, otherwise true 9 | bool success 10 | -------------------------------------------------------------------------------- /mcap_vendor/patches/0001-fix-gcc15.patch: -------------------------------------------------------------------------------- 1 | diff --git a/cpp/mcap/include/mcap/types.hpp b/cpp/mcap/include/mcap/types.hpp 2 | index ffd8f4e..5352702 100644 3 | --- a/_deps/mcap-src/cpp/mcap/include/mcap/types.hpp 4 | +++ b/_deps/mcap-src/cpp/mcap/include/mcap/types.hpp 5 | @@ -3,6 +3,7 @@ 6 | #include "errors.hpp" 7 | #include "visibility.hpp" 8 | #include 9 | +#include 10 | #include 11 | #include 12 | #include 13 | -------------------------------------------------------------------------------- /ros2bag/test/resources/qos_profile.yaml: -------------------------------------------------------------------------------- 1 | /test_topic: 2 | history: keep_all 3 | depth: 0 4 | reliability: reliable 5 | durability: transient_local 6 | deadline: 7 | # unspecified/infinity 8 | sec: 0 9 | nsec: 0 10 | lifespan: 11 | # unspecified/infinity 12 | sec: 0 13 | nsec: 0 14 | liveliness: automatic 15 | liveliness_lease_duration: 16 | # unspecified/infinity 17 | sec: 0 18 | nsec: 0 19 | avoid_ros_namespace_conventions: false 20 | -------------------------------------------------------------------------------- /rosbag2_transport/test/resources/qos_profile_overrides.yaml: -------------------------------------------------------------------------------- 1 | /overrided_topic_qos: 2 | history: keep_last 3 | depth: 10 4 | reliability: reliable 5 | durability: volatile 6 | deadline: 7 | # unspecified/infinity 8 | sec: 0 9 | nsec: 0 10 | lifespan: 11 | # unspecified/infinity 12 | sec: 0 13 | nsec: 0 14 | liveliness: system_default 15 | liveliness_lease_duration: 16 | # unspecified/infinity 17 | sec: 0 18 | nsec: 0 19 | avoid_ros_namespace_conventions: false -------------------------------------------------------------------------------- /rosbag2_compression/test/rosbag2_compression/fake_plugin.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | This is a test compressor plugin. 8 | 9 | 10 | 15 | This is a test decompressor plugin. 16 | 17 | 18 | -------------------------------------------------------------------------------- /rosbag2_py/rosbag2_py/_info.pyi: -------------------------------------------------------------------------------- 1 | import rosbag2_py._storage 2 | 3 | class Info: 4 | def __init__(self) -> None: ... 5 | def get_sorting_methods(self) -> Set[str]: ... 6 | def print_output(self, arg0: rosbag2_py._storage.BagMetadata, arg1: str) -> None: ... 7 | def print_output_topic_name_only(self, arg0: rosbag2_py._storage.BagMetadata, arg1: str) -> None: ... 8 | def print_output_verbose(self, arg0: str, arg1: rosbag2_py._storage.BagMetadata, arg2: str) -> None: ... 9 | def read_metadata(self, arg0: str, arg1: str) -> rosbag2_py._storage.BagMetadata: ... 10 | -------------------------------------------------------------------------------- /rosbag2_performance/rosbag2_performance_benchmarking/config/producers/100MBs_raw.yaml: -------------------------------------------------------------------------------- 1 | rosbag2_performance_benchmarking_node: 2 | ros__parameters: 3 | publishers: # publisher_groups parameter needs to include all the subsequent groups 4 | publisher_groups: [ "100MBs" ] 5 | wait_for_subscriptions: True 6 | 100MBs: 7 | publishers_count: 20 8 | topic_root: "benchmarking_100" 9 | msg_size_bytes: 200000 10 | msg_count_each: 1000 11 | rate_hz: 25 12 | qos: 13 | qos_durability: "transient_local" 14 | -------------------------------------------------------------------------------- /rosbag2_performance/rosbag2_performance_benchmarking/config/producers/200MBs_raw.yaml: -------------------------------------------------------------------------------- 1 | rosbag2_performance_benchmarking_node: 2 | ros__parameters: 3 | publishers: # publisher_groups parameter needs to include all the subsequent groups 4 | publisher_groups: [ "200MBs" ] 5 | wait_for_subscriptions: True 6 | 200MBs: 7 | publishers_count: 20 8 | topic_root: "benchmarking_200" 9 | msg_size_bytes: 400000 10 | msg_count_each: 1000 11 | rate_hz: 25 12 | qos: 13 | qos_durability: "transient_local" 14 | -------------------------------------------------------------------------------- /rosbag2_performance/rosbag2_performance_benchmarking/config/producers/300MBs_raw.yaml: -------------------------------------------------------------------------------- 1 | rosbag2_performance_benchmarking_node: 2 | ros__parameters: 3 | publishers: # publisher_groups parameter needs to include all the subsequent groups 4 | publisher_groups: [ "300MBs" ] 5 | wait_for_subscriptions: True 6 | 300MBs: 7 | publishers_count: 20 8 | topic_root: "benchmarking_300" 9 | msg_size_bytes: 600000 10 | msg_count_each: 1000 11 | rate_hz: 25 12 | qos: 13 | qos_durability: "transient_local" 14 | -------------------------------------------------------------------------------- /rosbag2_storage/test/rosbag2_storage/test_plugin.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | This is a test storage plugin. 8 | 9 | 10 | 15 | This is a read-only test storage plugin. 16 | 17 | 18 | -------------------------------------------------------------------------------- /rosbag2_compression_zstd/plugin_description.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | Zstd implementation for rosbag2 compressor 7 | 8 | 12 | Zstd implementation for rosbag2 decompressor 13 | 14 | 15 | -------------------------------------------------------------------------------- /lz4_cmake_module/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.20) 2 | project(lz4_cmake_module) 3 | 4 | find_package(ament_cmake REQUIRED) 5 | 6 | if(BUILD_TESTING) 7 | find_package(ament_cmake_lint_cmake REQUIRED) 8 | find_package(ament_cmake_copyright REQUIRED) 9 | 10 | # Find module is intentionally mixed case, so tell linter to ignore that 11 | ament_lint_cmake("--filter=-convention/filename,-package/stdargs") 12 | ament_copyright() 13 | endif() 14 | 15 | install(DIRECTORY cmake 16 | DESTINATION share/${PROJECT_NAME}) 17 | 18 | ament_package( 19 | CONFIG_EXTRAS "lz4_cmake_module-extras.cmake" 20 | ) 21 | -------------------------------------------------------------------------------- /rosbag2_transport/test/resources/sqlite3/test_bag_for_seek/metadata.yaml: -------------------------------------------------------------------------------- 1 | rosbag2_bagfile_information: 2 | version: 4 3 | storage_identifier: sqlite3 4 | relative_file_paths: 5 | - test_bag_for_seek_0.db3 6 | duration: 7 | nanoseconds: 400000000 8 | starting_time: 9 | nanoseconds_since_epoch: 1000000000 10 | message_count: 5 11 | topics_with_message_count: 12 | - topic_metadata: 13 | name: topic1 14 | type: test_msgs/BasicTypes 15 | serialization_format: cdr 16 | offered_qos_profiles: "" 17 | message_count: 5 18 | compression_format: "" 19 | compression_mode: "" -------------------------------------------------------------------------------- /zstd_cmake_module/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.20) 2 | project(zstd_cmake_module) 3 | 4 | find_package(ament_cmake REQUIRED) 5 | 6 | if(BUILD_TESTING) 7 | find_package(ament_cmake_lint_cmake REQUIRED) 8 | find_package(ament_cmake_copyright REQUIRED) 9 | 10 | # Find module is intentionally mixed case, so tell linter to ignore that 11 | ament_lint_cmake("--filter=-convention/filename,-package/stdargs") 12 | ament_copyright() 13 | endif() 14 | 15 | install(DIRECTORY cmake 16 | DESTINATION share/${PROJECT_NAME}) 17 | 18 | ament_package( 19 | CONFIG_EXTRAS "zstd_cmake_module-extras.cmake" 20 | ) 21 | -------------------------------------------------------------------------------- /rosbag2_cpp/test/rosbag2_cpp/converter_test_plugin.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | This is a test format converter plugin. 8 | 9 | 10 | 15 | This is a test format serializer plugin. 16 | 17 | 18 | -------------------------------------------------------------------------------- /rosbag2_py/README.md: -------------------------------------------------------------------------------- 1 | # rosbag2_py 2 | 3 | ## Regenerating Python stub files (.pyi) 4 | 5 | Python stub files allow to supply type-hinting information for binary Python modules (e.g. pybind-based). 6 | 7 | In rosbag2_py stub files are generated with utility called `stubgen`. 8 | 9 | To regenerate stub files 10 | ``` 11 | cd 12 | colcon build --packages-up-to rosbag2_py 13 | source install/setup.sh 14 | # Make sure rosbag2_py can be imported 15 | python3 -c 'import rosbag2_py' 16 | 17 | # Ubuntu 24.04 18 | sudo apt update && sudo apt install mypy 19 | 20 | # Older Ubuntu 21 | # pip3 install -U mypy==1.9 22 | 23 | cd 24 | stubgen -p rosbag2_py -o rosbag2_py 25 | ``` 26 | -------------------------------------------------------------------------------- /rosbag2_test_common/rosbag2_test_common/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2022 Foxglove Technologies, Inc. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | TESTED_STORAGE_IDS = ['sqlite3', 'mcap'] 16 | -------------------------------------------------------------------------------- /mcap_vendor/src/main.cpp: -------------------------------------------------------------------------------- 1 | // Copyright 2022, Foxglove Technologies. All rights reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #define MCAP_IMPLEMENTATION 16 | #include 17 | -------------------------------------------------------------------------------- /lz4_cmake_module/lz4_cmake_module-extras.cmake: -------------------------------------------------------------------------------- 1 | # Copyright 2025 Open Source Robotics Foundation, Inc. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | list(INSERT CMAKE_MODULE_PATH 0 "${lz4_cmake_module_DIR}/Modules") 16 | -------------------------------------------------------------------------------- /zstd_cmake_module/zstd_cmake_module-extras.cmake: -------------------------------------------------------------------------------- 1 | # Copyright 2025 Open Source Robotics Foundation, Inc. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | list(INSERT CMAKE_MODULE_PATH 0 "${zstd_cmake_module_DIR}/Modules") 16 | -------------------------------------------------------------------------------- /rosbag2_transport/test/resources/mcap/test_bag_for_seek/metadata.yaml: -------------------------------------------------------------------------------- 1 | rosbag2_bagfile_information: 2 | version: 6 3 | storage_identifier: mcap 4 | duration: 5 | nanoseconds: 400000000 6 | starting_time: 7 | nanoseconds_since_epoch: 1000000000 8 | message_count: 5 9 | topics_with_message_count: 10 | - topic_metadata: 11 | name: topic1 12 | type: test_msgs/BasicTypes 13 | serialization_format: cdr 14 | offered_qos_profiles: "" 15 | message_count: 5 16 | compression_format: "" 17 | compression_mode: "" 18 | relative_file_paths: 19 | - test_bag_for_seek_0.mcap 20 | files: 21 | - path: test_bag_for_seek_0.mcap 22 | starting_time: 23 | nanoseconds_since_epoch: 1000000000 24 | duration: 25 | nanoseconds: 400000000 26 | message_count: 5 27 | custom_data: ~ -------------------------------------------------------------------------------- /rosbag2_cpp/include/rosbag2_cpp/types.hpp: -------------------------------------------------------------------------------- 1 | // Copyright 2018, Bosch Software Innovations GmbH. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef ROSBAG2_CPP__TYPES_HPP_ 16 | #define ROSBAG2_CPP__TYPES_HPP_ 17 | 18 | #include "rosbag2_cpp/types/introspection_message.hpp" 19 | 20 | #endif // ROSBAG2_CPP__TYPES_HPP_ 21 | -------------------------------------------------------------------------------- /ros2bag/test/test_xmllint.py: -------------------------------------------------------------------------------- 1 | # Copyright 2019 Open Source Robotics Foundation, Inc. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from ament_xmllint.main import main 16 | import pytest 17 | 18 | 19 | @pytest.mark.linter 20 | @pytest.mark.xmllint 21 | def test_xmllint() -> None: 22 | rc = main(argv=[]) 23 | assert rc == 0, 'Found errors' 24 | -------------------------------------------------------------------------------- /ros2bag/test/test_copyright.py: -------------------------------------------------------------------------------- 1 | # Copyright 2019 Open Source Robotics Foundation, Inc. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from ament_copyright.main import main 16 | import pytest 17 | 18 | 19 | @pytest.mark.copyright 20 | @pytest.mark.linter 21 | def test_copyright(): 22 | rc = main(argv=['.', 'test']) 23 | assert rc == 0, 'Found errors' 24 | -------------------------------------------------------------------------------- /ros2bag/test/test_pep257.py: -------------------------------------------------------------------------------- 1 | # Copyright 2019 Open Source Robotics Foundation, Inc. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from ament_pep257.main import main 16 | import pytest 17 | 18 | 19 | @pytest.mark.linter 20 | @pytest.mark.pep257 21 | def test_pep257(): 22 | rc = main(argv=[]) 23 | assert rc == 0, 'Found code style errors / warnings' 24 | -------------------------------------------------------------------------------- /rosbag2_test_msgdefs/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.20) 2 | project(rosbag2_test_msgdefs) 3 | 4 | if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") 5 | add_compile_options(-Wall -Wextra -Wpedantic) 6 | endif() 7 | 8 | # find dependencies 9 | find_package(ament_cmake REQUIRED) 10 | find_package(rosidl_default_generators REQUIRED) 11 | rosidl_generate_interfaces(${PROJECT_NAME} 12 | "msg/ComplexIdl.idl" 13 | "msg/BasicIdl.idl" 14 | "msg/BasicMsg.msg" 15 | "msg/nested_sub_dir/AnotherBasicMsg.msg" 16 | "msg/ComplexMsg.msg" 17 | "msg/ComplexMsgDependsOnIdl.msg" 18 | "srv/BasicSrv.srv" 19 | "srv/ComplexSrvMsg.srv" 20 | "srv/ComplexSrvIdl.srv" 21 | "action/BasicAction.action" 22 | "nested_sub_dir/action/BasicMsg.action" 23 | "action/ComplexActionMsg.action" 24 | "action/ComplexActionIdl.action" 25 | ADD_LINTER_TESTS 26 | ) 27 | 28 | ament_package() 29 | -------------------------------------------------------------------------------- /rosbag2_examples/rosbag2_examples_py/test/test_xmllint.py: -------------------------------------------------------------------------------- 1 | # Copyright 2019 Open Source Robotics Foundation, Inc. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from ament_xmllint.main import main 16 | import pytest 17 | 18 | 19 | @pytest.mark.linter 20 | @pytest.mark.xmllint 21 | def test_xmllint() -> None: 22 | rc = main(argv=[]) 23 | assert rc == 0, 'Found errors' 24 | -------------------------------------------------------------------------------- /rosbag2_examples/rosbag2_examples_py/test/test_copyright.py: -------------------------------------------------------------------------------- 1 | # Copyright 2015 Open Source Robotics Foundation, Inc. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from ament_copyright.main import main 16 | import pytest 17 | 18 | 19 | @pytest.mark.copyright 20 | @pytest.mark.linter 21 | def test_copyright(): 22 | rc = main(argv=['.', 'test']) 23 | assert rc == 0, 'Found errors' 24 | -------------------------------------------------------------------------------- /rosbag2_examples/rosbag2_examples_py/test/test_pep257.py: -------------------------------------------------------------------------------- 1 | # Copyright 2015 Open Source Robotics Foundation, Inc. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from ament_pep257.main import main 16 | import pytest 17 | 18 | 19 | @pytest.mark.linter 20 | @pytest.mark.pep257 21 | def test_pep257(): 22 | rc = main(argv=['.', 'test']) 23 | assert rc == 0, 'Found code style errors / warnings' 24 | -------------------------------------------------------------------------------- /rosbag2_storage/src/rosbag2_storage/default_storage_id.cpp: -------------------------------------------------------------------------------- 1 | // Copyright 2022, Foxglove Technologies Inc. All rights reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | #include "rosbag2_storage/default_storage_id.hpp" 15 | 16 | namespace rosbag2_storage 17 | { 18 | 19 | std::string get_default_storage_id() 20 | { 21 | return "mcap"; 22 | } 23 | 24 | } // namespace rosbag2_storage 25 | -------------------------------------------------------------------------------- /rosbag2_storage_sqlite3/ros2bag_sqlite3_cli/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2023 Foxglove Technologies Inc. All Rights Reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | 16 | def get_preset_profiles(): 17 | return [ 18 | ('none', 'Default profile, optimized for performance.'), 19 | ('resilient', 'Avoid data corruption in case of crashes at the cost of performance.'), 20 | ] 21 | -------------------------------------------------------------------------------- /DEVELOPING.md: -------------------------------------------------------------------------------- 1 | # Development guide for Rosbag2 2 | 3 | ## Build from source 4 | 5 | Rosbag2 is built like any other ROS 2 package, and all necessary packages are contained under the metapackage `rosbag2`. 6 | Therefore you can 7 | 8 | ``` 9 | colcon build --packages-up-to rosbag2 10 | ``` 11 | 12 | Note: building Rosbag2 from source, overlaid on a debian installation of `ros-$ROS_DISTRO-rosbag2` has undefined behavior (but should work in most cases, just beware the build may find headers from the binaries instead of the local workspace.) 13 | 14 | Note: make sure to [regenerate stub files](rosbag2_py/README.md), when making changes to pybind11-related files in `rosbag2_py`. 15 | 16 | ## Executing tests 17 | 18 | The tests can be run using the following commands: 19 | 20 | ``` 21 | $ colcon test [--merge-install] 22 | $ colcon test-result --verbose 23 | ``` 24 | 25 | The first command executes the test and the second command displays the errors (if any). 26 | -------------------------------------------------------------------------------- /mcap_vendor/package.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | mcap_vendor 5 | 0.33.0 6 | mcap vendor package 7 | Foxglove 8 | Michael Orlov 9 | ROS Tooling Working Group 10 | Apache License 2.0 11 | 12 | ament_cmake 13 | git 14 | 15 | zstd_cmake_module 16 | 17 | lz4_cmake_module 18 | lz4_cmake_module 19 | 20 | 21 | ament_cmake 22 | 23 | 24 | -------------------------------------------------------------------------------- /rosbag2_storage_mcap/.clang-format: -------------------------------------------------------------------------------- 1 | --- 2 | Language: Cpp 3 | Standard: c++17 4 | BasedOnStyle: Google 5 | 6 | AllowShortFunctionsOnASingleLine: Empty 7 | AllowShortLambdasOnASingleLine: Empty 8 | AccessModifierOffset: -2 9 | TabWidth: 2 10 | ContinuationIndentWidth: 2 11 | UseTab: Never 12 | BreakConstructorInitializers: BeforeComma 13 | BraceWrapping: 14 | AfterClass: true 15 | AfterFunction: true 16 | AfterNamespace: true 17 | AfterStruct: true 18 | AfterEnum: true 19 | BreakBeforeBraces: Custom 20 | ColumnLimit: 100 21 | ConstructorInitializerAllOnOneLineOrOnePerLine: false 22 | DerivePointerAlignment: false 23 | FixNamespaceComments: true 24 | PointerAlignment: Middle 25 | ReflowComments: false 26 | SortIncludes: true 27 | IndentPPDirectives: BeforeHash 28 | 29 | IncludeCategories: 30 | - Regex: '^"' 31 | Priority: 1 32 | - Regex: "^ 19 | #include 20 | 21 | namespace rosbag2_py 22 | { 23 | std::string format_file_size(uint64_t file_size); 24 | } // namespace rosbag2_py 25 | 26 | #endif // ROSBAG2_PY__FORMAT_UTILS_HPP_ 27 | -------------------------------------------------------------------------------- /ros2bag/test/test_flake8.py: -------------------------------------------------------------------------------- 1 | # Copyright 2019 Open Source Robotics Foundation, Inc. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from ament_flake8.main import main_with_errors 16 | import pytest 17 | 18 | 19 | @pytest.mark.flake8 20 | @pytest.mark.linter 21 | def test_flake8(): 22 | rc, errors = main_with_errors(argv=[]) 23 | assert rc == 0, \ 24 | 'Found %d code style errors / warnings:\n' % len(errors) + \ 25 | '\n'.join(errors) 26 | -------------------------------------------------------------------------------- /rosbag2_storage/src/rosbag2_storage/base_io_interface.cpp: -------------------------------------------------------------------------------- 1 | // Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include "rosbag2_storage/storage_interfaces/base_io_interface.hpp" 16 | 17 | namespace rosbag2_storage 18 | { 19 | namespace storage_interfaces 20 | { 21 | const uint64_t MAX_BAGFILE_SIZE_NO_SPLIT = 0; 22 | const uint64_t MAX_BAGFILE_DURATION_NO_SPLIT = 0; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: bug 6 | assignees: '' 7 | 8 | --- 9 | 10 | ## Description 11 | ** clear and concise description of the bug is ** 12 | 13 | ### Expected Behavior 14 | ** clear and concise description of what you _expected_ to happen ** 15 | 16 | ### Actual Behavior 17 | ** clear and concise description of what _actually_ happened. include copied logs whenever possible ** 18 | 19 | ## To Reproduce 20 | ** Steps to reproduce the behavior, e.g. 21 | 1. Go to '...' 22 | 2. Click on '....' 23 | 3. Scroll down to '....' 24 | 4. Logs print error '...' ** 25 | 26 | ## System (please complete the following information) 27 | - OS: [e.g. Ubuntu Bionic] 28 | - ROS 2 Distro: [e.g. Dashing] 29 | - Install Method: [APT, release archive, source] 30 | - Version: [release, branch, commit hash, patch release number] 31 | 32 | 33 | ## Additional context 34 | ** Add any other context about the problem here ** 35 | -------------------------------------------------------------------------------- /rosbag2_storage_default_plugins/package.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | rosbag2_storage_default_plugins 4 | 0.33.0 5 | Intermediate metapackage to point at default storage plugin(s) for rosbag2 6 | Michael Orlov 7 | Geoffrey Biggs 8 | Michel Hidalgo 9 | Emerson Knapp 10 | ROS Tooling Working Group 11 | Apache License 2.0 12 | 13 | ament_cmake 14 | 15 | 16 | rosbag2_storage_mcap 17 | rosbag2_storage_sqlite3 18 | 19 | 20 | ament_cmake 21 | 22 | 23 | -------------------------------------------------------------------------------- /rosbag2_examples/rosbag2_examples_py/test/test_flake8.py: -------------------------------------------------------------------------------- 1 | # Copyright 2017 Open Source Robotics Foundation, Inc. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from ament_flake8.main import main_with_errors 16 | import pytest 17 | 18 | 19 | @pytest.mark.flake8 20 | @pytest.mark.linter 21 | def test_flake8(): 22 | rc, errors = main_with_errors(argv=[]) 23 | assert rc == 0, \ 24 | 'Found %d code style errors / warnings:\n' % len(errors) + \ 25 | '\n'.join(errors) 26 | -------------------------------------------------------------------------------- /lz4_cmake_module/package.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | lz4_cmake_module 5 | 0.33.0 6 | LZ4 compression cmake module package 7 | Michael Orlov 8 | Emerson Knapp 9 | ROS Tooling Working Group 10 | Apache License 2.0 11 | 12 | https://github.com/lz4/lz4/ 13 | 14 | ament_cmake 15 | 16 | liblz4-dev 17 | 18 | ament_lint_auto 19 | ament_lint_common 20 | 21 | 22 | ament_cmake 23 | 24 | 25 | -------------------------------------------------------------------------------- /rosbag2_examples/rosbag2_examples_py/package.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | rosbag2_examples_py 5 | 0.33.0 6 | Python bag writing tutorial 7 | geoff 8 | Apache License 2.0 9 | 10 | rclpy 11 | rosbag2_compression 12 | rosbag2_py 13 | example_interfaces 14 | std_msgs 15 | 16 | rosidl_runtime_py 17 | 18 | ament_copyright 19 | ament_flake8 20 | ament_pep257 21 | ament_xmllint 22 | python3-pytest 23 | 24 | 25 | ament_python 26 | 27 | 28 | -------------------------------------------------------------------------------- /rosbag2_test_msgdefs/package.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | rosbag2_test_msgdefs 5 | 0.33.0 6 | message definition test fixtures for rosbag2 schema recording 7 | Foxglove 8 | Michael Orlov 9 | ROS Tooling Working Group 10 | Apache-2.0 11 | 12 | ament_cmake 13 | rosidl_default_generators 14 | 15 | ament_lint_auto 16 | ament_lint_common 17 | 18 | 19 | ament_cmake 20 | 21 | 22 | rosidl_interface_packages 23 | 24 | 25 | -------------------------------------------------------------------------------- /zstd_cmake_module/package.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | zstd_cmake_module 5 | 0.33.0 6 | ZSTD compression cmake module package 7 | Michael Orlov 8 | Emerson Knapp 9 | ROS Tooling Working Group 10 | Apache License 2.0 11 | 12 | https://facebook.github.io/zstd/ 13 | 14 | ament_cmake 15 | 16 | libzstd-dev 17 | 18 | ament_lint_auto 19 | ament_lint_common 20 | 21 | 22 | ament_cmake 23 | 24 | 25 | -------------------------------------------------------------------------------- /rosbag2_performance/rosbag2_performance_benchmarking/config/producers/mixed_110Mbs.yaml: -------------------------------------------------------------------------------- 1 | rosbag2_performance_benchmarking_node: 2 | ros__parameters: 3 | publishers: # publisher_groups parameter needs to include all the subsequent groups 4 | publisher_groups: [ "10Mbs_many_frequent_small", "100Mbs_large" ] 5 | wait_for_subscriptions: True 6 | # number_of_threads: 16 7 | 10Mbs_many_frequent_small: 8 | publishers_count: 500 9 | topic_root: "benchmarking_small" 10 | msg_size_bytes: 100 11 | msg_count_each: 2000 12 | rate_hz: 200 13 | 100Mbs_large: 14 | publishers_count: 1 15 | topic_root: "benchmarking_large" 16 | msg_size_bytes: 5000000 17 | msg_count_each: 100 18 | rate_hz: 10 19 | qos: # qos settings are ignored for writer only benchmarking 20 | qos_depth: 5 21 | qos_reliability: "best_effort" # "reliable" 22 | qos_durability: "volatile" # "transient_local" 23 | -------------------------------------------------------------------------------- /rosbag2_storage_mcap/ros2bag_mcap_cli/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2023 Foxglove Technologies Inc. All Rights Reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | 16 | def get_preset_profiles(): 17 | return [ 18 | ('none', 'Default profile, no special settings.'), 19 | ('fastwrite', 'Disables CRC and chunking for faster writing.'), 20 | ('zstd_fast', 'Use Zstd chunk compression on Fastest level.'), 21 | ('zstd_small', 'Use Zstd chunk compression on Slowest level, for smallest file size.'), 22 | ] 23 | -------------------------------------------------------------------------------- /rosbag2_test_common/include/rosbag2_test_common/process_execution_helpers.hpp: -------------------------------------------------------------------------------- 1 | // Copyright 2018, Bosch Software Innovations GmbH. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef ROSBAG2_TEST_COMMON__PROCESS_EXECUTION_HELPERS_HPP_ 16 | #define ROSBAG2_TEST_COMMON__PROCESS_EXECUTION_HELPERS_HPP_ 17 | 18 | #ifdef _WIN32 19 | #include "process_execution_helpers_windows.hpp" 20 | #else 21 | #include "process_execution_helpers_unix.hpp" 22 | #endif 23 | 24 | #endif // ROSBAG2_TEST_COMMON__PROCESS_EXECUTION_HELPERS_HPP_ 25 | -------------------------------------------------------------------------------- /rosbag2_performance/rosbag2_performance_benchmarking/config/producers/mixed_110Mbs_low_pubs_count.yaml: -------------------------------------------------------------------------------- 1 | rosbag2_performance_benchmarking_node: 2 | ros__parameters: 3 | publishers: # publisher_groups parameter needs to include all the subsequent groups 4 | publisher_groups: [ "10Mbs_many_frequent_small", "100Mbs_large" ] 5 | wait_for_subscriptions: True 6 | # number_of_threads: 16 7 | 10Mbs_many_frequent_small: 8 | publishers_count: 100 9 | topic_root: "benchmarking_small" 10 | msg_size_bytes: 500 11 | msg_count_each: 2000 12 | rate_hz: 200 13 | 100Mbs_large: 14 | publishers_count: 1 15 | topic_root: "benchmarking_large" 16 | msg_size_bytes: 10000000 17 | msg_count_each: 100 18 | rate_hz: 10 19 | qos: # qos settings are ignored for writer only benchmarking 20 | qos_depth: 5 21 | qos_reliability: "best_effort" # "reliable" 22 | qos_durability: "volatile" # "transient_local" 23 | -------------------------------------------------------------------------------- /rosbag2_examples/rosbag2_examples_cpp/package.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | rosbag2_examples_cpp 5 | 0.33.0 6 | rosbag2 C++ API tutorials and examples 7 | Michael Orlov 8 | geoff 9 | ROS Tooling Working Group 10 | Apache License 2.0 11 | 12 | ament_cmake 13 | 14 | rclcpp 15 | rosbag2_compression 16 | rosbag2_cpp 17 | rosbag2_transport 18 | example_interfaces 19 | 20 | ament_lint_auto 21 | ament_lint_common 22 | 23 | 24 | ament_cmake 25 | 26 | 27 | -------------------------------------------------------------------------------- /rosbag2_performance/rosbag2_performance_benchmarking/config/benchmarks/test/test_no_transport.yaml: -------------------------------------------------------------------------------- 1 | rosbag2_performance_benchmarking: 2 | benchmark_node: 3 | ros__parameters: 4 | benchmark: 5 | summary_result_file: "results.csv" 6 | bag_root_folder: "/tmpfs/rosbag2_performance_test" 7 | repeat_each: 1 # How many times to run each configurations (to average results) 8 | no_transport: True # Whether to run storage-only or end-to-end (including transport) benchmark 9 | preserve_bags: False # Whether to leave bag files after experiment (and between runs). Some configurations can take lots of space! 10 | parameters: # Each combination of parameters in this section will be benchmarked 11 | storage_id: ["mcap", "sqlite3"] 12 | max_cache_size: [100000000] 13 | max_bag_size: [0] 14 | compression: [""] 15 | compression_queue_size: [1] 16 | compression_threads: [0] 17 | storage_config_file: [""] 18 | -------------------------------------------------------------------------------- /rosbag2_cpp/include/rosbag2_cpp/converter_options.hpp: -------------------------------------------------------------------------------- 1 | // Copyright 2018, Bosch Software Innovations GmbH. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef ROSBAG2_CPP__CONVERTER_OPTIONS_HPP_ 16 | #define ROSBAG2_CPP__CONVERTER_OPTIONS_HPP_ 17 | 18 | #include 19 | 20 | namespace rosbag2_cpp 21 | { 22 | 23 | struct ConverterOptions 24 | { 25 | std::string input_serialization_format; 26 | std::string output_serialization_format; 27 | }; 28 | 29 | } // namespace rosbag2_cpp 30 | 31 | #endif // ROSBAG2_CPP__CONVERTER_OPTIONS_HPP_ 32 | -------------------------------------------------------------------------------- /rosbag2_performance/rosbag2_performance_benchmarking/config/benchmarks/test/test_benchmark_producers.yaml: -------------------------------------------------------------------------------- 1 | rosbag2_performance_benchmarking: 2 | benchmark_node: 3 | ros__parameters: 4 | benchmark: 5 | summary_result_file: "results.csv" 6 | bag_root_folder: "/tmpfs/rosbag2_performance_test" 7 | repeat_each: 1 # How many times to run each configurations (to average results) 8 | no_transport: False # Whether to run storage-only or end-to-end (including transport) benchmark 9 | preserve_bags: False # Whether to leave bag files after experiment (and between runs). Some configurations can take lots of space! 10 | parameters: # Each combination of parameters in this section will be benchmarked 11 | storage_id: ["mcap", "sqlite3"] 12 | max_cache_size: [100000000] 13 | max_bag_size: [0] 14 | compression: [""] 15 | compression_queue_size: [1] 16 | compression_threads: [0] 17 | storage_config_file: [""] 18 | -------------------------------------------------------------------------------- /rosbag2_storage/include/rosbag2_storage/default_storage_id.hpp: -------------------------------------------------------------------------------- 1 | // Copyright 2022, Foxglove Technologies Inc. All rights reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef ROSBAG2_STORAGE__DEFAULT_STORAGE_ID_HPP_ 16 | #define ROSBAG2_STORAGE__DEFAULT_STORAGE_ID_HPP_ 17 | 18 | #include 19 | 20 | #include "rosbag2_storage/visibility_control.hpp" 21 | 22 | namespace rosbag2_storage 23 | { 24 | 25 | ROSBAG2_STORAGE_PUBLIC std::string get_default_storage_id(); 26 | 27 | } // namespace rosbag2_storage 28 | 29 | #endif // ROSBAG2_STORAGE__DEFAULT_STORAGE_ID_HPP_ 30 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: enhancement 6 | assignees: '' 7 | 8 | --- 9 | 10 | ## Description 11 | 12 | ** Clear and concise description of the feature that you'd like to exist, from a user's perspective. Don't get into implementation details, describe what you want it to do. Put any consideration of alternate features that might solve your problem as well. ** 13 | 14 | ## Related Issues 15 | 16 | ** Is this feature dependent on any other features? Is it part of a larger project? Note here. ** 17 | 18 | ## Completion Criteria 19 | 20 | ** What needs to be true before we can call this "Done"? Bullet lists are appropriate. ** 21 | 22 | ## Implementation Notes / Suggestions 23 | 24 | ** If you have ideas about how this feature might be accomplished, put them here. Note that this is just a suggestion to the implementer, so feel free to speculate. ** 25 | 26 | ## Testing Notes / Suggestions 27 | 28 | ** All features in this project need tests. Please give some input on cases that will need to be tested - and how the testing might be implemented. ** 29 | -------------------------------------------------------------------------------- /rosbag2_performance/rosbag2_performance_benchmarking/include/rosbag2_performance_benchmarking/producer_config.hpp: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2021, Robotec.ai sp. z o.o. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef ROSBAG2_PERFORMANCE_BENCHMARKING__PRODUCER_CONFIG_HPP_ 16 | #define ROSBAG2_PERFORMANCE_BENCHMARKING__PRODUCER_CONFIG_HPP_ 17 | 18 | #include 19 | 20 | struct ProducerConfig 21 | { 22 | unsigned int frequency; 23 | unsigned int max_count; 24 | unsigned int message_size; 25 | std::string message_type; 26 | }; 27 | 28 | #endif // ROSBAG2_PERFORMANCE_BENCHMARKING__PRODUCER_CONFIG_HPP_ 29 | -------------------------------------------------------------------------------- /rosbag2_performance/rosbag2_performance_benchmarking/include/rosbag2_performance_benchmarking/bag_config.hpp: -------------------------------------------------------------------------------- 1 | // Copyright 2021, Robotec.ai sp. z o.o. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef ROSBAG2_PERFORMANCE_BENCHMARKING__BAG_CONFIG_HPP_ 16 | #define ROSBAG2_PERFORMANCE_BENCHMARKING__BAG_CONFIG_HPP_ 17 | 18 | #include 19 | #include "rosbag2_storage/storage_options.hpp" 20 | 21 | struct BagConfig 22 | { 23 | rosbag2_storage::StorageOptions storage_options; 24 | std::string compression_format; 25 | unsigned int compression_queue_size; 26 | unsigned int compression_threads; 27 | }; 28 | 29 | #endif // ROSBAG2_PERFORMANCE_BENCHMARKING__BAG_CONFIG_HPP_ 30 | -------------------------------------------------------------------------------- /rosbag2_py/src/rosbag2_py/service_event_info.hpp: -------------------------------------------------------------------------------- 1 | // Copyright 2024 Open Source Robotics Foundation, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | 16 | #ifndef ROSBAG2_PY__SERVICE_EVENT_INFO_HPP_ 17 | #define ROSBAG2_PY__SERVICE_EVENT_INFO_HPP_ 18 | 19 | #include 20 | 21 | namespace rosbag2_py 22 | { 23 | 24 | struct ServiceMetadata 25 | { 26 | std::string name; 27 | std::string type; 28 | std::string serialization_format; 29 | }; 30 | 31 | struct ServiceEventInformation 32 | { 33 | ServiceMetadata service_metadata; 34 | size_t event_message_count = 0; 35 | }; 36 | 37 | } // namespace rosbag2_py 38 | 39 | #endif // ROSBAG2_PY__SERVICE_EVENT_INFO_HPP_ 40 | -------------------------------------------------------------------------------- /rosbag2_storage/package.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | rosbag2_storage 4 | 0.33.0 5 | ROS2 independent storage format to store serialized ROS2 messages 6 | Michael Orlov 7 | Geoffrey Biggs 8 | Michel Hidalgo 9 | Emerson Knapp 10 | ROS Tooling Working Group 11 | Apache License 2.0 12 | 13 | ament_cmake 14 | 15 | pluginlib 16 | rcutils 17 | rclcpp 18 | rmw 19 | yaml_cpp_vendor 20 | 21 | ament_cmake_gtest 22 | ament_cmake_gmock 23 | ament_lint_auto 24 | ament_lint_common 25 | rosbag2_test_common 26 | 27 | 28 | ament_cmake 29 | 30 | 31 | -------------------------------------------------------------------------------- /rosbag2_performance/rosbag2_performance_benchmarking_msgs/package.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | rosbag2_performance_benchmarking_msgs 5 | 0.33.0 6 | A package containing rosbag2 performance benchmarking specific messages. 7 | ROS Tooling Working Group 8 | Adam Dabrowski 9 | Apache License 2.0 10 | 11 | ament_cmake 12 | rosidl_default_generators 13 | 14 | rosidl_default_runtime 15 | 16 | ament_cmake_gtest 17 | ament_lint_auto 18 | ament_lint_common 19 | rosidl_cmake 20 | rosidl_typesupport_cpp 21 | 22 | rosidl_interface_packages 23 | 24 | 25 | ament_cmake 26 | 27 | 28 | -------------------------------------------------------------------------------- /rosbag2_py/src/rosbag2_py/pybind11.hpp: -------------------------------------------------------------------------------- 1 | // Copyright 2020 Open Source Robotics Foundation, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef ROSBAG2_PY__PYBIND11_HPP_ 16 | #define ROSBAG2_PY__PYBIND11_HPP_ 17 | 18 | // Ignore -Wunused-value for clang. 19 | // Based on https://github.com/pybind/pybind11/issues/2225 20 | #if defined(__clang__) 21 | #pragma clang diagnostic push 22 | #pragma clang diagnostic ignored "-Wunused-value" 23 | #endif 24 | #include 25 | #if defined(__clang__) 26 | #pragma clang diagnostic pop 27 | #endif 28 | #include 29 | #include 30 | #include 31 | 32 | #endif // ROSBAG2_PY__PYBIND11_HPP_ 33 | -------------------------------------------------------------------------------- /rosbag2_performance/rosbag2_performance_benchmarking/config/benchmarks/default_no_transport.yaml: -------------------------------------------------------------------------------- 1 | rosbag2_performance_benchmarking: 2 | benchmark_node: 3 | ros__parameters: 4 | benchmark: 5 | summary_result_file: "results.csv" 6 | bag_root_folder: "/tmp/rosbag2_performance_default" 7 | repeat_each: 1 # How many times to run each configurations (to average results) 8 | no_transport: True # Whether to run storage-only or end-to-end (including transport) benchmark 9 | preserve_bags: False # Whether to leave bag files after experiment (and between runs). Some configurations can take lots of space! 10 | producers_cpu_affinity: [0, 1] # CPU affinity for producers 11 | recorder_cpu_affinity: [2, 3] # CPU affinity for recorder 12 | parameters: # Each combination of parameters in this section will be benchmarked 13 | storage_id: ["mcap", "sqlite3"] 14 | max_cache_size: [100000000, 500000000] 15 | max_bag_size: [0, 1000000000] 16 | compression: [""] 17 | compression_queue_size: [1] 18 | compression_threads: [0] 19 | storage_config_file: [""] 20 | -------------------------------------------------------------------------------- /rosbag2_cpp/test/rosbag2_cpp/fake_data.hpp: -------------------------------------------------------------------------------- 1 | // Copyright 2022, Foxglove Technologies. All rights reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef ROSBAG2_CPP__FAKE_DATA_HPP_ 16 | #define ROSBAG2_CPP__FAKE_DATA_HPP_ 17 | 18 | #include 19 | #include 20 | 21 | #include "rosbag2_cpp/writers/sequential_writer.hpp" 22 | 23 | // Write vector of pairs to bag files, splitting every N messages 24 | void write_sample_split_bag( 25 | const rosbag2_storage::StorageOptions & storage_options, 26 | const std::vector> & fake_messages, 27 | size_t split_every); 28 | 29 | #endif // ROSBAG2_CPP__FAKE_DATA_HPP_ 30 | -------------------------------------------------------------------------------- /rosbag2_performance/rosbag2_performance_benchmarking/config/benchmarks/default_benchmark_producers.yaml: -------------------------------------------------------------------------------- 1 | rosbag2_performance_benchmarking: 2 | benchmark_node: 3 | ros__parameters: 4 | benchmark: 5 | summary_result_file: "results.csv" 6 | bag_root_folder: "/tmp/rosbag2_performance_default" 7 | repeat_each: 1 # How many times to run each configurations (to average results) 8 | no_transport: False # Whether to run storage-only or end-to-end (including transport) benchmark 9 | preserve_bags: False # Whether to leave bag files after experiment (and between runs). Some configurations can take lots of space! 10 | producers_cpu_affinity: [0, 1] # CPU affinity for producers 11 | recorder_cpu_affinity: [2, 3] # CPU affinity for recorder 12 | parameters: # Each combination of parameters in this section will be benchmarked 13 | storage_id: ["mcap", "sqlite3"] 14 | max_cache_size: [100000000, 500000000] 15 | max_bag_size: [0, 1000000000] 16 | compression: [""] 17 | compression_queue_size: [1] 18 | compression_threads: [0] 19 | storage_config_file: [""] 20 | -------------------------------------------------------------------------------- /rosbag2_interfaces/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.20) 2 | project(rosbag2_interfaces) 3 | 4 | if(NOT CMAKE_CXX_STANDARD) 5 | set(CMAKE_CXX_STANDARD 17) 6 | set(CMAKE_CXX_STANDARD_REQUIRED ON) 7 | endif() 8 | if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") 9 | add_compile_options(-Wall -Wextra -Wpedantic) 10 | endif() 11 | 12 | find_package(ament_cmake REQUIRED) 13 | find_package(builtin_interfaces REQUIRED) 14 | find_package(rosidl_default_generators REQUIRED) 15 | 16 | rosidl_generate_interfaces(${PROJECT_NAME} 17 | "msg/ReadSplitEvent.msg" 18 | "msg/WriteSplitEvent.msg" 19 | "msg/MessagesLostEventTopicStat.msg" 20 | "msg/MessagesLostEvent.msg" 21 | "srv/Burst.srv" 22 | "srv/GetRate.srv" 23 | "srv/IsPaused.srv" 24 | "srv/Pause.srv" 25 | "srv/Play.srv" 26 | "srv/PlayNext.srv" 27 | "srv/Resume.srv" 28 | "srv/Seek.srv" 29 | "srv/SetRate.srv" 30 | "srv/Snapshot.srv" 31 | "srv/SplitBagfile.srv" 32 | "srv/Stop.srv" 33 | "srv/TogglePaused.srv" 34 | DEPENDENCIES builtin_interfaces 35 | ADD_LINTER_TESTS 36 | ) 37 | ament_export_dependencies(rosidl_default_runtime) 38 | 39 | if(BUILD_TESTING) 40 | find_package(ament_lint_auto REQUIRED) 41 | ament_lint_auto_find_test_dependencies() 42 | endif() 43 | 44 | ament_package() 45 | -------------------------------------------------------------------------------- /rosbag2_storage_sqlite3/README.md: -------------------------------------------------------------------------------- 1 | # rosbag2_storage_sqlite3 2 | 3 | Storage implementation plugin for rosbag2 providing SQLite3 `.db3` files as the bag storage backend. 4 | 5 | 6 | ## Storage Configuration File 7 | 8 | The `--storage-config-file` option for this plugin takes files in the following format: 9 | 10 | ``` 11 | read: 12 | pragmas: 13 | write: 14 | pragmas: 15 | ``` 16 | 17 | By default, SQLite settings are significantly optimized for performance. 18 | This might have consequences of bag data being corrupted after an application or system-level crash. 19 | This consideration only applies to current bagfile in case bag splitting is on (through `--max-bag-*` parameters). 20 | If increased crash-caused corruption resistance is necessary, use `resilient` option for `--storage-preset-profile` setting. 21 | 22 | Settings are fully exposed to the user and should be applied with understanding. 23 | Please refer to [documentation of pragmas](https://www.sqlite.org/pragma.html). 24 | 25 | An example configuration file could look like this: 26 | 27 | ``` 28 | write: 29 | pragmas: ["journal_mode = MEMORY", "synchronous = OFF", "schema.cache_size = 1000", "schema.page_size = 4096"] 30 | 31 | ``` 32 | -------------------------------------------------------------------------------- /ros2bag/test/resources/empty_bag/metadata.yaml: -------------------------------------------------------------------------------- 1 | rosbag2_bagfile_information: 2 | version: 4 3 | storage_identifier: sqlite3 4 | relative_file_paths: 5 | - empty_bag_0.db3 6 | duration: 7 | nanoseconds: 0 8 | starting_time: 9 | nanoseconds_since_epoch: 9223372036854775807 10 | message_count: 0 11 | topics_with_message_count: 12 | - topic_metadata: 13 | name: /parameter_events 14 | type: rcl_interfaces/msg/ParameterEvent 15 | serialization_format: cdr 16 | offered_qos_profiles: "- history: 3\n depth: 0\n reliability: 1\n durability: 2\n deadline:\n sec: 0\n nsec: 0\n lifespan:\n sec: 0\n nsec: 0\n liveliness: 1\n liveliness_lease_duration:\n sec: 0\n nsec: 0\n avoid_ros_namespace_conventions: false" 17 | message_count: 0 18 | - topic_metadata: 19 | name: /rosout 20 | type: rcl_interfaces/msg/Log 21 | serialization_format: cdr 22 | offered_qos_profiles: "- history: 3\n depth: 0\n reliability: 1\n durability: 1\n deadline:\n sec: 0\n nsec: 0\n lifespan:\n sec: 10\n nsec: 0\n liveliness: 1\n liveliness_lease_duration:\n sec: 0\n nsec: 0\n avoid_ros_namespace_conventions: false" 23 | message_count: 0 24 | compression_format: "" 25 | compression_mode: "" 26 | -------------------------------------------------------------------------------- /rosbag2_py/rosbag2_py/_compression_options.pyi: -------------------------------------------------------------------------------- 1 | from typing import ClassVar 2 | 3 | FILE: CompressionMode 4 | MESSAGE: CompressionMode 5 | NONE: CompressionMode 6 | 7 | class CompressionMode: 8 | __members__: ClassVar[dict] = ... # read-only 9 | FILE: ClassVar[CompressionMode] = ... 10 | MESSAGE: ClassVar[CompressionMode] = ... 11 | NONE: ClassVar[CompressionMode] = ... 12 | __entries: ClassVar[dict] = ... 13 | def __init__(self, value: int) -> None: ... 14 | def __eq__(self, other: object) -> bool: ... 15 | def __hash__(self) -> int: ... 16 | def __index__(self) -> int: ... 17 | def __int__(self) -> int: ... 18 | def __ne__(self, other: object) -> bool: ... 19 | @property 20 | def name(self) -> str: ... 21 | @property 22 | def value(self) -> int: ... 23 | 24 | class CompressionOptions: 25 | compression_format: str 26 | compression_mode: CompressionMode 27 | compression_queue_size: int 28 | compression_threads: int 29 | def __init__(self, compression_format: str = ..., compression_mode: CompressionMode = ..., compression_queue_size: int = ..., compression_threads: int = ...) -> None: ... 30 | 31 | def compression_mode_from_string(arg0: str) -> CompressionMode: ... 32 | def compression_mode_to_string(arg0: CompressionMode) -> str: ... 33 | -------------------------------------------------------------------------------- /rosbag2_storage_sqlite3/package.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | rosbag2_storage_sqlite3 4 | 0.33.0 5 | ROSBag2 SQLite3 storage plugin 6 | Michael Orlov 7 | Geoffrey Biggs 8 | Michel Hidalgo 9 | Emerson Knapp 10 | ROS Tooling Working Group 11 | Apache License 2.0 12 | 13 | ament_cmake 14 | ament_cmake_python 15 | 16 | pluginlib 17 | rcpputils 18 | rcutils 19 | rosbag2_storage 20 | libsqlite3-dev 21 | yaml-cpp 22 | 23 | ament_lint_auto 24 | ament_lint_common 25 | ament_cmake_gmock 26 | rosbag2_test_common 27 | std_msgs 28 | 29 | 30 | ament_cmake 31 | 32 | 33 | -------------------------------------------------------------------------------- /rosbag2_tests/cmake/skip_ros1_tests_if_necessary.cmake: -------------------------------------------------------------------------------- 1 | # Copyright 2018, Bosch Software Innovations GmbH. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | # Macro to set variable SKIP_ROS1_TESTS if ros1 is not installed 16 | # Some end to end tests rely on the plugin to read rosbags from ROS 1. 17 | # Those tests should be marked with SKIP_ROS1_TESTS and will be skipped if the 18 | # plugin is not available 19 | 20 | macro(skip_ros1_tests_if_necessary) 21 | find_package(ros1_bridge QUIET) 22 | if(ros1_bridge_FOUND) 23 | find_ros1_package(roscpp) 24 | if(ros1_roscpp_FOUND) 25 | return() 26 | endif() 27 | endif() 28 | 29 | set(SKIP_ROS1_TESTS "SKIP_TEST") 30 | message(STATUS 31 | "Skipping build of tests for rosbag_v2 plugin. ROS 1 not found") 32 | endmacro() 33 | -------------------------------------------------------------------------------- /rosbag2_tests/resources/sqlite3/wrong_rmw_test/metadata.yaml: -------------------------------------------------------------------------------- 1 | rosbag2_bagfile_information: 2 | version: 4 3 | storage_identifier: sqlite3 4 | relative_file_paths: 5 | - wrong_rmw_test_0.db3 6 | duration: 7 | nanoseconds: 151137181 8 | starting_time: 9 | nanoseconds_since_epoch: 1586406456763032325 10 | message_count: 7 11 | topics_with_message_count: 12 | - topic_metadata: 13 | name: /test_topic 14 | type: test_msgs/msg/BasicTypes 15 | serialization_format: wrong_format 16 | offered_qos_profiles: "- history: 3\n depth: 0\n reliability: 1\n durability: 2\n deadline:\n sec: 0\n nsec: 0\n lifespan:\n sec: 0\n nsec: 0\n liveliness: 1\n liveliness_lease_duration:\n sec: 0\n nsec: 0\n avoid_ros_namespace_conventions: false" 17 | message_count: 3 18 | - topic_metadata: 19 | name: /array_topic 20 | type: test_msgs/msg/Arrays 21 | serialization_format: wrong_format 22 | offered_qos_profiles: "- history: 3\n depth: 0\n reliability: 1\n durability: 2\n deadline:\n sec: 0\n nsec: 0\n lifespan:\n sec: 0\n nsec: 0\n liveliness: 1\n liveliness_lease_duration:\n sec: 0\n nsec: 0\n avoid_ros_namespace_conventions: false" 23 | message_count: 4 24 | compression_format: "" 25 | compression_mode: "" 26 | -------------------------------------------------------------------------------- /rosbag2_storage/include/rosbag2_storage/ros_helper.hpp: -------------------------------------------------------------------------------- 1 | // Copyright 2018 Open Source Robotics Foundation, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef ROSBAG2_STORAGE__ROS_HELPER_HPP_ 16 | #define ROSBAG2_STORAGE__ROS_HELPER_HPP_ 17 | 18 | #include 19 | 20 | #include "rcutils/types/uint8_array.h" 21 | 22 | #include "rosbag2_storage/visibility_control.hpp" 23 | 24 | namespace rosbag2_storage 25 | { 26 | 27 | ROSBAG2_STORAGE_PUBLIC 28 | std::shared_ptr 29 | make_serialized_message(const void * data, size_t size); 30 | 31 | ROSBAG2_STORAGE_PUBLIC 32 | std::shared_ptr 33 | make_empty_serialized_message(size_t size); 34 | 35 | } // namespace rosbag2_storage 36 | 37 | #endif // ROSBAG2_STORAGE__ROS_HELPER_HPP_ 38 | -------------------------------------------------------------------------------- /rosbag2/package.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | rosbag2 4 | 0.33.0 5 | Meta package for rosbag2 related packages 6 | Michael Orlov 7 | Geoffrey Biggs 8 | Michel Hidalgo 9 | Emerson Knapp 10 | ROS Tooling Working Group 11 | Apache License 2.0 12 | 13 | ament_cmake 14 | 15 | ros2bag 16 | rosbag2_compression 17 | rosbag2_cpp 18 | rosbag2_py 19 | rosbag2_storage 20 | rosbag2_transport 21 | 22 | 23 | rosbag2_compression_zstd 24 | rosbag2_storage_default_plugins 25 | 26 | rosbag2_test_common 27 | rosbag2_tests 28 | 29 | 30 | ament_cmake 31 | 32 | 33 | -------------------------------------------------------------------------------- /rosbag2_cpp/test/rosbag2_cpp/serializer_test_plugin.cpp: -------------------------------------------------------------------------------- 1 | // Copyright 2018, Bosch Software Innovations GmbH. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include "serializer_test_plugin.hpp" 16 | 17 | #include 18 | 19 | void SerializerTestPlugin::serialize( 20 | const std::shared_ptr ros_message, 21 | const rosidl_message_type_support_t * type_support, 22 | std::shared_ptr serialized_message) 23 | { 24 | (void) serialized_message; 25 | (void) ros_message; 26 | (void) type_support; 27 | } 28 | 29 | #include "pluginlib/class_list_macros.hpp" // NOLINT 30 | PLUGINLIB_EXPORT_CLASS( 31 | SerializerTestPlugin, 32 | rosbag2_cpp::converter_interfaces::SerializationFormatSerializer) 33 | -------------------------------------------------------------------------------- /rosbag2_examples/rosbag2_examples_py/setup.py: -------------------------------------------------------------------------------- 1 | from setuptools import setup 2 | 3 | package_name = 'rosbag2_examples_py' 4 | 5 | setup( 6 | name=package_name, 7 | version='0.33.0', 8 | packages=[package_name], 9 | data_files=[ 10 | ('share/ament_index/resource_index/packages', 11 | ['resource/' + package_name]), 12 | ('share/' + package_name, ['package.xml']), 13 | ], 14 | install_requires=['setuptools'], 15 | zip_safe=True, 16 | maintainer='geoff', 17 | maintainer_email='gbiggs@killbots.net', 18 | description='TODO: Package description', 19 | license='TODO: License declaration', 20 | extras_require={ 21 | 'test': [ 22 | 'pytest', 23 | ], 24 | }, 25 | entry_points={ 26 | 'console_scripts': [ 27 | 'rosbag2csv = rosbag2_examples_py.rosbag2csv:main', 28 | 'simple_bag_recorder = rosbag2_examples_py.simple_bag_recorder:main', 29 | 'simple_bag_reader = rosbag2_examples_py.simple_bag_reader:main', 30 | 'data_generator_node = rosbag2_examples_py.data_generator_node:main', 31 | 'data_generator_executable = rosbag2_examples_py.data_generator_executable:main', 32 | 'compressed_bag_recorder = rosbag2_examples_py.compressed_bag_recorder:main', 33 | ], 34 | }, 35 | ) 36 | -------------------------------------------------------------------------------- /rosbag2_compression_zstd/package.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | rosbag2_compression_zstd 5 | 0.33.0 6 | Zstandard compression library implementation of rosbag2_compression 7 | Michael Orlov 8 | Geoffrey Biggs 9 | Michel Hidalgo 10 | ROS 2 Tooling WG 11 | Apache 2.0 12 | 13 | Emerson Knapp 14 | 15 | ament_cmake 16 | 17 | pluginlib 18 | rcutils 19 | rosbag2_compression 20 | zstd_cmake_module 21 | 22 | ament_cmake_gmock 23 | ament_lint_auto 24 | ament_lint_common 25 | rclcpp 26 | rosbag2_test_common 27 | 28 | 29 | ament_cmake 30 | 31 | 32 | -------------------------------------------------------------------------------- /rosbag2_interfaces/package.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | rosbag2_interfaces 5 | 0.33.0 6 | Interface definitions for controlling rosbag2 7 | Michael Orlov 8 | Geoffrey Biggs 9 | Michel Hidalgo 10 | Emerson Knapp 11 | ROS Tooling Working Group 12 | Apache License 2.0 13 | 14 | ament_cmake 15 | rosidl_default_generators 16 | 17 | builtin_interfaces 18 | 19 | builtin_interfaces 20 | rosidl_default_runtime 21 | 22 | ament_lint_auto 23 | ament_lint_common 24 | 25 | rosidl_interface_packages 26 | 27 | 28 | ament_cmake 29 | 30 | 31 | -------------------------------------------------------------------------------- /rosbag2_performance/rosbag2_performance_benchmarking/include/rosbag2_performance_benchmarking/publisher_group_config.hpp: -------------------------------------------------------------------------------- 1 | // Copyright 2020-2021, Robotec.ai sp. z o.o. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef ROSBAG2_PERFORMANCE_BENCHMARKING__PUBLISHER_GROUP_CONFIG_HPP_ 16 | #define ROSBAG2_PERFORMANCE_BENCHMARKING__PUBLISHER_GROUP_CONFIG_HPP_ 17 | 18 | #include 19 | #include "rosbag2_performance_benchmarking/producer_config.hpp" 20 | #include "rclcpp/qos.hpp" 21 | 22 | struct PublisherGroupConfig 23 | { 24 | PublisherGroupConfig() 25 | : count(0), qos(10) {} 26 | unsigned int count; 27 | ProducerConfig producer_config; 28 | std::string topic_root; 29 | rclcpp::QoS qos; 30 | }; 31 | 32 | #endif // ROSBAG2_PERFORMANCE_BENCHMARKING__PUBLISHER_GROUP_CONFIG_HPP_ 33 | -------------------------------------------------------------------------------- /rosbag2_cpp/test/rosbag2_cpp/mock_cache_consumer.hpp: -------------------------------------------------------------------------------- 1 | // Copyright 2020, Robotec.ai sp. z o.o. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef ROSBAG2_CPP__MOCK_CACHE_CONSUMER_HPP_ 16 | #define ROSBAG2_CPP__MOCK_CACHE_CONSUMER_HPP_ 17 | 18 | #include 19 | #include 20 | 21 | #include "mock_message_cache.hpp" 22 | #include "rosbag2_cpp/cache/cache_consumer.hpp" 23 | 24 | class MockCacheConsumer : public rosbag2_cpp::cache::CacheConsumer 25 | { 26 | public: 27 | MockCacheConsumer( 28 | std::shared_ptr message_cache, 29 | rosbag2_cpp::cache::CacheConsumer::consume_callback_function_t consume_callback) 30 | : rosbag2_cpp::cache::CacheConsumer(message_cache, consume_callback) {} 31 | }; 32 | 33 | #endif // ROSBAG2_CPP__MOCK_CACHE_CONSUMER_HPP_ 34 | -------------------------------------------------------------------------------- /rosbag2_storage_mcap/package.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | rosbag2_storage_mcap 5 | 0.33.0 6 | rosbag2 storage plugin using the MCAP file format 7 | Foxglove 8 | Michael Orlov 9 | ROS Tooling Working Group 10 | Apache-2.0 11 | 12 | ament_cmake 13 | ament_cmake_python 14 | 15 | ament_index_cpp 16 | mcap_vendor 17 | pluginlib 18 | rcutils 19 | rosbag2_storage 20 | yaml_cpp_vendor 21 | 22 | ament_cmake_clang_format 23 | ament_cmake_gmock 24 | ament_lint_auto 25 | ament_lint_common 26 | rosbag2_test_common 27 | std_msgs 28 | 29 | 30 | ament_cmake 31 | 32 | 33 | -------------------------------------------------------------------------------- /rosbag2_py/src/rosbag2_py/format_bag_metadata.hpp: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2021, Bosch Software Innovations GmbH. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef ROSBAG2_PY__FORMAT_BAG_METADATA_HPP_ 16 | #define ROSBAG2_PY__FORMAT_BAG_METADATA_HPP_ 17 | 18 | #include 19 | #include 20 | 21 | #include "info_sorting_method.hpp" 22 | #include "rosbag2_storage/bag_metadata.hpp" 23 | 24 | namespace rosbag2_py 25 | { 26 | 27 | std::string format_bag_meta_data( 28 | const rosbag2_storage::BagMetadata & metadata, 29 | const std::unordered_map & messages_size = {}, 30 | bool verbose = false, 31 | bool only_topic = false, 32 | InfoSortingMethod sort_method = InfoSortingMethod::NAME); 33 | 34 | } // namespace rosbag2_py 35 | 36 | #endif // ROSBAG2_PY__FORMAT_BAG_METADATA_HPP_ 37 | -------------------------------------------------------------------------------- /rosbag2_compression/package.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | rosbag2_compression 5 | 0.33.0 6 | Compression implementations for rosbag2 bags and messages. 7 | Michael Orlov 8 | Geoffrey Biggs 9 | Michel Hidalgo 10 | Emerson Knapp 11 | ROS Tooling Working Group 12 | Apache License 2.0 13 | 14 | ament_cmake 15 | 16 | rcpputils 17 | rcutils 18 | rosbag2_cpp 19 | rosbag2_storage 20 | 21 | ament_cmake_gmock 22 | ament_lint_auto 23 | ament_lint_common 24 | rclcpp 25 | test_msgs 26 | rosbag2_test_common 27 | 28 | 29 | ament_cmake 30 | 31 | 32 | -------------------------------------------------------------------------------- /rosbag2_performance/rosbag2_performance_benchmarking/include/msg_utils/helpers.hpp: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Apex.AI, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef MSG_UTILS__HELPERS_HPP_ 16 | #define MSG_UTILS__HELPERS_HPP_ 17 | 18 | #include 19 | #include 20 | #include 21 | 22 | namespace msg_utils 23 | { 24 | namespace helpers 25 | { 26 | void generate_data(rosbag2_performance_benchmarking_msgs::msg::ByteArray & array, size_t size); 27 | 28 | // sensor messages 29 | void generate_data(sensor_msgs::msg::Image & msg, size_t size); 30 | void generate_data(sensor_msgs::msg::PointCloud2 & msg, size_t size); 31 | } // namespace helpers 32 | } // namespace msg_utils 33 | 34 | #endif // MSG_UTILS__HELPERS_HPP_ 35 | -------------------------------------------------------------------------------- /rosbag2_py/src/rosbag2_py/action_info.hpp: -------------------------------------------------------------------------------- 1 | // Copyright 2025 Open Source Robotics Foundation, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | 16 | #ifndef ROSBAG2_PY__ACTION_INFO_HPP_ 17 | #define ROSBAG2_PY__ACTION_INFO_HPP_ 18 | 19 | #include 20 | 21 | namespace rosbag2_py 22 | { 23 | 24 | struct ActionMetadata 25 | { 26 | std::string name; 27 | std::string type; 28 | std::string serialization_format; 29 | }; 30 | 31 | struct ActionInformation 32 | { 33 | ActionMetadata action_metadata; 34 | size_t send_goal_event_message_count = 0; 35 | size_t cancel_goal_event_message_count = 0; 36 | size_t get_result_event_message_count = 0; 37 | size_t feedback_message_count = 0; 38 | size_t status_message_count = 0; 39 | }; 40 | 41 | } // namespace rosbag2_py 42 | 43 | #endif // ROSBAG2_PY__ACTION_INFO_HPP_ 44 | -------------------------------------------------------------------------------- /rosbag2_cpp/test/rosbag2_cpp/serializer_test_plugin.hpp: -------------------------------------------------------------------------------- 1 | // Copyright 2018, Bosch Software Innovations GmbH. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef ROSBAG2_CPP__SERIALIZER_TEST_PLUGIN_HPP_ 16 | #define ROSBAG2_CPP__SERIALIZER_TEST_PLUGIN_HPP_ 17 | 18 | #include 19 | 20 | #include "rosbag2_cpp/converter_interfaces/serialization_format_serializer.hpp" 21 | 22 | class SerializerTestPlugin 23 | : public rosbag2_cpp::converter_interfaces::SerializationFormatSerializer 24 | { 25 | public: 26 | void serialize( 27 | std::shared_ptr ros_message, 28 | const rosidl_message_type_support_t * type_support, 29 | std::shared_ptr serialized_message) override; 30 | }; 31 | 32 | #endif // ROSBAG2_CPP__SERIALIZER_TEST_PLUGIN_HPP_ 33 | -------------------------------------------------------------------------------- /rosbag2_py/src/rosbag2_py/format_action_info.hpp: -------------------------------------------------------------------------------- 1 | // Copyright 2025 Sony Group Corporation. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef ROSBAG2_PY__FORMAT_ACTION_INFO_HPP_ 16 | #define ROSBAG2_PY__FORMAT_ACTION_INFO_HPP_ 17 | 18 | #include 19 | #include 20 | #include 21 | #include 22 | 23 | #include "info_sorting_method.hpp" 24 | #include "rosbag2_cpp/info.hpp" 25 | 26 | namespace rosbag2_py 27 | { 28 | 29 | std::string format_action_info( 30 | std::vector> & action_info, 31 | const std::unordered_map & messages_size, 32 | bool verbose = false, 33 | const InfoSortingMethod sort_method = InfoSortingMethod::NAME); 34 | 35 | } // namespace rosbag2_py 36 | 37 | #endif // ROSBAG2_PY__FORMAT_ACTION_INFO_HPP_ 38 | -------------------------------------------------------------------------------- /rosbag2_cpp/test/rosbag2_cpp/mock_metadata_io.hpp: -------------------------------------------------------------------------------- 1 | // Copyright 2018, Bosch Software Innovations GmbH. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef ROSBAG2_CPP__MOCK_METADATA_IO_HPP_ 16 | #define ROSBAG2_CPP__MOCK_METADATA_IO_HPP_ 17 | 18 | #include 19 | 20 | #include 21 | #include 22 | #include 23 | 24 | #include "rosbag2_storage/bag_metadata.hpp" 25 | #include "rosbag2_storage/metadata_io.hpp" 26 | 27 | class MockMetadataIo : public rosbag2_storage::MetadataIo 28 | { 29 | public: 30 | MOCK_METHOD2(write_metadata, void(const std::string &, const rosbag2_storage::BagMetadata &)); 31 | MOCK_METHOD1(read_metadata, rosbag2_storage::BagMetadata(const std::string &)); 32 | MOCK_METHOD1(metadata_file_exists, bool(const std::string &)); 33 | }; 34 | 35 | #endif // ROSBAG2_CPP__MOCK_METADATA_IO_HPP_ 36 | -------------------------------------------------------------------------------- /rosbag2_py/src/rosbag2_py/format_service_info.hpp: -------------------------------------------------------------------------------- 1 | // Copyright 2023 Sony Group Corporation. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef ROSBAG2_PY__FORMAT_SERVICE_INFO_HPP_ 16 | #define ROSBAG2_PY__FORMAT_SERVICE_INFO_HPP_ 17 | 18 | #include 19 | #include 20 | #include 21 | #include 22 | 23 | #include "info_sorting_method.hpp" 24 | #include "rosbag2_cpp/info.hpp" 25 | 26 | namespace rosbag2_py 27 | { 28 | 29 | std::string format_service_info( 30 | std::vector> & service_info, 31 | const std::unordered_map & messages_size = {}, 32 | bool verbose = false, 33 | const InfoSortingMethod sort_method = InfoSortingMethod::NAME); 34 | 35 | } // namespace rosbag2_py 36 | 37 | #endif // ROSBAG2_PY__FORMAT_SERVICE_INFO_HPP_ 38 | -------------------------------------------------------------------------------- /rosbag2_storage/test/rosbag2_storage/test_constants.hpp: -------------------------------------------------------------------------------- 1 | // Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | 16 | #ifndef ROSBAG2_STORAGE__TEST_CONSTANTS_HPP_ 17 | #define ROSBAG2_STORAGE__TEST_CONSTANTS_HPP_ 18 | 19 | namespace test_constants 20 | { 21 | constexpr const char * const READ_WRITE_PLUGIN_EXTENSION = ".rwplugin"; 22 | constexpr const char * const READ_ONLY_PLUGIN_EXTENSION = ".roplugin"; 23 | constexpr const char * const READ_WRITE_PLUGIN_IDENTIFIER = "my_test_plugin"; 24 | constexpr const char * const READ_ONLY_PLUGIN_IDENTIFIER = "my_read_only_test_plugin"; 25 | constexpr const char * const DUMMY_FILEPATH = "/path/to/storage"; 26 | constexpr const uint64_t MAX_BAGFILE_SIZE = 0; 27 | constexpr const uint64_t MIN_SPLIT_FILE_SIZE = UINT64_MAX; 28 | } 29 | 30 | #endif // ROSBAG2_STORAGE__TEST_CONSTANTS_HPP_ 31 | -------------------------------------------------------------------------------- /rosbag2_compression/test/rosbag2_compression/mock_metadata_io.hpp: -------------------------------------------------------------------------------- 1 | // Copyright 2018, Bosch Software Innovations GmbH. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef ROSBAG2_COMPRESSION__MOCK_METADATA_IO_HPP_ 16 | #define ROSBAG2_COMPRESSION__MOCK_METADATA_IO_HPP_ 17 | 18 | #include 19 | 20 | #include 21 | #include 22 | #include 23 | 24 | #include "rosbag2_storage/bag_metadata.hpp" 25 | #include "rosbag2_storage/metadata_io.hpp" 26 | 27 | class MockMetadataIo : public rosbag2_storage::MetadataIo 28 | { 29 | public: 30 | MOCK_METHOD2(write_metadata, void(const std::string &, const rosbag2_storage::BagMetadata &)); 31 | MOCK_METHOD1(read_metadata, rosbag2_storage::BagMetadata(const std::string &)); 32 | MOCK_METHOD1(metadata_file_exists, bool(const std::string &)); 33 | }; 34 | 35 | #endif // ROSBAG2_COMPRESSION__MOCK_METADATA_IO_HPP_ 36 | -------------------------------------------------------------------------------- /rosbag2_performance/rosbag2_performance_benchmarking/src/results_writer.cpp: -------------------------------------------------------------------------------- 1 | // Copyright 2021, Robotec.ai sp. z o.o. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include 16 | 17 | #include "rclcpp/executors/single_threaded_executor.hpp" 18 | #include "rclcpp/node.hpp" 19 | #include "rosbag2_performance_benchmarking/result_utils.hpp" 20 | 21 | int main(int argc, char * argv[]) 22 | { 23 | rclcpp::init(argc, argv); 24 | auto results_writer_node = std::make_shared( 25 | "benchmarking_results_writer"); 26 | 27 | rclcpp::executors::SingleThreadedExecutor executor; 28 | executor.add_node(results_writer_node); 29 | 30 | // The benchmark uses spinning for parameters 31 | std::thread spin_thread([&executor]() {executor.spin();}); 32 | result_utils::write_benchmark_results(*results_writer_node); 33 | rclcpp::shutdown(); 34 | spin_thread.join(); 35 | 36 | return 0; 37 | } 38 | -------------------------------------------------------------------------------- /rosbag2_compression/test/rosbag2_compression/fake_decompressor.cpp: -------------------------------------------------------------------------------- 1 | // Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include 16 | #include 17 | 18 | #include "pluginlib/class_list_macros.hpp" 19 | 20 | #include "fake_decompressor.hpp" 21 | 22 | namespace fs = std::filesystem; 23 | 24 | std::string FakeDecompressor::decompress_uri(const std::string & uri) 25 | { 26 | auto uri_path = fs::path{uri}; 27 | const auto decompressed_path = uri_path.replace_extension(); 28 | return decompressed_path.generic_string(); 29 | } 30 | 31 | void FakeDecompressor::decompress_serialized_bag_message( 32 | rosbag2_storage::SerializedBagMessage *) {} 33 | 34 | std::string FakeDecompressor::get_decompression_identifier() const 35 | { 36 | return "fake_comp"; 37 | } 38 | 39 | PLUGINLIB_EXPORT_CLASS(FakeDecompressor, rosbag2_compression::BaseDecompressorInterface) 40 | -------------------------------------------------------------------------------- /rosbag2_py/src/rosbag2_py/format_utils.cpp: -------------------------------------------------------------------------------- 1 | // Copyright 2025 Sony Group Corporation. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include 16 | #include 17 | #include 18 | #include 19 | 20 | #include "format_utils.hpp" 21 | 22 | namespace rosbag2_py 23 | { 24 | std::string format_file_size(uint64_t file_size) 25 | { 26 | double size = static_cast(file_size); 27 | static const char * units[] = {"B", "KiB", "MiB", "GiB", "TiB"}; 28 | double reference_number_bytes = 1024; 29 | int index = 0; 30 | while (size >= reference_number_bytes && index < 4) { 31 | size /= reference_number_bytes; 32 | index++; 33 | } 34 | 35 | std::stringstream rounded_size; 36 | int size_format_precision = index == 0 ? 0 : 1; 37 | rounded_size << std::setprecision(size_format_precision) << std::fixed << size; 38 | return rounded_size.str() + " " + units[index]; 39 | } 40 | } // namespace rosbag2_py 41 | -------------------------------------------------------------------------------- /rosbag2_py/rosbag2_py/_reader.pyi: -------------------------------------------------------------------------------- 1 | class SequentialCompressionReader: 2 | def __init__(self) -> None: ... 3 | def close(self) -> None: ... 4 | def get_all_message_definitions(self, *args, **kwargs): ... 5 | def get_all_topics_and_types(self, *args, **kwargs): ... 6 | def get_metadata(self, *args, **kwargs): ... 7 | def has_next(self) -> bool: ... 8 | def open(self, arg0, arg1) -> None: ... 9 | def open_uri(self, arg0: str) -> None: ... 10 | def read_next(self) -> tuple: ... 11 | def read_next_ext(self) -> tuple: ... 12 | def reset_filter(self) -> None: ... 13 | def seek(self, arg0: int) -> None: ... 14 | def set_filter(self, arg0) -> None: ... 15 | def set_read_order(self, arg0) -> bool: ... 16 | 17 | class SequentialReader: 18 | def __init__(self) -> None: ... 19 | def close(self) -> None: ... 20 | def get_all_message_definitions(self, *args, **kwargs): ... 21 | def get_all_topics_and_types(self, *args, **kwargs): ... 22 | def get_metadata(self, *args, **kwargs): ... 23 | def has_next(self) -> bool: ... 24 | def open(self, arg0, arg1) -> None: ... 25 | def open_uri(self, arg0: str) -> None: ... 26 | def read_next(self) -> tuple: ... 27 | def read_next_ext(self) -> tuple: ... 28 | def reset_filter(self) -> None: ... 29 | def seek(self, arg0: int) -> None: ... 30 | def set_filter(self, arg0) -> None: ... 31 | def set_read_order(self, arg0) -> bool: ... 32 | 33 | def get_registered_readers() -> Set[str]: ... 34 | -------------------------------------------------------------------------------- /ros2bag/ros2bag/command/bag.py: -------------------------------------------------------------------------------- 1 | # Copyright 2018 Open Source Robotics Foundation, Inc. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from ros2cli.command import add_subparsers_on_demand 16 | from ros2cli.command import CommandExtension 17 | 18 | 19 | class BagCommand(CommandExtension): 20 | """Various rosbag related sub-commands.""" 21 | 22 | def add_arguments(self, parser, cli_name): 23 | self._subparser = parser 24 | 25 | # get verb extensions and let them add their arguments 26 | add_subparsers_on_demand( 27 | parser, cli_name, '_verb', 'ros2bag.verb', required=False) 28 | 29 | def main(self, *, parser, args): 30 | if not hasattr(args, '_verb'): 31 | # in case no verb was passed 32 | self._subparser.print_help() 33 | return 0 34 | 35 | extension = getattr(args, '_verb') 36 | 37 | # call the verb's main method 38 | return extension.main(args=args) 39 | -------------------------------------------------------------------------------- /rosbag2_compression/test/rosbag2_compression/mock_compression_factory.hpp: -------------------------------------------------------------------------------- 1 | // Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef ROSBAG2_COMPRESSION__MOCK_COMPRESSION_FACTORY_HPP_ 16 | #define ROSBAG2_COMPRESSION__MOCK_COMPRESSION_FACTORY_HPP_ 17 | 18 | #include 19 | 20 | #include 21 | #include 22 | 23 | #include "rosbag2_compression/compression_factory.hpp" 24 | 25 | class MockCompressionFactory : public rosbag2_compression::CompressionFactory 26 | { 27 | public: 28 | MOCK_METHOD1( 29 | create_compressor, 30 | std::shared_ptr( 31 | const std::string &)); 32 | 33 | MOCK_METHOD1( 34 | create_decompressor, 35 | std::shared_ptr( 36 | const std::string &)); 37 | }; 38 | 39 | #endif // ROSBAG2_COMPRESSION__MOCK_COMPRESSION_FACTORY_HPP_ 40 | -------------------------------------------------------------------------------- /ros2bag/ros2bag/verb/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2018 Open Source Robotics Foundation, Inc. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from ros2cli.plugin_system import PLUGIN_SYSTEM_VERSION 16 | from ros2cli.plugin_system import satisfies_version 17 | 18 | 19 | class VerbExtension: 20 | """ 21 | The extension point for 'bag' verb extensions. 22 | 23 | The following properties must be defined: 24 | * `NAME` (will be set to the entry point name) 25 | 26 | The following methods must be defined: 27 | * `main` 28 | 29 | The following methods can be defined: 30 | * `add_arguments` 31 | """ 32 | 33 | NAME = None 34 | EXTENSION_POINT_VERSION = '0.1' 35 | 36 | def __init__(self): 37 | super(VerbExtension, self).__init__() 38 | satisfies_version(PLUGIN_SYSTEM_VERSION, '^0.1') 39 | 40 | def add_arguments(self, parser, cli_name): 41 | pass 42 | 43 | def main(self, *, args): 44 | raise NotImplementedError() 45 | -------------------------------------------------------------------------------- /rosbag2_compression/test/rosbag2_compression/fake_decompressor.hpp: -------------------------------------------------------------------------------- 1 | // Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef ROSBAG2_COMPRESSION__FAKE_DECOMPRESSOR_HPP_ 16 | #define ROSBAG2_COMPRESSION__FAKE_DECOMPRESSOR_HPP_ 17 | 18 | #include 19 | 20 | #include "rosbag2_compression/base_decompressor_interface.hpp" 21 | #include "rosbag2_storage/serialized_bag_message.hpp" 22 | 23 | class FakeDecompressor : public rosbag2_compression::BaseDecompressorInterface 24 | { 25 | public: 26 | FakeDecompressor() = default; 27 | 28 | std::string decompress_uri(const std::string & uri) override; 29 | 30 | void decompress_serialized_bag_message( 31 | rosbag2_storage::SerializedBagMessage * bag_message) override; 32 | 33 | std::string get_decompression_identifier() const override; 34 | 35 | ~FakeDecompressor() override = default; 36 | }; 37 | 38 | 39 | #endif // ROSBAG2_COMPRESSION__FAKE_DECOMPRESSOR_HPP_ 40 | -------------------------------------------------------------------------------- /rosbag2_transport/include/rosbag2_transport/config_options_from_node_params.hpp: -------------------------------------------------------------------------------- 1 | // Copyright 2023 Open Source Robotics Foundation, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef ROSBAG2_TRANSPORT__CONFIG_OPTIONS_FROM_NODE_PARAMS_HPP_ 16 | #define ROSBAG2_TRANSPORT__CONFIG_OPTIONS_FROM_NODE_PARAMS_HPP_ 17 | 18 | #include 19 | 20 | #include "rclcpp/node.hpp" 21 | #include "rosbag2_transport/play_options.hpp" 22 | #include "rosbag2_transport/record_options.hpp" 23 | #include "rosbag2_storage/storage_options.hpp" 24 | 25 | namespace rosbag2_transport 26 | { 27 | rosbag2_transport::PlayOptions 28 | get_play_options_from_node_params(rclcpp::Node & node); 29 | 30 | rosbag2_transport::RecordOptions 31 | get_record_options_from_node_params(rclcpp::Node & node); 32 | 33 | rosbag2_storage::StorageOptions 34 | get_storage_options_from_node_params(rclcpp::Node & node); 35 | } // namespace rosbag2_transport 36 | 37 | #endif // ROSBAG2_TRANSPORT__CONFIG_OPTIONS_FROM_NODE_PARAMS_HPP_ 38 | -------------------------------------------------------------------------------- /rosbag2_tests/resources/mcap/wrong_rmw_test/metadata.yaml: -------------------------------------------------------------------------------- 1 | rosbag2_bagfile_information: 2 | version: 6 3 | storage_identifier: mcap 4 | duration: 5 | nanoseconds: 151137181 6 | starting_time: 7 | nanoseconds_since_epoch: 1586406456763032325 8 | message_count: 7 9 | topics_with_message_count: 10 | - topic_metadata: 11 | name: /array_topic 12 | type: test_msgs/msg/Arrays 13 | serialization_format: wrong_format 14 | offered_qos_profiles: "- history: 3\n depth: 0\n reliability: 1\n durability: 2\n deadline:\n sec: 0\n nsec: 0\n lifespan:\n sec: 0\n nsec: 0\n liveliness: 1\n liveliness_lease_duration:\n sec: 0\n nsec: 0\n avoid_ros_namespace_conventions: false" 15 | message_count: 4 16 | - topic_metadata: 17 | name: /test_topic 18 | type: test_msgs/msg/BasicTypes 19 | serialization_format: wrong_format 20 | offered_qos_profiles: "- history: 3\n depth: 0\n reliability: 1\n durability: 2\n deadline:\n sec: 0\n nsec: 0\n lifespan:\n sec: 0\n nsec: 0\n liveliness: 1\n liveliness_lease_duration:\n sec: 0\n nsec: 0\n avoid_ros_namespace_conventions: false" 21 | message_count: 3 22 | compression_format: "" 23 | compression_mode: "" 24 | relative_file_paths: 25 | - wrong_rmw_test_0.mcap 26 | files: 27 | - path: wrong_rmw_test_0.mcap 28 | starting_time: 29 | nanoseconds_since_epoch: 1586406456763032325 30 | duration: 31 | nanoseconds: 151137181 32 | message_count: 7 33 | custom_data: ~ -------------------------------------------------------------------------------- /rosbag2_test_common/package.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | rosbag2_test_common 5 | 0.33.0 6 | Commonly used test helper classes and fixtures for rosbag2 7 | Michael Orlov 8 | Geoffrey Biggs 9 | Michel Hidalgo 10 | Emerson Knapp 11 | ROS Tooling Working Group 12 | Apache License 2.0 13 | 14 | ament_cmake 15 | ament_cmake_python 16 | 17 | rclcpp 18 | rclcpp_action 19 | rcpputils 20 | rcutils 21 | test_msgs 22 | 23 | rclcpp 24 | rclcpp_action 25 | rcpputils 26 | rcutils 27 | test_msgs 28 | 29 | ament_lint_auto 30 | ament_lint_common 31 | 32 | 33 | ament_cmake 34 | 35 | 36 | -------------------------------------------------------------------------------- /rosbag2_py/test/resources/sqlite3/convert_b/metadata.yaml: -------------------------------------------------------------------------------- 1 | rosbag2_bagfile_information: 2 | version: 5 3 | storage_identifier: sqlite3 4 | duration: 5 | nanoseconds: 222000000 6 | starting_time: 7 | nanoseconds_since_epoch: 0 8 | message_count: 75 9 | topics_with_message_count: 10 | - topic_metadata: 11 | name: c_strings 12 | type: test_msgs/msg/Strings 13 | serialization_format: cdr 14 | offered_qos_profiles: "- history: 1\n depth: 1\n reliability: 1\n durability: 1\n deadline:\n sec: 9223372036\n nsec: 854775807\n lifespan:\n sec: 9223372036\n nsec: 854775807\n liveliness: 1\n liveliness_lease_duration:\n sec: 9223372036\n nsec: 854775807\n avoid_ros_namespace_conventions: false" 15 | message_count: 50 16 | - topic_metadata: 17 | name: a_empty 18 | type: test_msgs/msg/Empty 19 | serialization_format: cdr 20 | offered_qos_profiles: "- history: 1\n depth: 1\n reliability: 1\n durability: 1\n deadline:\n sec: 9223372036\n nsec: 854775807\n lifespan:\n sec: 9223372036\n nsec: 854775807\n liveliness: 1\n liveliness_lease_duration:\n sec: 9223372036\n nsec: 854775807\n avoid_ros_namespace_conventions: false" 21 | message_count: 25 22 | compression_format: "" 23 | compression_mode: "" 24 | relative_file_paths: 25 | - rewriter_b_0.db3 26 | files: 27 | - path: rewriter_b_0.db3 28 | starting_time: 29 | nanoseconds_since_epoch: 0 30 | duration: 31 | nanoseconds: 222000000 32 | message_count: 75 33 | -------------------------------------------------------------------------------- /rosbag2_transport/test/resources/sqlite3/rewriter_b/metadata.yaml: -------------------------------------------------------------------------------- 1 | rosbag2_bagfile_information: 2 | version: 5 3 | storage_identifier: sqlite3 4 | duration: 5 | nanoseconds: 222000000 6 | starting_time: 7 | nanoseconds_since_epoch: 0 8 | message_count: 75 9 | topics_with_message_count: 10 | - topic_metadata: 11 | name: c_strings 12 | type: test_msgs/msg/Strings 13 | serialization_format: cdr 14 | offered_qos_profiles: "- history: 1\n depth: 1\n reliability: 1\n durability: 1\n deadline:\n sec: 9223372036\n nsec: 854775807\n lifespan:\n sec: 9223372036\n nsec: 854775807\n liveliness: 1\n liveliness_lease_duration:\n sec: 9223372036\n nsec: 854775807\n avoid_ros_namespace_conventions: false" 15 | message_count: 50 16 | - topic_metadata: 17 | name: a_empty 18 | type: test_msgs/msg/Empty 19 | serialization_format: cdr 20 | offered_qos_profiles: "- history: 1\n depth: 1\n reliability: 1\n durability: 1\n deadline:\n sec: 9223372036\n nsec: 854775807\n lifespan:\n sec: 9223372036\n nsec: 854775807\n liveliness: 1\n liveliness_lease_duration:\n sec: 9223372036\n nsec: 854775807\n avoid_ros_namespace_conventions: false" 21 | message_count: 25 22 | compression_format: "" 23 | compression_mode: "" 24 | relative_file_paths: 25 | - rewriter_b_0.db3 26 | files: 27 | - path: rewriter_b_0.db3 28 | starting_time: 29 | nanoseconds_since_epoch: 0 30 | duration: 31 | nanoseconds: 222000000 32 | message_count: 75 33 | -------------------------------------------------------------------------------- /rosbag2_transport/test/resources/mcap/rewriter_b/metadata.yaml: -------------------------------------------------------------------------------- 1 | rosbag2_bagfile_information: 2 | version: 6 3 | storage_identifier: mcap 4 | duration: 5 | nanoseconds: 222000000 6 | starting_time: 7 | nanoseconds_since_epoch: 0 8 | message_count: 75 9 | topics_with_message_count: 10 | - topic_metadata: 11 | name: a_empty 12 | type: test_msgs/msg/Empty 13 | serialization_format: cdr 14 | offered_qos_profiles: "- history: 1\n depth: 1\n reliability: 1\n durability: 1\n deadline:\n sec: 9223372036\n nsec: 854775807\n lifespan:\n sec: 9223372036\n nsec: 854775807\n liveliness: 1\n liveliness_lease_duration:\n sec: 9223372036\n nsec: 854775807\n avoid_ros_namespace_conventions: false" 15 | message_count: 25 16 | - topic_metadata: 17 | name: c_strings 18 | type: test_msgs/msg/Strings 19 | serialization_format: cdr 20 | offered_qos_profiles: "- history: 1\n depth: 1\n reliability: 1\n durability: 1\n deadline:\n sec: 9223372036\n nsec: 854775807\n lifespan:\n sec: 9223372036\n nsec: 854775807\n liveliness: 1\n liveliness_lease_duration:\n sec: 9223372036\n nsec: 854775807\n avoid_ros_namespace_conventions: false" 21 | message_count: 50 22 | compression_format: "" 23 | compression_mode: "" 24 | relative_file_paths: 25 | - rewriter_b_0.mcap 26 | files: 27 | - path: rewriter_b_0.mcap 28 | starting_time: 29 | nanoseconds_since_epoch: 0 30 | duration: 31 | nanoseconds: 222000000 32 | message_count: 75 33 | custom_data: ~ -------------------------------------------------------------------------------- /rosbag2_tests/resources/mcap/cdr_test/metadata.yaml: -------------------------------------------------------------------------------- 1 | rosbag2_bagfile_information: 2 | version: 7 3 | storage_identifier: mcap 4 | duration: 5 | nanoseconds: 151137181 6 | starting_time: 7 | nanoseconds_since_epoch: 1586406456763032325 8 | message_count: 7 9 | topics_with_message_count: 10 | - topic_metadata: 11 | name: /array_topic 12 | type: test_msgs/msg/Arrays 13 | serialization_format: cdr 14 | offered_qos_profiles: "- history: 3\n depth: 4\n reliability: 1\n durability: 1\n deadline:\n sec: 0\n nsec: 0\n lifespan:\n sec: 0\n nsec: 0\n liveliness: 1\n liveliness_lease_duration:\n sec: 0\n nsec: 0\n avoid_ros_namespace_conventions: false" 15 | type_description_hash: "" 16 | message_count: 4 17 | - topic_metadata: 18 | name: /test_topic 19 | type: test_msgs/msg/BasicTypes 20 | serialization_format: cdr 21 | offered_qos_profiles: "- history: 3\n depth: 3\n reliability: 1\n durability: 1\n deadline:\n sec: 0\n nsec: 0\n lifespan:\n sec: 0\n nsec: 0\n liveliness: 1\n liveliness_lease_duration:\n sec: 0\n nsec: 0\n avoid_ros_namespace_conventions: false" 22 | type_description_hash: "" 23 | message_count: 3 24 | compression_format: "" 25 | compression_mode: "" 26 | relative_file_paths: 27 | - cdr_test_0.mcap 28 | files: 29 | - path: cdr_test_0.mcap 30 | starting_time: 31 | nanoseconds_since_epoch: 1586406456763032325 32 | duration: 33 | nanoseconds: 151137181 34 | message_count: 7 35 | custom_data: ~ -------------------------------------------------------------------------------- /ros2bag/package.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ros2bag 5 | 0.33.0 6 | 7 | Entry point for rosbag in ROS 2 8 | 9 | Michael Orlov 10 | Geoffrey Biggs 11 | Michel Hidalgo 12 | Emerson Knapp 13 | ROS Tooling Working Group 14 | Apache License 2.0 15 | 16 | ament_index_python 17 | python3-yaml 18 | rclpy 19 | ros2cli 20 | rosbag2_py 21 | rosbag2_storage_default_plugins 22 | 23 | ament_copyright 24 | ament_flake8 25 | ament_pep257 26 | ament_xmllint 27 | launch_testing 28 | launch_testing_ros 29 | python3-pytest 30 | rosbag2_storage_default_plugins 31 | rosbag2_test_common 32 | 33 | 34 | ament_python 35 | 36 | 37 | -------------------------------------------------------------------------------- /rosbag2_tests/resources/sqlite3/cdr_test/metadata.yaml: -------------------------------------------------------------------------------- 1 | rosbag2_bagfile_information: 2 | version: 7 3 | storage_identifier: sqlite3 4 | duration: 5 | nanoseconds: 151137181 6 | starting_time: 7 | nanoseconds_since_epoch: 1586406456763032325 8 | message_count: 7 9 | topics_with_message_count: 10 | - topic_metadata: 11 | name: /array_topic 12 | type: test_msgs/msg/Arrays 13 | serialization_format: cdr 14 | offered_qos_profiles: "- history: 3\n depth: 4\n reliability: 1\n durability: 1\n deadline:\n sec: 0\n nsec: 0\n lifespan:\n sec: 0\n nsec: 0\n liveliness: 1\n liveliness_lease_duration:\n sec: 0\n nsec: 0\n avoid_ros_namespace_conventions: false" 15 | type_description_hash: "" 16 | message_count: 4 17 | - topic_metadata: 18 | name: /test_topic 19 | type: test_msgs/msg/BasicTypes 20 | serialization_format: cdr 21 | offered_qos_profiles: "- history: 3\n depth: 3\n reliability: 1\n durability: 1\n deadline:\n sec: 0\n nsec: 0\n lifespan:\n sec: 0\n nsec: 0\n liveliness: 1\n liveliness_lease_duration:\n sec: 0\n nsec: 0\n avoid_ros_namespace_conventions: false" 22 | type_description_hash: "" 23 | message_count: 3 24 | compression_format: "" 25 | compression_mode: "" 26 | relative_file_paths: 27 | - cdr_test_0.db3 28 | files: 29 | - path: cdr_test_0.db3 30 | starting_time: 31 | nanoseconds_since_epoch: 1586406456763032325 32 | duration: 33 | nanoseconds: 151137181 34 | message_count: 7 35 | custom_data: ~ -------------------------------------------------------------------------------- /rosbag2_examples/rosbag2_examples_cpp/src/compressed_bag_rewriter.cpp: -------------------------------------------------------------------------------- 1 | // Copyright 2025 Open Source Robotics Foundation 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include 16 | 17 | #include "rosbag2_transport/bag_rewrite.hpp" 18 | 19 | int main(int, char **) 20 | { 21 | rosbag2_storage::StorageOptions input_storage; 22 | input_storage.uri = "input_bag"; 23 | 24 | rosbag2_storage::StorageOptions output_storage; 25 | output_storage.uri = "output_bag"; 26 | 27 | rosbag2_transport::RecordOptions record_options; 28 | record_options.all_topics = true; 29 | record_options.compression_format = "zstd"; 30 | record_options.compression_mode = "message"; 31 | 32 | std::vector input_bags; 33 | input_bags.push_back(input_storage); 34 | 35 | std::vector> output_bags; 37 | output_bags.push_back({output_storage, record_options}); 38 | 39 | rosbag2_transport::bag_rewrite(input_bags, output_bags); 40 | 41 | return 0; 42 | } 43 | -------------------------------------------------------------------------------- /rosbag2_test_common/include/rosbag2_test_common/tested_storage_ids.hpp: -------------------------------------------------------------------------------- 1 | // Copyright 2022, Foxglove Technologies Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef ROSBAG2_TEST_COMMON__TESTED_STORAGE_IDS_HPP_ 16 | #define ROSBAG2_TEST_COMMON__TESTED_STORAGE_IDS_HPP_ 17 | #include 18 | #include 19 | 20 | 21 | namespace rosbag2_test_common 22 | { 23 | static const std::array kTestedStorageIDs = { 24 | "sqlite3", 25 | "mcap", 26 | }; 27 | 28 | std::string bag_filename_for_storage_id(const std::string & name, const std::string & storage_id) 29 | { 30 | const std::array extensions = {".db3", ".mcap"}; 31 | static_assert(kTestedStorageIDs.size() == extensions.size()); 32 | for (size_t i = 0; i < extensions.size(); ++i) { 33 | if (kTestedStorageIDs[i] == storage_id) { 34 | return name + extensions[i]; 35 | } 36 | } 37 | throw std::runtime_error("unknown storage id: " + storage_id); 38 | } 39 | 40 | } // namespace rosbag2_test_common 41 | 42 | #endif // ROSBAG2_TEST_COMMON__TESTED_STORAGE_IDS_HPP_ 43 | -------------------------------------------------------------------------------- /ros2bag/ros2bag/verb/convert.py: -------------------------------------------------------------------------------- 1 | # Copyright 2021 Amazon.com Inc or its Affiliates 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from ros2bag.api import add_multi_bag_input_arg 16 | from ros2bag.api import input_bag_arg_to_storage_options 17 | from ros2bag.verb import VerbExtension 18 | from rosbag2_py import bag_rewrite 19 | 20 | 21 | class ConvertVerb(VerbExtension): 22 | """Given an input bag, write out a new bag with different settings.""" 23 | 24 | def add_arguments(self, parser, cli_name): 25 | add_multi_bag_input_arg(parser, required=True) 26 | parser.add_argument( 27 | '-o', '--output-options', 28 | type=str, required=True, 29 | help='YAML file with options for output bags. Must have one top-level key ' 30 | '"output_bags", which contains a sequence of StorageOptions/RecordOptions ' 31 | 'objects. See README.md for some examples.') 32 | 33 | def main(self, *, args): 34 | input_options = input_bag_arg_to_storage_options(args.input) 35 | 36 | bag_rewrite(input_options, args.output_options) 37 | -------------------------------------------------------------------------------- /rosbag2_cpp/test/rosbag2_cpp/mock_converter_factory.hpp: -------------------------------------------------------------------------------- 1 | // Copyright 2018, Bosch Software Innovations GmbH. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef ROSBAG2_CPP__MOCK_CONVERTER_FACTORY_HPP_ 16 | #define ROSBAG2_CPP__MOCK_CONVERTER_FACTORY_HPP_ 17 | 18 | #include 19 | 20 | #include 21 | #include 22 | #include 23 | 24 | #include "rosbag2_cpp/serialization_format_converter_factory_interface.hpp" 25 | 26 | class MockConverterFactory : public rosbag2_cpp::SerializationFormatConverterFactoryInterface 27 | { 28 | public: 29 | MOCK_METHOD1( 30 | load_serializer, 31 | std::unique_ptr( 32 | const std::string &)); 33 | 34 | MOCK_METHOD1( 35 | load_deserializer, 36 | std::unique_ptr( 37 | const std::string &)); 38 | 39 | MOCK_CONST_METHOD0( 40 | get_declared_serialization_plugins, 41 | std::vector()); 42 | }; 43 | 44 | #endif // ROSBAG2_CPP__MOCK_CONVERTER_FACTORY_HPP_ 45 | -------------------------------------------------------------------------------- /rosbag2_cpp/test/rosbag2_cpp/mock_storage_factory.hpp: -------------------------------------------------------------------------------- 1 | // Copyright 2018, Bosch Software Innovations GmbH. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef ROSBAG2_CPP__MOCK_STORAGE_FACTORY_HPP_ 16 | #define ROSBAG2_CPP__MOCK_STORAGE_FACTORY_HPP_ 17 | 18 | #include 19 | 20 | #include 21 | #include 22 | #include 23 | 24 | #include "rosbag2_storage/storage_factory_interface.hpp" 25 | #include "rosbag2_storage/storage_interfaces/read_only_interface.hpp" 26 | #include "rosbag2_storage/storage_interfaces/read_write_interface.hpp" 27 | 28 | class MockStorageFactory : public rosbag2_storage::StorageFactoryInterface 29 | { 30 | public: 31 | MOCK_METHOD1( 32 | open_read_only, 33 | std::shared_ptr( 34 | const rosbag2_storage::StorageOptions &)); 35 | MOCK_METHOD1( 36 | open_read_write, 37 | std::shared_ptr( 38 | const rosbag2_storage::StorageOptions &)); 39 | }; 40 | 41 | #endif // ROSBAG2_CPP__MOCK_STORAGE_FACTORY_HPP_ 42 | -------------------------------------------------------------------------------- /rosbag2_py/test/resources/mcap/convert_b/metadata.yaml: -------------------------------------------------------------------------------- 1 | rosbag2_bagfile_information: 2 | compression_format: '' 3 | compression_mode: '' 4 | duration: 5 | nanoseconds: 222000000 6 | files: 7 | - duration: 8 | nanoseconds: 222000000 9 | message_count: 75 10 | path: rewriter_b_0.mcap 11 | starting_time: 12 | nanoseconds_since_epoch: 0 13 | message_count: 75 14 | relative_file_paths: 15 | - rewriter_b_0.mcap 16 | starting_time: 17 | nanoseconds_since_epoch: 0 18 | storage_identifier: mcap 19 | topics_with_message_count: 20 | - message_count: 50 21 | topic_metadata: 22 | name: c_strings 23 | offered_qos_profiles: "- history: 1\n depth: 1\n reliability: 1\n durability:\ 24 | \ 1\n deadline:\n sec: 9223372036\n nsec: 854775807\n lifespan:\n\ 25 | \ sec: 9223372036\n nsec: 854775807\n liveliness: 1\n liveliness_lease_duration:\n\ 26 | \ sec: 9223372036\n nsec: 854775807\n avoid_ros_namespace_conventions:\ 27 | \ false" 28 | serialization_format: cdr 29 | type: test_msgs/msg/Strings 30 | - message_count: 25 31 | topic_metadata: 32 | name: a_empty 33 | offered_qos_profiles: "- history: 1\n depth: 1\n reliability: 1\n durability:\ 34 | \ 1\n deadline:\n sec: 9223372036\n nsec: 854775807\n lifespan:\n\ 35 | \ sec: 9223372036\n nsec: 854775807\n liveliness: 1\n liveliness_lease_duration:\n\ 36 | \ sec: 9223372036\n nsec: 854775807\n avoid_ros_namespace_conventions:\ 37 | \ false" 38 | serialization_format: cdr 39 | type: test_msgs/msg/Empty 40 | version: 5 41 | -------------------------------------------------------------------------------- /rosbag2_storage/include/rosbag2_storage/storage_factory_interface.hpp: -------------------------------------------------------------------------------- 1 | // Copyright 2018, Bosch Software Innovations GmbH. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef ROSBAG2_STORAGE__STORAGE_FACTORY_INTERFACE_HPP_ 16 | #define ROSBAG2_STORAGE__STORAGE_FACTORY_INTERFACE_HPP_ 17 | 18 | #include 19 | #include 20 | 21 | #include "rosbag2_storage/storage_interfaces/read_only_interface.hpp" 22 | #include "rosbag2_storage/storage_interfaces/read_write_interface.hpp" 23 | #include "rosbag2_storage/visibility_control.hpp" 24 | 25 | namespace rosbag2_storage 26 | { 27 | 28 | class ROSBAG2_STORAGE_PUBLIC StorageFactoryInterface 29 | { 30 | public: 31 | virtual ~StorageFactoryInterface() = default; 32 | 33 | virtual std::shared_ptr 34 | open_read_only(const StorageOptions & storage_options) = 0; 35 | 36 | virtual std::shared_ptr 37 | open_read_write(const StorageOptions & storage_options) = 0; 38 | }; 39 | 40 | } // namespace rosbag2_storage 41 | 42 | 43 | #endif // ROSBAG2_STORAGE__STORAGE_FACTORY_INTERFACE_HPP_ 44 | -------------------------------------------------------------------------------- /rosbag2_compression/test/rosbag2_compression/fake_compressor.hpp: -------------------------------------------------------------------------------- 1 | // Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef ROSBAG2_COMPRESSION__FAKE_COMPRESSOR_HPP_ 16 | #define ROSBAG2_COMPRESSION__FAKE_COMPRESSOR_HPP_ 17 | 18 | #include 19 | 20 | #include "rosbag2_compression/base_compressor_interface.hpp" 21 | #include "rosbag2_storage/serialized_bag_message.hpp" 22 | 23 | class ROSBAG2_COMPRESSION_EXPORT FakeCompressor : public rosbag2_compression:: 24 | BaseCompressorInterface 25 | { 26 | public: 27 | FakeCompressor() = default; 28 | 29 | explicit FakeCompressor(int & detected_thread_priority); 30 | 31 | std::string compress_uri(const std::string & uri) override; 32 | 33 | void compress_serialized_bag_message( 34 | const rosbag2_storage::SerializedBagMessage * bag_message, 35 | rosbag2_storage::SerializedBagMessage * compressed_message) override; 36 | 37 | std::string get_compression_identifier() const override; 38 | 39 | ~FakeCompressor() override = default; 40 | }; 41 | 42 | #endif // ROSBAG2_COMPRESSION__FAKE_COMPRESSOR_HPP_ 43 | -------------------------------------------------------------------------------- /rosbag2_compression/test/rosbag2_compression/mock_converter_factory.hpp: -------------------------------------------------------------------------------- 1 | // Copyright 2018, Bosch Software Innovations GmbH. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef ROSBAG2_COMPRESSION__MOCK_CONVERTER_FACTORY_HPP_ 16 | #define ROSBAG2_COMPRESSION__MOCK_CONVERTER_FACTORY_HPP_ 17 | 18 | #include 19 | 20 | #include 21 | #include 22 | #include 23 | 24 | #include "rosbag2_cpp/serialization_format_converter_factory_interface.hpp" 25 | 26 | class MockConverterFactory : public rosbag2_cpp::SerializationFormatConverterFactoryInterface 27 | { 28 | public: 29 | MOCK_METHOD1( 30 | load_serializer, 31 | std::unique_ptr( 32 | const std::string &)); 33 | 34 | MOCK_METHOD1( 35 | load_deserializer, 36 | std::unique_ptr( 37 | const std::string &)); 38 | 39 | MOCK_CONST_METHOD0( 40 | get_declared_serialization_plugins, 41 | std::vector()); 42 | }; 43 | 44 | #endif // ROSBAG2_COMPRESSION__MOCK_CONVERTER_FACTORY_HPP_ 45 | -------------------------------------------------------------------------------- /rosbag2_compression/test/rosbag2_compression/mock_storage_factory.hpp: -------------------------------------------------------------------------------- 1 | // Copyright 2018, Bosch Software Innovations GmbH. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef ROSBAG2_COMPRESSION__MOCK_STORAGE_FACTORY_HPP_ 16 | #define ROSBAG2_COMPRESSION__MOCK_STORAGE_FACTORY_HPP_ 17 | 18 | #include 19 | 20 | #include 21 | #include 22 | #include 23 | 24 | #include "rosbag2_storage/storage_factory_interface.hpp" 25 | #include "rosbag2_storage/storage_interfaces/read_only_interface.hpp" 26 | #include "rosbag2_storage/storage_interfaces/read_write_interface.hpp" 27 | 28 | class MockStorageFactory : public rosbag2_storage::StorageFactoryInterface 29 | { 30 | public: 31 | MOCK_METHOD1( 32 | open_read_only, 33 | std::shared_ptr( 34 | const rosbag2_storage::StorageOptions &)); 35 | MOCK_METHOD1( 36 | open_read_write, 37 | std::shared_ptr( 38 | const rosbag2_storage::StorageOptions &)); 39 | }; 40 | 41 | #endif // ROSBAG2_COMPRESSION__MOCK_STORAGE_FACTORY_HPP_ 42 | -------------------------------------------------------------------------------- /rosbag2_cpp/package.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | rosbag2_cpp 4 | 0.33.0 5 | C++ ROSBag2 client library 6 | Michael Orlov 7 | Geoffrey Biggs 8 | Michel Hidalgo 9 | Emerson Knapp 10 | ROS Tooling Working Group 11 | Apache License 2.0 12 | 13 | ament_cmake 14 | 15 | ament_index_cpp 16 | pluginlib 17 | rclcpp 18 | rcutils 19 | rcpputils 20 | rmw 21 | rmw_implementation 22 | rosbag2_storage 23 | rosidl_runtime_c 24 | rosidl_runtime_cpp 25 | rosidl_typesupport_cpp 26 | rosidl_typesupport_introspection_cpp 27 | 28 | rosbag2_storage_default_plugins 29 | ament_cmake_gmock 30 | ament_lint_auto 31 | ament_lint_common 32 | rmw_implementation_cmake 33 | test_msgs 34 | std_msgs 35 | rosbag2_test_common 36 | rosbag2_test_msgdefs 37 | 38 | 39 | ament_cmake 40 | 41 | 42 | -------------------------------------------------------------------------------- /rosbag2_cpp/test/rosbag2_cpp/mock_converter.hpp: -------------------------------------------------------------------------------- 1 | // Copyright 2018, Bosch Software Innovations GmbH. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef ROSBAG2_CPP__MOCK_CONVERTER_HPP_ 16 | #define ROSBAG2_CPP__MOCK_CONVERTER_HPP_ 17 | 18 | #include 19 | 20 | #include 21 | #include 22 | 23 | #include "rosbag2_cpp/converter_interfaces/serialization_format_converter.hpp" 24 | 25 | #include "rosbag2_storage/serialized_bag_message.hpp" 26 | 27 | class MockConverter : public rosbag2_cpp::converter_interfaces::SerializationFormatConverter 28 | { 29 | public: 30 | MOCK_METHOD3( 31 | deserialize, 32 | void( 33 | std::shared_ptr, 34 | const rosidl_message_type_support_t *, 35 | std::shared_ptr)); 36 | 37 | MOCK_METHOD3( 38 | serialize, 39 | void( 40 | std::shared_ptr, 41 | const rosidl_message_type_support_t *, 42 | std::shared_ptr)); 43 | }; 44 | 45 | #endif // ROSBAG2_CPP__MOCK_CONVERTER_HPP_ 46 | -------------------------------------------------------------------------------- /rosbag2_py/src/rosbag2_py/_message_definitions.cpp: -------------------------------------------------------------------------------- 1 | // Copyright 2024 Intrinsic Innovation LLC. All rights reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include "rosbag2_cpp/message_definitions/local_message_definition_source.hpp" 16 | 17 | #include "./pybind11.hpp" 18 | 19 | PYBIND11_MODULE(_message_definitions, m) { 20 | m.doc() = "Python wrapper of the rosbag2_cpp message definitions API"; 21 | 22 | pybind11::class_( 23 | m, "LocalMessageDefinitionSource") 24 | .def(pybind11::init<>()) 25 | .def( 26 | "get_full_text", 27 | [](rosbag2_cpp::LocalMessageDefinitionSource & self, const std::string & root_type) { 28 | PyErr_WarnEx(PyExc_DeprecationWarning, 29 | "get_full_text() is deprecated, use get_full_text_ext() instead.", 1); 30 | return self.get_full_text_ext(root_type, ""); 31 | }, 32 | pybind11::arg("root_type"), 33 | "The root type of the message definition. (Internally calls get_full_text_ext with an empty" 34 | " topic name)" 35 | ) 36 | .def( 37 | "get_full_text_ext", &rosbag2_cpp::LocalMessageDefinitionSource::get_full_text_ext); 38 | } 39 | -------------------------------------------------------------------------------- /rosbag2_cpp/test/rosbag2_cpp/converter_test_plugin.hpp: -------------------------------------------------------------------------------- 1 | // Copyright 2018, Open Source Robotics Foundation, Inc. 2 | // Copyright 2018, Bosch Software Innovations GmbH. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | #ifndef ROSBAG2_CPP__CONVERTER_TEST_PLUGIN_HPP_ 17 | #define ROSBAG2_CPP__CONVERTER_TEST_PLUGIN_HPP_ 18 | 19 | #include 20 | 21 | #include "rosbag2_cpp/converter_interfaces/serialization_format_converter.hpp" 22 | 23 | class ConverterTestPlugin 24 | : public rosbag2_cpp::converter_interfaces::SerializationFormatConverter 25 | { 26 | public: 27 | void deserialize( 28 | std::shared_ptr serialized_message, 29 | const rosidl_message_type_support_t * type_support, 30 | std::shared_ptr ros_message) override; 31 | 32 | void serialize( 33 | std::shared_ptr ros_message, 34 | const rosidl_message_type_support_t * type_support, 35 | std::shared_ptr serialized_message) override; 36 | }; 37 | 38 | #endif // ROSBAG2_CPP__CONVERTER_TEST_PLUGIN_HPP_ 39 | -------------------------------------------------------------------------------- /rosbag2_storage/include/rosbag2_storage/topic_metadata.hpp: -------------------------------------------------------------------------------- 1 | // Copyright 2018, Bosch Software Innovations GmbH. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef ROSBAG2_STORAGE__TOPIC_METADATA_HPP_ 16 | #define ROSBAG2_STORAGE__TOPIC_METADATA_HPP_ 17 | 18 | #include 19 | #include 20 | #include "rclcpp/qos.hpp" 21 | 22 | namespace rosbag2_storage 23 | { 24 | 25 | struct TopicMetadata 26 | { 27 | uint16_t id = 0; // Topic id returned by storage 28 | std::string name; 29 | std::string type; 30 | std::string serialization_format; 31 | std::vector offered_qos_profiles; 32 | // REP-2011 type description hash if available for topic, "" otherwise. 33 | std::string type_description_hash; 34 | 35 | bool operator==(const rosbag2_storage::TopicMetadata & rhs) const 36 | { 37 | return id == rhs.id && 38 | name == rhs.name && 39 | type == rhs.type && 40 | serialization_format == rhs.serialization_format && 41 | type_description_hash == rhs.type_description_hash; 42 | } 43 | }; 44 | 45 | } // namespace rosbag2_storage 46 | 47 | #endif // ROSBAG2_STORAGE__TOPIC_METADATA_HPP_ 48 | -------------------------------------------------------------------------------- /rosbag2_cpp/include/rosbag2_cpp/plugins/plugin_utils.hpp: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef ROSBAG2_CPP__PLUGINS__PLUGIN_UTILS_HPP_ 16 | #define ROSBAG2_CPP__PLUGINS__PLUGIN_UTILS_HPP_ 17 | 18 | #include 19 | #include 20 | #include 21 | #include 22 | 23 | #include "pluginlib/class_loader.hpp" 24 | 25 | namespace rosbag2_cpp 26 | { 27 | namespace plugins 28 | { 29 | template 30 | std::unordered_set get_class_plugins() 31 | { 32 | std::string package_name = InterfaceT::get_package_name(); 33 | std::string base_class = InterfaceT::get_base_class_name(); 34 | std::shared_ptr> class_loader = 35 | std::make_shared>(package_name, base_class); 36 | 37 | std::vector plugin_list = class_loader->getDeclaredClasses(); 38 | return std::unordered_set(plugin_list.begin(), plugin_list.end()); 39 | } 40 | } // namespace plugins 41 | } // namespace rosbag2_cpp 42 | 43 | #endif // ROSBAG2_CPP__PLUGINS__PLUGIN_UTILS_HPP_ 44 | -------------------------------------------------------------------------------- /rosbag2_tests/package.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | rosbag2_tests 5 | 0.33.0 6 | Tests package for rosbag2 7 | Michael Orlov 8 | Geoffrey Biggs 9 | Michel Hidalgo 10 | Emerson Knapp 11 | ROS Tooling Working Group 12 | Apache License 2.0 13 | 14 | ament_cmake 15 | 16 | ament_index_cpp 17 | 18 | ament_cmake_gmock 19 | ament_lint_auto 20 | ament_lint_common 21 | rclcpp 22 | rcpputils 23 | ros2bag 24 | rosbag2_compression 25 | rosbag2_compression_zstd 26 | rosbag2_cpp 27 | rosbag2_interfaces 28 | rosbag2_storage_default_plugins 29 | rosbag2_storage 30 | rosbag2_test_common 31 | rosbag2_transport 32 | std_msgs 33 | test_msgs 34 | 35 | 36 | ament_cmake 37 | 38 | 39 | -------------------------------------------------------------------------------- /rosbag2_py/test/resources/sqlite3/talker/metadata.yaml: -------------------------------------------------------------------------------- 1 | rosbag2_bagfile_information: 2 | version: 4 3 | storage_identifier: sqlite3 4 | relative_file_paths: 5 | - talker.db3 6 | duration: 7 | nanoseconds: 4531096768 8 | starting_time: 9 | nanoseconds_since_epoch: 1585866235112411371 10 | message_count: 20 11 | topics_with_message_count: 12 | - topic_metadata: 13 | name: /topic 14 | type: std_msgs/msg/String 15 | serialization_format: cdr 16 | offered_qos_profiles: "- history: 3\n depth: 0\n reliability: 1\n durability: 2\n deadline:\n sec: 0\n nsec: 0\n lifespan:\n sec: 0\n nsec: 0\n liveliness: 1\n liveliness_lease_duration:\n sec: 0\n nsec: 0\n avoid_ros_namespace_conventions: false" 17 | message_count: 10 18 | - topic_metadata: 19 | name: /rosout 20 | type: rcl_interfaces/msg/Log 21 | serialization_format: cdr 22 | offered_qos_profiles: "- history: 3\n depth: 0\n reliability: 1\n durability: 1\n deadline:\n sec: 0\n nsec: 0\n lifespan:\n sec: 10\n nsec: 0\n liveliness: 1\n liveliness_lease_duration:\n sec: 0\n nsec: 0\n avoid_ros_namespace_conventions: false" 23 | message_count: 10 24 | - topic_metadata: 25 | name: /parameter_events 26 | type: rcl_interfaces/msg/ParameterEvent 27 | serialization_format: cdr 28 | offered_qos_profiles: "- history: 3\n depth: 0\n reliability: 1\n durability: 2\n deadline:\n sec: 0\n nsec: 0\n lifespan:\n sec: 0\n nsec: 0\n liveliness: 1\n liveliness_lease_duration:\n sec: 0\n nsec: 0\n avoid_ros_namespace_conventions: false" 29 | message_count: 0 30 | compression_format: "" 31 | compression_mode: "" 32 | -------------------------------------------------------------------------------- /rosbag2_compression/test/rosbag2_compression/mock_converter.hpp: -------------------------------------------------------------------------------- 1 | // Copyright 2018, Bosch Software Innovations GmbH. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef ROSBAG2_COMPRESSION__MOCK_CONVERTER_HPP_ 16 | #define ROSBAG2_COMPRESSION__MOCK_CONVERTER_HPP_ 17 | 18 | #include 19 | 20 | #include 21 | #include 22 | 23 | #include "rosbag2_cpp/converter_interfaces/serialization_format_converter.hpp" 24 | 25 | #include "rosbag2_storage/serialized_bag_message.hpp" 26 | 27 | class MockConverter : public rosbag2_cpp::converter_interfaces::SerializationFormatConverter 28 | { 29 | public: 30 | MOCK_METHOD3( 31 | deserialize, 32 | void( 33 | std::shared_ptr, 34 | const rosidl_message_type_support_t *, 35 | std::shared_ptr)); 36 | 37 | MOCK_METHOD3( 38 | serialize, 39 | void( 40 | std::shared_ptr, 41 | const rosidl_message_type_support_t *, 42 | std::shared_ptr)); 43 | }; 44 | 45 | #endif // ROSBAG2_COMPRESSION__MOCK_CONVERTER_HPP_ 46 | -------------------------------------------------------------------------------- /rosbag2_storage/test/rosbag2_storage/test_ros_helper.cpp: -------------------------------------------------------------------------------- 1 | // Copyright 2018 Open Source Robotics Foundation, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include 16 | #include 17 | 18 | #include "rosbag2_storage/ros_helper.hpp" 19 | 20 | using namespace ::testing; // NOLINT 21 | 22 | TEST(ros_helper, make_serialized_message_contains_correct_data) { 23 | double data_value = 3.14; 24 | auto data = new double; 25 | *data = data_value; 26 | auto size = sizeof(double); 27 | 28 | auto serialized_message = rosbag2_storage::make_serialized_message(data, size); 29 | delete data; 30 | 31 | ASSERT_THAT(serialized_message->buffer_length, Eq(size)); 32 | ASSERT_THAT(serialized_message->buffer_capacity, Eq(size)); 33 | ASSERT_THAT(reinterpret_cast(serialized_message->buffer), Pointee(data_value)); 34 | } 35 | 36 | TEST(ros_helper, make_empty_serialized_message_is_correctly_built) { 37 | auto size = 32u; 38 | 39 | auto empty_serialized_message = rosbag2_storage::make_empty_serialized_message(size); 40 | 41 | ASSERT_THAT(empty_serialized_message->buffer_length, Eq(0u)); 42 | ASSERT_THAT(empty_serialized_message->buffer_capacity, Eq(size)); 43 | } 44 | -------------------------------------------------------------------------------- /rosbag2_compression/test/rosbag2_compression/fake_compression_factory.hpp: -------------------------------------------------------------------------------- 1 | // Copyright 2023 Open Source Robotics Foundation, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef ROSBAG2_COMPRESSION__FAKE_COMPRESSION_FACTORY_HPP_ 16 | #define ROSBAG2_COMPRESSION__FAKE_COMPRESSION_FACTORY_HPP_ 17 | 18 | #include 19 | #include 20 | 21 | #include "rosbag2_compression/compression_factory.hpp" 22 | #include "fake_compressor.hpp" 23 | 24 | class ROSBAG2_COMPRESSION_EXPORT FakeCompressionFactory 25 | : public rosbag2_compression::CompressionFactory 26 | { 27 | public: 28 | FakeCompressionFactory() = delete; 29 | 30 | ~FakeCompressionFactory() override = default; 31 | 32 | explicit FakeCompressionFactory(int & detected_thread_priority) 33 | : detected_thread_priority_(detected_thread_priority) {} 34 | 35 | std::shared_ptr 36 | create_compressor(const std::string & /*compression_format*/) override 37 | { 38 | return std::make_shared(detected_thread_priority_); 39 | } 40 | 41 | private: 42 | int & detected_thread_priority_; 43 | }; 44 | 45 | #endif // ROSBAG2_COMPRESSION__FAKE_COMPRESSION_FACTORY_HPP_ 46 | -------------------------------------------------------------------------------- /rosbag2_transport/include/rosbag2_transport/reader_writer_factory.hpp: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef ROSBAG2_TRANSPORT__READER_WRITER_FACTORY_HPP_ 16 | #define ROSBAG2_TRANSPORT__READER_WRITER_FACTORY_HPP_ 17 | 18 | #include 19 | 20 | #include "rosbag2_cpp/reader.hpp" 21 | #include "rosbag2_cpp/writer.hpp" 22 | #include "rosbag2_storage/storage_options.hpp" 23 | #include "rosbag2_transport/record_options.hpp" 24 | #include "rosbag2_transport/visibility_control.hpp" 25 | 26 | namespace rosbag2_transport 27 | { 28 | class ROSBAG2_TRANSPORT_PUBLIC ReaderWriterFactory 29 | { 30 | public: 31 | /// Create a Reader with the appropriate underlying implementation. 32 | static std::unique_ptr make_reader( 33 | const rosbag2_storage::StorageOptions & storage_options); 34 | 35 | /// Create a Writer with the appropriate underlying implementation. 36 | static std::unique_ptr make_writer( 37 | const rosbag2_transport::RecordOptions & record_options); 38 | }; 39 | } // namespace rosbag2_transport 40 | 41 | #endif // ROSBAG2_TRANSPORT__READER_WRITER_FACTORY_HPP_ 42 | -------------------------------------------------------------------------------- /rosbag2_cpp/test/rosbag2_cpp/converter_test_plugin.cpp: -------------------------------------------------------------------------------- 1 | // Copyright 2018, Open Source Robotics Foundation, Inc. 2 | // Copyright 2018, Bosch Software Innovations GmbH. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | #include "converter_test_plugin.hpp" 17 | 18 | #include 19 | 20 | void ConverterTestPlugin::deserialize( 21 | const std::shared_ptr serialized_message, 22 | const rosidl_message_type_support_t * type_support, 23 | std::shared_ptr ros_message) 24 | { 25 | (void) ros_message; 26 | (void) serialized_message; 27 | (void) type_support; 28 | } 29 | 30 | void ConverterTestPlugin::serialize( 31 | const std::shared_ptr ros_message, 32 | const rosidl_message_type_support_t * type_support, 33 | std::shared_ptr serialized_message) 34 | { 35 | (void) serialized_message; 36 | (void) ros_message; 37 | (void) type_support; 38 | } 39 | 40 | #include "pluginlib/class_list_macros.hpp" // NOLINT 41 | PLUGINLIB_EXPORT_CLASS( 42 | ConverterTestPlugin, rosbag2_cpp::converter_interfaces::SerializationFormatConverter) 43 | -------------------------------------------------------------------------------- /rosbag2_examples/rosbag2_examples_cpp/src/data_generator_executable.cpp: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Open Source Robotics Foundation 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include 16 | #include 17 | 18 | #include "example_interfaces/msg/int32.hpp" 19 | #include "rclcpp/rclcpp.hpp" 20 | 21 | #include "rosbag2_cpp/writer.hpp" 22 | #include "rosbag2_cpp/writers/sequential_writer.hpp" 23 | #include "rosbag2_storage/serialized_bag_message.hpp" 24 | 25 | using namespace std::chrono_literals; 26 | 27 | int main(int, char **) 28 | { 29 | example_interfaces::msg::Int32 data; 30 | data.data = 0; 31 | std::unique_ptr writer_ = std::make_unique(); 32 | 33 | writer_->open("big_synthetic_bag"); 34 | 35 | writer_->create_topic( 36 | { 37 | 0u, 38 | "synthetic", 39 | "example_interfaces/msg/Int32", 40 | rmw_get_serialization_format(), 41 | {}, 42 | "" 43 | }); 44 | 45 | rclcpp::Clock clock; 46 | rclcpp::Time time_stamp = clock.now(); 47 | for (int32_t ii = 0; ii < 100; ++ii) { 48 | writer_->write(data, "synthetic", time_stamp); 49 | ++data.data; 50 | time_stamp += rclcpp::Duration(1s); 51 | } 52 | 53 | return 0; 54 | } 55 | -------------------------------------------------------------------------------- /ros2bag/ros2bag/verb/reindex.py: -------------------------------------------------------------------------------- 1 | # Copyright 2021 DCS Corporation, All Rights Reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # 15 | # DISTRIBUTION A. Approved for public release; distribution unlimited. 16 | # OPSEC #4584. 17 | # 18 | # Delivered to the U.S. Government with Unlimited Rights, as defined in DFARS 19 | # Part 252.227-7013 or 7014 (Feb 2014). 20 | # 21 | # This notice must appear in all copies of this file and its derivatives. 22 | 23 | import os 24 | 25 | from ros2bag.api import add_standard_reader_args 26 | from ros2bag.api import print_error 27 | from ros2bag.verb import VerbExtension 28 | from rosbag2_py import Reindexer, StorageOptions 29 | 30 | 31 | class ReindexVerb(VerbExtension): 32 | """Reconstruct metadata file for a bag.""" 33 | 34 | def add_arguments(self, parser, cli_name): 35 | add_standard_reader_args(parser) 36 | 37 | def main(self, *, args): 38 | if not os.path.isdir(args.bag_path): 39 | return print_error('Must specify a bag directory') 40 | 41 | storage_options = StorageOptions( 42 | uri=args.bag_path, 43 | storage_id=args.storage, 44 | ) 45 | 46 | reindexer = Reindexer() 47 | reindexer.reindex(storage_options) 48 | -------------------------------------------------------------------------------- /rosbag2_compression/src/rosbag2_compression/compression_factory.cpp: -------------------------------------------------------------------------------- 1 | // Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include 16 | #include 17 | #include 18 | 19 | #include "rosbag2_compression/compression_factory.hpp" 20 | 21 | #include "compression_factory_impl.hpp" 22 | 23 | namespace rosbag2_compression 24 | { 25 | 26 | CompressionFactory::CompressionFactory() 27 | : impl_(new CompressionFactoryImpl()) {} 28 | 29 | CompressionFactory::~CompressionFactory() = default; 30 | 31 | std::shared_ptr 32 | CompressionFactory::create_compressor(const std::string & compression_format) 33 | { 34 | return impl_->create_compressor(compression_format); 35 | } 36 | 37 | std::shared_ptr 38 | CompressionFactory::create_decompressor(const std::string & compression_format) 39 | { 40 | return impl_->create_decompressor(compression_format); 41 | } 42 | 43 | std::vector CompressionFactory::get_declared_compressor_plugins() const 44 | { 45 | return impl_->get_declared_compressor_plugins(); 46 | } 47 | 48 | } // namespace rosbag2_compression 49 | -------------------------------------------------------------------------------- /mcap_vendor/README.md: -------------------------------------------------------------------------------- 1 | # mcap_vendor 2 | 3 | Vendor package for the [MCAP C++ library](https://github.com/foxglove/mcap). 4 | 5 | ## Versioning notes 6 | 7 | This project abides by the versioning guidelines in the [developer guide](https://docs.ros.org/en/rolling/The-ROS2-Project/Contributing/Developer-Guide.html#versioning). 8 | 9 | The `mcap_vendor` semantic version is intentionally decoupled from the `mcap` library version defined in [mcap/types.hpp](https://github.com/foxglove/mcap/blob/main/cpp/mcap/include/mcap/types.hpp#L17). The `mcap` C++ library does not expose a stable ABI, so its version says nothing about ABI compatibility. The `mcap_vendor` package is intended 10 | to offer a backwards-compatible ABI within a given major version. 11 | 12 | > *Side-Note*: ROS 2 package versions defined in `package.xml` do not support additional labels or metadata after the patch version (eg. the `-alpha.1` in `1.2.3-alpha.1`). 13 | 14 | * We make no promises about ABI compatibility across any version of `mcap_vendor` in the Rolling release. Therefore, the `mcap_vendor` major version in Rolling is always 0. Major or minor revisions of `mcap` should result in a minor version bump of `mcap_vendor`. 15 | * In stable ROS 2 distributions, the `mcap_vendor` major version is set at some non-zero value.This major version should not be updated for the lifetime of that distribution, because that would indicate a change that breaks ABI compatibility. 16 | * When a new ROS 2 distribution is cut from Rolling, a new major version `N` is chosen and the `mcap_vendor` version is set to `N.0.0`. 17 | * The `mcap` version built by `mcap_vendor` in a stable distribution should not change. Neccessary bug-fixes should be maintained as patch files in `mcap_vendor/patches`, and these patches should not modify the `mcap_vendor` ABI. 18 | -------------------------------------------------------------------------------- /rosbag2_performance/rosbag2_performance_benchmarking/package.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | rosbag2_performance_benchmarking 5 | 0.33.0 6 | Code to benchmark rosbag2 7 | Michael Orlov 8 | Geoffrey Biggs 9 | Michel Hidalgo 10 | Adam Dabrowski 11 | Apache License 2.0 12 | 13 | ament_cmake 14 | 15 | ament_index_python 16 | python3-psutil 17 | launch 18 | launch_ros 19 | 20 | rclcpp 21 | rosbag2_compression 22 | rosbag2_py 23 | rosbag2_cpp 24 | rosbag2_storage 25 | rmw 26 | rosbag2_performance_benchmarking_msgs 27 | sensor_msgs 28 | yaml_cpp_vendor 29 | 30 | ament_lint_auto 31 | ament_lint_common 32 | launch_ros 33 | ros_testing 34 | ros2launch 35 | ros2bag 36 | rosbag2_storage_default_plugins 37 | rosbag2_test_common 38 | 39 | 40 | ament_cmake 41 | 42 | 43 | -------------------------------------------------------------------------------- /rosbag2_transport/test/rosbag2_transport/rosbag2_play_test_fixture.hpp: -------------------------------------------------------------------------------- 1 | // Copyright 2018, Bosch Software Innovations GmbH. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef ROSBAG2_TRANSPORT__ROSBAG2_PLAY_TEST_FIXTURE_HPP_ 16 | #define ROSBAG2_TRANSPORT__ROSBAG2_PLAY_TEST_FIXTURE_HPP_ 17 | 18 | #include 19 | 20 | #include "rosbag2_test_common/action_server_manager.hpp" 21 | #include "rosbag2_test_common/subscription_manager.hpp" 22 | #include "rosbag2_test_common/service_manager.hpp" 23 | #include "rosbag2_transport_test_fixture.hpp" 24 | 25 | class RosBag2PlayTestFixture : public Rosbag2TransportTestFixture 26 | { 27 | public: 28 | RosBag2PlayTestFixture() 29 | : Rosbag2TransportTestFixture() 30 | { 31 | rclcpp::init(0, nullptr); 32 | sub_ = std::make_shared(); 33 | srv_ = std::make_shared(); 34 | action_server_ = std::make_shared(); 35 | } 36 | 37 | ~RosBag2PlayTestFixture() override 38 | { 39 | rclcpp::shutdown(); 40 | } 41 | 42 | std::shared_ptr sub_; 43 | std::shared_ptr srv_; 44 | std::shared_ptr action_server_; 45 | }; 46 | 47 | #endif // ROSBAG2_TRANSPORT__ROSBAG2_PLAY_TEST_FIXTURE_HPP_ 48 | -------------------------------------------------------------------------------- /rosbag2_compression/test/rosbag2_compression/fake_compressor.cpp: -------------------------------------------------------------------------------- 1 | // Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include 16 | #ifdef _WIN32 17 | #include 18 | #else 19 | #include 20 | #endif 21 | 22 | #include "pluginlib/class_list_macros.hpp" 23 | #include "fake_compressor.hpp" 24 | 25 | FakeCompressor::FakeCompressor(int & detected_thread_priority) 26 | { 27 | #ifndef _WIN32 28 | int cur_nice_value = getpriority(PRIO_PROCESS, 0); 29 | if (cur_nice_value != -1 && errno == 0) { 30 | detected_thread_priority = cur_nice_value; 31 | } 32 | #else 33 | detected_thread_priority = GetThreadPriority(GetCurrentThread()); 34 | #endif 35 | } 36 | 37 | std::string FakeCompressor::compress_uri(const std::string & uri) 38 | { 39 | return uri + "." + get_compression_identifier(); 40 | } 41 | 42 | void FakeCompressor::compress_serialized_bag_message( 43 | const rosbag2_storage::SerializedBagMessage *, 44 | rosbag2_storage::SerializedBagMessage *) {} 45 | 46 | std::string FakeCompressor::get_compression_identifier() const 47 | { 48 | return "fake_comp"; 49 | } 50 | 51 | PLUGINLIB_EXPORT_CLASS(FakeCompressor, rosbag2_compression::BaseCompressorInterface) 52 | -------------------------------------------------------------------------------- /rosbag2_cpp/include/rosbag2_cpp/serialization_format_converter_factory_interface.hpp: -------------------------------------------------------------------------------- 1 | // Copyright 2018 Open Source Robotics Foundation, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef ROSBAG2_CPP__SERIALIZATION_FORMAT_CONVERTER_FACTORY_INTERFACE_HPP_ 16 | #define ROSBAG2_CPP__SERIALIZATION_FORMAT_CONVERTER_FACTORY_INTERFACE_HPP_ 17 | 18 | #include 19 | #include 20 | #include 21 | 22 | #include "rosbag2_cpp/converter_interfaces/serialization_format_converter.hpp" 23 | #include "rosbag2_cpp/visibility_control.hpp" 24 | 25 | namespace rosbag2_cpp 26 | { 27 | 28 | class ROSBAG2_CPP_PUBLIC SerializationFormatConverterFactoryInterface 29 | { 30 | public: 31 | virtual ~SerializationFormatConverterFactoryInterface() = default; 32 | 33 | virtual std::unique_ptr 34 | load_deserializer(const std::string & format) = 0; 35 | 36 | virtual std::unique_ptr 37 | load_serializer(const std::string & format) = 0; 38 | 39 | virtual std::vector get_declared_serialization_plugins() const = 0; 40 | }; 41 | 42 | } // namespace rosbag2_cpp 43 | 44 | #endif // ROSBAG2_CPP__SERIALIZATION_FORMAT_CONVERTER_FACTORY_INTERFACE_HPP_ 45 | -------------------------------------------------------------------------------- /rosbag2_py/test/resources/mcap/talker/metadata.yaml: -------------------------------------------------------------------------------- 1 | rosbag2_bagfile_information: 2 | compression_format: '' 3 | compression_mode: '' 4 | duration: 5 | nanoseconds: 4531096768 6 | message_count: 20 7 | relative_file_paths: 8 | - talker.mcap 9 | starting_time: 10 | nanoseconds_since_epoch: 1585866235112411371 11 | storage_identifier: mcap 12 | topics_with_message_count: 13 | - message_count: 10 14 | topic_metadata: 15 | name: /topic 16 | offered_qos_profiles: "- history: 3\n depth: 0\n reliability: 1\n durability:\ 17 | \ 2\n deadline:\n sec: 0\n nsec: 0\n lifespan:\n sec: 0\n nsec:\ 18 | \ 0\n liveliness: 1\n liveliness_lease_duration:\n sec: 0\n nsec:\ 19 | \ 0\n avoid_ros_namespace_conventions: false" 20 | serialization_format: cdr 21 | type: std_msgs/msg/String 22 | - message_count: 10 23 | topic_metadata: 24 | name: /rosout 25 | offered_qos_profiles: "- history: 3\n depth: 0\n reliability: 1\n durability:\ 26 | \ 1\n deadline:\n sec: 0\n nsec: 0\n lifespan:\n sec: 10\n nsec:\ 27 | \ 0\n liveliness: 1\n liveliness_lease_duration:\n sec: 0\n nsec:\ 28 | \ 0\n avoid_ros_namespace_conventions: false" 29 | serialization_format: cdr 30 | type: rcl_interfaces/msg/Log 31 | - message_count: 0 32 | topic_metadata: 33 | name: /parameter_events 34 | offered_qos_profiles: "- history: 3\n depth: 0\n reliability: 1\n durability:\ 35 | \ 2\n deadline:\n sec: 0\n nsec: 0\n lifespan:\n sec: 0\n nsec:\ 36 | \ 0\n liveliness: 1\n liveliness_lease_duration:\n sec: 0\n nsec:\ 37 | \ 0\n avoid_ros_namespace_conventions: false" 38 | serialization_format: cdr 39 | type: rcl_interfaces/msg/ParameterEvent 40 | version: 4 41 | -------------------------------------------------------------------------------- /rosbag2_py/test/test_reindexer.py: -------------------------------------------------------------------------------- 1 | # Copyright 2021 DCS Corporation, All Rights Reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # 15 | # DISTRIBUTION A. Approved for public release; distribution unlimited. 16 | # OPSEC #4584. 17 | # 18 | # Delivered to the U.S. Government with Unlimited Rights, as defined in DFARS 19 | # Part 252.227-7013 or 7014 (Feb 2014). 20 | # 21 | # This notice must appear in all copies of this file and its derivatives. 22 | 23 | import os 24 | from pathlib import Path 25 | 26 | from common import get_rosbag_options 27 | 28 | import pytest 29 | 30 | import rosbag2_py 31 | from rosbag2_test_common import TESTED_STORAGE_IDS 32 | 33 | 34 | RESOURCES_PATH = Path(os.environ['ROSBAG2_PY_TEST_RESOURCES_DIR']) 35 | 36 | 37 | @pytest.mark.parametrize('storage_id', TESTED_STORAGE_IDS) 38 | def test_reindexer_multiple_files(storage_id): 39 | bag_path = RESOURCES_PATH / storage_id / 'reindex_test_bags' / 'multiple_files' 40 | result_path = bag_path / 'metadata.yaml' 41 | 42 | storage_options, _ = get_rosbag_options(str(bag_path), storage_id=storage_id) 43 | reindexer = rosbag2_py.Reindexer() 44 | reindexer.reindex(storage_options) 45 | 46 | assert result_path.exists() 47 | 48 | try: 49 | result_path.unlink() 50 | except FileNotFoundError: 51 | pass 52 | -------------------------------------------------------------------------------- /ros2bag/setup.py: -------------------------------------------------------------------------------- 1 | from setuptools import find_packages 2 | from setuptools import setup 3 | 4 | package_name = 'ros2bag' 5 | 6 | setup( 7 | name=package_name, 8 | version='0.33.0', 9 | packages=find_packages(exclude=['test']), 10 | data_files=[ 11 | ('share/' + package_name, ['package.xml']), 12 | ('share/ament_index/resource_index/packages', 13 | ['resource/' + package_name]), 14 | ], 15 | install_requires=['ros2cli'], 16 | zip_safe=True, 17 | author='Karsten Knese', 18 | author_email='karsten@osrfoundation.org', 19 | maintainer='Karsten Knese', 20 | maintainer_email='karsten@osrfoundation.org', 21 | keywords=[], 22 | classifiers=[ 23 | 'Environment :: Console', 24 | 'Intended Audience :: Developers', 25 | 'Programming Language :: Python', 26 | ], 27 | description='Entry point for rosbag in ROS 2', 28 | long_description="""\ 29 | The package provides the rosbag command for the ROS 2 command line tools.""", 30 | license='Apache License, Version 2.0', 31 | extras_require={ 32 | 'test': [ 33 | 'pytest', 34 | ], 35 | }, 36 | entry_points={ 37 | 'ros2cli.command': [ 38 | 'bag = ros2bag.command.bag:BagCommand', 39 | ], 40 | 'ros2cli.extension_point': [ 41 | 'ros2bag.verb = ros2bag.verb:VerbExtension', 42 | ], 43 | 'ros2bag.verb': [ 44 | 'burst = ros2bag.verb.burst:BurstVerb', 45 | 'convert = ros2bag.verb.convert:ConvertVerb', 46 | 'info = ros2bag.verb.info:InfoVerb', 47 | 'list = ros2bag.verb.list:ListVerb', 48 | 'play = ros2bag.verb.play:PlayVerb', 49 | 'record = ros2bag.verb.record:RecordVerb', 50 | 'reindex = ros2bag.verb.reindex:ReindexVerb' 51 | ], 52 | } 53 | ) 54 | -------------------------------------------------------------------------------- /rosbag2_storage/include/rosbag2_storage/storage_traits.hpp: -------------------------------------------------------------------------------- 1 | // Copyright 2018, Open Source Robotics Foundation, Inc. 2 | // Copyright 2018, Bosch Software Innovations GmbH. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); 5 | // you may not use this file except in compliance with the License. 6 | // You may obtain a copy of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | // See the License for the specific language governing permissions and 14 | // limitations under the License. 15 | 16 | #ifndef ROSBAG2_STORAGE__STORAGE_TRAITS_HPP_ 17 | #define ROSBAG2_STORAGE__STORAGE_TRAITS_HPP_ 18 | 19 | #include "rosbag2_storage/storage_interfaces/base_io_interface.hpp" 20 | 21 | namespace rosbag2_storage 22 | { 23 | 24 | namespace storage_interfaces 25 | { 26 | class ReadWriteInterface; 27 | class ReadOnlyInterface; 28 | } 29 | 30 | template 31 | struct StorageTraits 32 | {}; 33 | 34 | template<> 35 | struct StorageTraits 36 | { 37 | static constexpr storage_interfaces::IOFlag io_flag = storage_interfaces::IOFlag::READ_WRITE; 38 | static constexpr const char * name = "rosbag2_storage::storage_interfaces::ReadWriteInterface"; 39 | }; 40 | 41 | template<> 42 | struct StorageTraits 43 | { 44 | static constexpr storage_interfaces::IOFlag io_flag = storage_interfaces::IOFlag::READ_ONLY; 45 | static constexpr const char * name = "rosbag2_storage::storage_interfaces::ReadOnlyInterface"; 46 | }; 47 | 48 | } // namespace rosbag2_storage 49 | 50 | #endif // ROSBAG2_STORAGE__STORAGE_TRAITS_HPP_ 51 | -------------------------------------------------------------------------------- /rosbag2_py/rosbag2_py/_writer.pyi: -------------------------------------------------------------------------------- 1 | import rosbag2_py._compression_options 2 | import rosbag2_py._storage 3 | from typing import overload 4 | 5 | class SequentialCompressionWriter: 6 | def __init__(self, arg0: rosbag2_py._compression_options.CompressionOptions) -> None: ... 7 | def create_topic(self, arg0: rosbag2_py._storage.TopicMetadata) -> None: ... 8 | def open(self, arg0: rosbag2_py._storage.StorageOptions, arg1: rosbag2_py._storage.ConverterOptions) -> None: ... 9 | def remove_topic(self, arg0: rosbag2_py._storage.TopicMetadata) -> None: ... 10 | def split_bagfile(self) -> None: ... 11 | def take_snapshot(self) -> bool: ... 12 | @overload 13 | def write(self, topic_name: str, message: str, time_stamp: int, sequence_number: int = ...) -> None: ... 14 | @overload 15 | def write(self, topic_name: str, message: str, recv_timestamp: int, send_timestamp: int, sequence_number: int = ...) -> None: ... 16 | 17 | class SequentialWriter: 18 | def __init__(self) -> None: ... 19 | def close(self) -> None: ... 20 | def create_topic(self, arg0: rosbag2_py._storage.TopicMetadata) -> None: ... 21 | def open(self, arg0: rosbag2_py._storage.StorageOptions, arg1: rosbag2_py._storage.ConverterOptions) -> None: ... 22 | def remove_topic(self, arg0: rosbag2_py._storage.TopicMetadata) -> None: ... 23 | def split_bagfile(self) -> None: ... 24 | def take_snapshot(self) -> bool: ... 25 | @overload 26 | def write(self, topic_name: str, message: str, time_stamp: int, sequence_number: int = ...) -> None: ... 27 | @overload 28 | def write(self, topic_name: str, message: str, recv_timestamp: int, send_timestamp: int, sequence_number: int = ...) -> None: ... 29 | 30 | def get_registered_compressors() -> Set[str]: ... 31 | def get_registered_serializers() -> Set[str]: ... 32 | def get_registered_writers() -> Set[str]: ... 33 | --------------------------------------------------------------------------------