Skip to content

Commit 521733f

Browse files
authored
Add reflection based support for deserializing ROS2 MCAP (#11367)
1 parent 064dab5 commit 521733f

File tree

22 files changed

+2213
-452
lines changed

22 files changed

+2213
-452
lines changed

ARCHITECTURE.md

Lines changed: 32 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -98,11 +98,11 @@ Of course, this will only take us so far. In the future we plan on caching queri
9898
Here is an overview of the crates included in the project:
9999

100100
<picture>
101-
<img src="https://static.rerun.io/crates/c4945bdef6cdcf99bf37a05480d19be23bfd2b7f/full.png" alt="">
102-
<source media="(max-width: 480px)" srcset="https://static.rerun.io/crates/c4945bdef6cdcf99bf37a05480d19be23bfd2b7f/480w.png">
103-
<source media="(max-width: 768px)" srcset="https://static.rerun.io/crates/c4945bdef6cdcf99bf37a05480d19be23bfd2b7f/768w.png">
104-
<source media="(max-width: 1024px)" srcset="https://static.rerun.io/crates/c4945bdef6cdcf99bf37a05480d19be23bfd2b7f/1024w.png">
105-
<source media="(max-width: 1200px)" srcset="https://static.rerun.io/crates/c4945bdef6cdcf99bf37a05480d19be23bfd2b7f/1200w.png">
101+
<img src="https://static.rerun.io/crates/61660a3e8357cd6261f329c8fe15d5c5a1c6f087/full.png" alt="">
102+
<source media="(max-width: 480px)" srcset="https://static.rerun.io/crates/61660a3e8357cd6261f329c8fe15d5c5a1c6f087/480w.png">
103+
<source media="(max-width: 768px)" srcset="https://static.rerun.io/crates/61660a3e8357cd6261f329c8fe15d5c5a1c6f087/768w.png">
104+
<source media="(max-width: 1024px)" srcset="https://static.rerun.io/crates/61660a3e8357cd6261f329c8fe15d5c5a1c6f087/1024w.png">
105+
<source media="(max-width: 1200px)" srcset="https://static.rerun.io/crates/61660a3e8357cd6261f329c8fe15d5c5a1c6f087/1200w.png">
106106
</picture>
107107

108108
<!-- !!! IMPORTANT!!!
@@ -120,20 +120,20 @@ Update instructions:
120120

121121
### SDK/CLI/Wasm top-level crates
122122

123-
| Crate | Description |
124-
|----------------------|--------------------------------------|
125-
| rerun-cli | Rerun native CLI binary crate |
126-
| Rerun | Rerun Rust SDK and Viewer shim crate |
127-
| rerun_c | Rerun C SDK |
128-
| rerun_py | Rerun Python SDK |
129-
| re_sdk | Rerun logging SDK |
123+
| Crate | Description |
124+
| --------- | ------------------------------------ |
125+
| rerun-cli | Rerun native CLI binary crate |
126+
| Rerun | Rerun Rust SDK and Viewer shim crate |
127+
| rerun_c | Rerun C SDK |
128+
| rerun_py | Rerun Python SDK |
129+
| re_sdk | Rerun logging SDK |
130130

131131
### Viewer crates
132132

133133
##### UI crates
134134

135135
| Crate | Description |
136-
|-----------------------|------------------------------------------------------------------------------------------------------------|
136+
| --------------------- | ---------------------------------------------------------------------------------------------------------- |
137137
| re_arrow_ui | Show arrow data in a tree of rerun list_items and format arrow with syntax highlighting. |
138138
| re_blueprint_tree | The UI for the blueprint tree in the left panel. |
139139
| re_redap_browser | The UI and communication to implement the in-viewer redap server browser. |
@@ -159,20 +159,20 @@ Update instructions:
159159

160160
##### UI support crates
161161

162-
| Crate | Description |
163-
|------------------------|----------------------------------------------------------------------|
164-
| re_context_menu | Support crate for context menu and actions. |
165-
| re_data_ui | Provides UI elements for Rerun component data for the Rerun Viewer. |
166-
| re_renderer | A wgpu-based renderer for all your visualization needs. |
167-
| re_renderer_examples | Examples for re_renderer |
168-
| re_ui | Rerun GUI theme and helpers, built around egui |
169-
| re_viewer_context | Rerun Viewer state that is shared with the viewer's code components. |
170-
| re_viewport_blueprint | The data model description of the viewport panel. |
162+
| Crate | Description |
163+
| --------------------- | -------------------------------------------------------------------- |
164+
| re_context_menu | Support crate for context menu and actions. |
165+
| re_data_ui | Provides UI elements for Rerun component data for the Rerun Viewer. |
166+
| re_renderer | A wgpu-based renderer for all your visualization needs. |
167+
| re_renderer_examples | Examples for re_renderer |
168+
| re_ui | Rerun GUI theme and helpers, built around egui |
169+
| re_viewer_context | Rerun Viewer state that is shared with the viewer's code components. |
170+
| re_viewport_blueprint | The data model description of the viewport panel. |
171171

172172
### Application-level store
173173

174174
| Crate | Description |
175-
|-----------------|-----------------------------------------------------------------|
175+
| --------------- | --------------------------------------------------------------- |
176176
| re_dataframe | The Rerun public data APIs. |
177177
| re_datafusion | DataFusion interfaces to Rerun gRPC queries |
178178
| re_entity_db | In-memory storage of Rerun entities |
@@ -186,7 +186,7 @@ Update instructions:
186186
### Low-level store
187187

188188
| Crate | Description |
189-
|-----------------|-----------------------------------------------------------------------------------------------|
189+
| --------------- | --------------------------------------------------------------------------------------------- |
190190
| re_chunk | A chunk of Rerun data, encoded using Arrow. Used for logging, transport, storage and compute. |
191191
| re_chunk_store | An in-memory time series database for Rerun log data, based on Apache Arrow. |
192192
| re_format_arrow | Formatting of Apache Arrow tables. |
@@ -197,7 +197,7 @@ Update instructions:
197197
### Data flow
198198

199199
| Crate | Description |
200-
|----------------------|-------------------------------------------------------------------|
200+
| -------------------- | ----------------------------------------------------------------- |
201201
| re_redap_client | Official client for the Rerun Data Protocol |
202202
| re_data_loader | Handles loading of Rerun data from file using data loader plugins |
203203
| re_data_source | Handles loading of Rerun data from different sources |
@@ -208,7 +208,7 @@ Update instructions:
208208
### Build support
209209

210210
| Crate | Description |
211-
|-------------------|------------------------------------------------------------------|
211+
| ----------------- | ---------------------------------------------------------------- |
212212
| re_build_info | Information about the build. Use together with re_build_tools |
213213
| re_build_tools | build.rs helpers for generating build info |
214214
| re_dev_tools | Various tools for Rerun development. Each tool has a subcommand. |
@@ -218,7 +218,7 @@ Update instructions:
218218
### Utilities
219219

220220
| Crate | Description |
221-
|--------------------|--------------------------------------------------------------------------------------|
221+
| ------------------ | ------------------------------------------------------------------------------------ |
222222
| re_analytics | Rerun's analytics SDK |
223223
| re_arrow_util | Helpers for working with arrow |
224224
| re_auth | Authentication and authorization helpers |
@@ -233,6 +233,7 @@ Update instructions:
233233
| re_mcap | Convert MCAP into Rerun-compatible data. |
234234
| re_memory | Run-time memory tracking and profiling. |
235235
| re_perf_telemetry | In and out of process performance profiling utilities for Rerun & Redap |
236+
| re_ros_msg | Parsing and deserializing ROS messages |
236237
| re_smart_channel | A channel that keeps track of latency and queue length. |
237238
| re_span | An integer range that always has a non-negative length |
238239
| re_string_interner | Yet another string interning library |
@@ -243,10 +244,10 @@ Update instructions:
243244

244245
### Test crates
245246

246-
| Crate | Description |
247-
|--------------------|---------------------------------------------------------------|
248-
| re_test_context | Provides a test context that builds on `re_viewer_context. |
249-
| re_test_viewport | Extends the `re_test_context` with viewport-related features. |
247+
| Crate | Description |
248+
| ---------------- | ------------------------------------------------------------- |
249+
| re_test_context | Provides a test context that builds on `re_viewer_context. |
250+
| re_test_viewport | Extends the `re_test_context` with viewport-related features. |
250251

251252
### Dependencies and docs
252253

Cargo.lock

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9001,6 +9001,7 @@ dependencies = [
90019001
"re_chunk",
90029002
"re_log",
90039003
"re_log_types",
9004+
"re_ros_msg",
90049005
"re_tracing",
90059006
"re_types",
90069007
"serde",
@@ -9313,6 +9314,15 @@ dependencies = [
93139314
"winit",
93149315
]
93159316

9317+
[[package]]
9318+
name = "re_ros_msg"
9319+
version = "0.26.0-alpha.1+dev"
9320+
dependencies = [
9321+
"anyhow",
9322+
"serde",
9323+
"thiserror 1.0.69",
9324+
]
9325+
93169326
[[package]]
93179327
name = "re_sdk"
93189328
version = "0.26.0-alpha.1+dev"

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ re_log = { path = "crates/utils/re_log", version = "=0.26.0-alpha.1", default-fe
106106
re_mcap = { path = "crates/utils/re_mcap", version = "=0.26.0-alpha.1", default-features = false }
107107
re_memory = { path = "crates/utils/re_memory", version = "=0.26.0-alpha.1", default-features = false }
108108
re_perf_telemetry = { path = "crates/utils/re_perf_telemetry", version = "=0.26.0-alpha.1", default-features = false }
109+
re_ros_msg = { path = "crates/utils/re_ros_msg", version = "=0.26.0-alpha.1", default-features = false }
109110
re_smart_channel = { path = "crates/utils/re_smart_channel", version = "=0.26.0-alpha.1", default-features = false }
110111
re_span = { path = "crates/utils/re_span", version = "=0.26.0-alpha.1", default-features = false }
111112
re_string_interner = { path = "crates/utils/re_string_interner", version = "=0.26.0-alpha.1", default-features = false }
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
version https://git-lfs.github.com/spec/v1
2-
oid sha256:8a85ec291c84c9dc8a2632b99e0ec6ebb2773a2a8e6c2c85f65290974c89db5a
3-
size 443136
2+
oid sha256:b1a4ac6fa84a2a951884291e6e4ea971186c23dd6369b4f4d0538b030ed0b77a
3+
size 449123

crates/utils/re_mcap/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ workspace = true
1818
re_chunk.workspace = true
1919
re_log.workspace = true
2020
re_log_types.workspace = true
21+
re_ros_msg.workspace = true
2122
re_tracing.workspace = true
2223
re_types = { workspace = true, features = ["ecolor", "glam", "image", "video"] }
2324

crates/utils/re_mcap/src/layers/mod.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ mod protobuf;
22
mod raw;
33
mod recording_info;
44
mod ros2;
5+
mod ros2_reflection;
56
mod schema;
67
mod stats;
78

@@ -10,7 +11,8 @@ use std::collections::{BTreeMap, BTreeSet};
1011

1112
pub use self::{
1213
protobuf::McapProtobufLayer, raw::McapRawLayer, recording_info::McapRecordingInfoLayer,
13-
ros2::McapRos2Layer, schema::McapSchemaLayer, stats::McapStatisticLayer,
14+
ros2::McapRos2Layer, ros2_reflection::McapRos2ReflectionLayer, schema::McapSchemaLayer,
15+
stats::McapStatisticLayer,
1416
};
1517

1618
use crate::{
@@ -324,6 +326,7 @@ impl LayerRegistry {
324326
.register_file_layer::<McapStatisticLayer>()
325327
// message layers (priority order):
326328
.register_message_layer::<McapRos2Layer>()
329+
.register_message_layer::<McapRos2ReflectionLayer>()
327330
.register_message_layer::<McapProtobufLayer>();
328331

329332
if raw_fallback_enabled {

crates/utils/re_mcap/src/layers/raw.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ impl MessageParser for RawMcapMessageParser {
2626
msg: &::mcap::Message<'_>,
2727
) -> anyhow::Result<()> {
2828
re_tracing::profile_function!();
29+
2930
self.data.values().values().append_slice(&msg.data);
3031
self.data.values().append(true);
3132
self.data.append(true);

crates/utils/re_mcap/src/layers/ros2.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
use std::collections::BTreeMap;
22

33
use super::MessageLayer;
4-
use crate::{
5-
parsers::MessageParser,
6-
parsers::ros2msg::{
4+
use crate::parsers::{
5+
MessageParser,
6+
ros2msg::{
77
Ros2MessageParser,
88
rcl_interfaces::LogMessageParser,
99
sensor_msgs::{
@@ -114,6 +114,7 @@ impl MessageLayer for McapRos2Layer {
114114
"Message schema {:?} is currently not supported",
115115
schema.name
116116
);
117+
117118
None
118119
}
119120
}

0 commit comments

Comments
 (0)