Skip to content

Commit 6f1c2c2

Browse files
committed
WIP add rosbag2_py test_convert
Signed-off-by: Emerson Knapp <[email protected]>
1 parent 48b2b24 commit 6f1c2c2

23 files changed

+149
-7
lines changed

rosbag2_py/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ if(BUILD_TESTING)
154154
# python extension built with libc++.
155155
set(other_environment_vars "ROSBAG2_PY_TEST_WITH_RTLD_GLOBAL=True")
156156
endif()
157+
set(other_environment_vars "${other_environment_vars} ROSBAG2_PY_TEST_RESOURCES_DIR=${CMAKE_CURRENT_SOURCE_DIR}/test/resources")
157158
ament_add_pytest_test(test_sequential_reader_py "test/test_sequential_reader.py"
158159
PYTHON_EXECUTABLE "${_PYTHON_EXECUTABLE}"
159160
APPEND_ENV
@@ -181,6 +182,11 @@ if(BUILD_TESTING)
181182
PYTHON_EXECUTABLE "${_PYTHON_EXECUTABLE}"
182183
APPEND_ENV "PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}" ${other_environment_vars}
183184
)
185+
ament_add_pytest_test(test_convert_py
186+
"test/test_convert.py"
187+
PYTHON_EXECUTABLE "${_PYTHON_EXECUTABLE}"
188+
APPEND_ENV "PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}" ${other_environment_vars}
189+
)
184190
endif()
185191

186192
ament_package()

rosbag2_py/src/rosbag2_py/_transport.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,8 @@ void bag_rewrite(
188188
throw std::runtime_error("Output bag config YAML file must have top-level key 'output_bags'");
189189
}
190190
if (!bag_nodes.IsSequence()) {
191-
throw std::runtime_error("Top-level key 'output_bags' must contain a list.");
191+
throw std::runtime_error(
192+
"Top-level key 'output_bags' must contain a list of StorageOptions/RecordOptions dicts.");
192193
}
193194

194195
std::vector<
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
rosbag2_bagfile_information:
2+
version: 5
3+
storage_identifier: sqlite3
4+
duration:
5+
nanoseconds: 100000000
6+
starting_time:
7+
nanoseconds_since_epoch: 0
8+
message_count: 150
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\n- history: 1\n depth: 2\n reliability: 2\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: 100
16+
- topic_metadata:
17+
name: b_basictypes
18+
type: test_msgs/msg/BasicTypes
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_a_0.db3
26+
files:
27+
- path: rewriter_a_0.db3
28+
starting_time:
29+
nanoseconds_since_epoch: 0
30+
duration:
31+
nanoseconds: 100000000
32+
message_count: 150
24 KB
Binary file not shown.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
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
32 KB
Binary file not shown.

0 commit comments

Comments
 (0)