Skip to content

Commit 31bb77c

Browse files
luca-della-vedovamxgreyxiyuoh
authored
Add support for mutex groups (#350)
Signed-off-by: Luca Della Vedova <lucadv@intrinsic.ai> Signed-off-by: Michael X. Grey <greyxmike@gmail.com> Signed-off-by: Xiyu Oh <xiyu@openrobotics.org> Co-authored-by: Grey <mxgrey@intrinsic.ai> Co-authored-by: Xiyu <xiyu@openrobotics.org> Co-authored-by: Grey <greyxmike@gmail.com>
1 parent d30f36a commit 31bb77c

File tree

24 files changed

+957
-161
lines changed

24 files changed

+957
-161
lines changed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

assets/demo_maps/test.site.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -690,6 +690,7 @@
690690
66,
691691
67
692692
],
693+
"mutex": 133,
693694
"graphs": {
694695
"Only": [
695696
71
@@ -701,6 +702,7 @@
701702
67,
702703
64
703704
],
705+
"mutex": 133,
704706
"graphs": "All"
705707
},
706708
"75": {
@@ -837,6 +839,11 @@
837839
]
838840
}
839841
}
842+
},
843+
"mutex_groups": {
844+
"133": {
845+
"name": "mutex_1"
846+
}
840847
}
841848
}
842849
},

crates/rmf_site_editor/src/site/assets.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ pub(crate) fn add_site_assets(app: &mut App) {
3838
embedded_asset!(app, "src/", "textures/charging.png");
3939
embedded_asset!(app, "src/", "textures/parking.png");
4040
embedded_asset!(app, "src/", "textures/holding.png");
41+
embedded_asset!(app, "src/", "textures/lockpad.png");
4142
embedded_asset!(app, "src/", "textures/empty.png");
4243
embedded_asset!(app, "src/", "textures/door_cue.png");
4344
embedded_asset!(app, "src/", "textures/door_cue_highlighted.png");
@@ -149,6 +150,7 @@ pub struct SiteAssets {
149150
pub charger_material: Handle<StandardMaterial>,
150151
pub holding_point_material: Handle<StandardMaterial>,
151152
pub parking_material: Handle<StandardMaterial>,
153+
pub lockpad_material: Handle<StandardMaterial>,
152154
pub empty_billboard_material: Handle<StandardMaterial>,
153155
pub robot_path_rectangle_mesh: Handle<Mesh>,
154156
pub robot_path_circle_mesh: Handle<Mesh>,
@@ -185,6 +187,8 @@ impl FromWorld for SiteAssets {
185187
asset_server.load("embedded://librmf_site_editor/site/textures/holding.png");
186188
let parking_texture =
187189
asset_server.load("embedded://librmf_site_editor/site/textures/parking.png");
190+
let lockpad_texture =
191+
asset_server.load("embedded://librmf_site_editor/site/textures/lockpad.png");
188192
let empty_billboard_texture =
189193
asset_server.load("embedded://librmf_site_editor/site/textures/empty.png");
190194
let door_cue_texture =
@@ -283,6 +287,7 @@ impl FromWorld for SiteAssets {
283287
materials.add(billboard_material(charger_texture));
284288
let holding_point_material = materials.add(billboard_material(holding_point_texture));
285289
let parking_material = materials.add(billboard_material(parking_texture));
290+
let lockpad_material = materials.add(billboard_material(lockpad_texture));
286291
let empty_billboard_material = materials.add(billboard_material(empty_billboard_texture));
287292

288293
let mut meshes = world.get_resource_mut::<Assets<Mesh>>().unwrap();
@@ -393,6 +398,7 @@ impl FromWorld for SiteAssets {
393398
charger_material,
394399
holding_point_material,
395400
parking_material,
401+
lockpad_material,
396402
empty_billboard_material,
397403
robot_path_rectangle_mesh,
398404
robot_path_circle_mesh,

crates/rmf_site_editor/src/site/load.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -549,6 +549,16 @@ fn generate_site_entities(
549549
consider_id(*fiducial_id);
550550
}
551551

552+
for (group_id, group) in &site_data.navigation.guided.mutex_groups {
553+
let group_entity = commands
554+
.spawn(group.clone())
555+
.insert(SiteID(*group_id))
556+
.insert(ChildOf(site_id))
557+
.id();
558+
id_to_entity.insert(*group_id, group_entity);
559+
consider_id(*group_id);
560+
}
561+
552562
for (nav_graph_id, nav_graph_data) in &site_data.navigation.guided.graphs {
553563
let nav_graph = commands
554564
.spawn((Transform::default(), Visibility::default()))

0 commit comments

Comments
 (0)