Skip to content

Commit 7c6d8d3

Browse files
emilkoxkitsune
andauthored
Simple built-in URDF loader (#10105)
### Related * Closes #10114 ### What Add built-in support for loading .urdf files. ### Shortcomings * Is missing support for cylinders: #1361 * Logging both visual and collision meshes leads to Z fighting. Could be solved with #6541 * We get very deep entity trees (see #1533) * No support for external mesh files on web ### Testing You can use these urdf meshes: * https://github.com/unitreerobotics/unitree_ros/tree/master/robots/g1_description * https://github.com/TheRobotStudio/SO-ARM100/blob/main/Simulation/SO100/so100.urdf * https://github.com/Daniella1/urdf_files_dataset ### TODO * [x] Some web support * [x] Add support for other primitives than meshes * [x] Log colors from URDF as albedo_factor overrides to Rerun * [x] Try drag-dropping in an .urdf file in the native viewer * [x] Try drag-dropping in an .urdf file in the web viewer * [x] Handle non-relative mesh paths * Add an URDF to git lfs for testing? * Test animating a robot arm by logging joint angles separately <img width="1303" alt="Screenshot 2025-05-31 at 11 17 44" src="https://github.com/user-attachments/assets/e3206d26-e1cf-4161-b1d5-ecd58fe6d07b" /> --------- Co-authored-by: Gijs de Jong <[email protected]> Co-authored-by: Gijs de Jong <[email protected]>
1 parent 21d5858 commit 7c6d8d3

File tree

8 files changed

+672
-2
lines changed

8 files changed

+672
-2
lines changed

Cargo.lock

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22
# It is not intended for manual editing.
33
version = 4
44

5+
[[package]]
6+
name = "RustyXML"
7+
version = "0.3.0"
8+
source = "registry+https://github.com/rust-lang/crates.io-index"
9+
checksum = "8b5ace29ee3216de37c0546865ad08edef58b0f9e76838ed8959a84a990e58c5"
10+
511
[[package]]
612
name = "ab_glyph"
713
version = "0.2.29"
@@ -6823,6 +6829,7 @@ dependencies = [
68236829
"serde",
68246830
"serde_json",
68256831
"thiserror 1.0.65",
6832+
"urdf-rs",
68266833
"walkdir",
68276834
]
68286835

@@ -9075,6 +9082,18 @@ dependencies = [
90759082
"wasm-bindgen",
90769083
]
90779084

9085+
[[package]]
9086+
name = "serde-xml-rs"
9087+
version = "0.6.0"
9088+
source = "registry+https://github.com/rust-lang/crates.io-index"
9089+
checksum = "fb3aa78ecda1ebc9ec9847d5d3aba7d618823446a049ba2491940506da6e2782"
9090+
dependencies = [
9091+
"log",
9092+
"serde",
9093+
"thiserror 1.0.65",
9094+
"xml-rs",
9095+
]
9096+
90789097
[[package]]
90799098
name = "serde_derive"
90809099
version = "1.0.219"
@@ -10318,6 +10337,20 @@ version = "0.9.0"
1031810337
source = "registry+https://github.com/rust-lang/crates.io-index"
1031910338
checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1"
1032010339

10340+
[[package]]
10341+
name = "urdf-rs"
10342+
version = "0.9.0"
10343+
source = "registry+https://github.com/rust-lang/crates.io-index"
10344+
checksum = "074515a3e6dc230bbbdcf35830fd71b67b55ae2ac22bc4ff69d89412fc84b830"
10345+
dependencies = [
10346+
"RustyXML",
10347+
"quick-xml 0.36.2",
10348+
"regex",
10349+
"serde",
10350+
"serde-xml-rs",
10351+
"thiserror 1.0.65",
10352+
]
10353+
1032110354
[[package]]
1032210355
name = "ureq"
1032310356
version = "2.10.1"

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,7 @@ tracing = { version = "0.1", default-features = false }
332332
type-map = "0.5"
333333
typenum = "1.15"
334334
unindent = "0.2"
335+
urdf-rs = "0.9.0"
335336
ureq = "2.9.2"
336337
url = "2.3"
337338
uuid = "1.1"

crates/store/re_data_loader/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ re_log_types.workspace = true
3333
re_log.workspace = true
3434
re_smart_channel.workspace = true
3535
re_tracing.workspace = true
36-
re_types = { workspace = true, features = ["image", "video"] }
36+
re_types = { workspace = true, features = ["ecolor", "glam", "image", "video"] }
3737

3838
ahash.workspace = true
3939
anyhow.workspace = true
@@ -49,6 +49,7 @@ rayon.workspace = true
4949
serde.workspace = true
5050
serde_json.workspace = true
5151
thiserror.workspace = true
52+
urdf-rs.workspace = true
5253
walkdir.workspace = true
5354

5455
[target.'cfg(not(any(target_arch = "wasm32")))'.dependencies]

crates/store/re_data_loader/src/lib.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,11 @@ pub mod loader_lerobot;
2424
#[cfg(not(target_arch = "wasm32"))]
2525
mod loader_external;
2626

27+
mod loader_urdf;
28+
2729
pub use self::{
2830
load_file::load_from_file_contents, loader_archetype::ArchetypeLoader,
29-
loader_directory::DirectoryLoader, loader_rrd::RrdLoader,
31+
loader_directory::DirectoryLoader, loader_rrd::RrdLoader, loader_urdf::UrdfDataLoader,
3032
};
3133

3234
#[cfg(not(target_arch = "wasm32"))]
@@ -397,6 +399,7 @@ static BUILTIN_LOADERS: Lazy<Vec<Arc<dyn DataLoader>>> = Lazy::new(|| {
397399
Arc::new(LeRobotDatasetLoader),
398400
#[cfg(not(target_arch = "wasm32"))]
399401
Arc::new(ExternalLoader),
402+
Arc::new(UrdfDataLoader),
400403
]
401404
});
402405

0 commit comments

Comments
 (0)