Skip to content

Commit

Permalink
Merge branch 'main' into feature/spawn_robots
Browse files Browse the repository at this point in the history
  • Loading branch information
mxgrey authored Jul 7, 2023
2 parents f60ae2f + 3697662 commit 077873a
Show file tree
Hide file tree
Showing 35 changed files with 663 additions and 159 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/style.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ jobs:

- name: rustfmt
run: |
rustup toolchain install nightly
rustup default nightly
rustup component add rustfmt
- name: style
Expand Down
5 changes: 4 additions & 1 deletion rmf_site_editor/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ bevy_polyline = "0.4"
bevy_stl = "0.7.0"
bevy_obj = { git = "https://github.com/luca-della-vedova/bevy_obj", branch = "luca/scene_0.9", features = ["scene"]}
bevy_rapier3d = "0.20.0"
crossbeam-channel = "0.5.0"
smallvec = "*"
serde = { version = "1.0", features = ["derive"] }
serde_yaml = "0.8.23"
Expand All @@ -31,13 +30,17 @@ wasm-bindgen = "=0.2.84"
web-sys = { version = "0.3.56", features = ["console"] }
futures-lite = "1.12.0"
bevy = "0.9"
bevy_utils = "0.9"
dirs = "4.0"
thread_local = "*"
lyon = "1"
thiserror = "*"
rmf_site_format = { path = "../rmf_site_format", features = ["bevy"] }
itertools = "*"
bitfield = "*"
crossbeam-channel = "0.5"
tracing = "0.1.37"
tracing-subscriber = "0.3.1"
rfd = "0.11"
urdf-rs = "0.7"
# sdformat_rs = { path = "../../sdf_rust_experimental/sdformat_rs"}
Expand Down
2 changes: 1 addition & 1 deletion rmf_site_editor/src/interaction/cursor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ pub fn update_cursor_transform(
let mut transform = match transforms.get_mut(cursor.frame) {
Ok(transform) => transform,
Err(_) => {
println!("No cursor transform found");
error!("No cursor transform found");
return;
}
};
Expand Down
2 changes: 1 addition & 1 deletion rmf_site_editor/src/interaction/light.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ pub fn update_physical_light_visual_cues(
if let Some(m) = material_assets.get_mut(material) {
m.base_color = kind.color().into();
} else {
println!("DEV ERROR: Unable to get material asset for light");
error!("Unable to get material asset for light");
}

if kind.is_directional() {
Expand Down
95 changes: 46 additions & 49 deletions rmf_site_editor/src/interaction/select_anchor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,8 @@ impl TargetTransition {
match e {
Some(e) => {
if self.created.is_some() {
println!(
"DEV ERROR: Created a superfluous target while in \
error!(
"Created a superfluous target while in \
SelectAnchor mode"
);
}
Expand All @@ -174,8 +174,8 @@ impl TargetTransition {
None => match self.created {
Some(e) => Some(e),
None => {
println!(
"DEV ERROR: Failed to create an entity while in \
error!(
"Failed to create an entity while in \
SelectAnchor mode"
);
None
Expand Down Expand Up @@ -276,7 +276,7 @@ impl AnchorSelection {
Ok(dep) => dep,
Err(_) => {
// The entity was not a proper anchor
println!("DEV ERROR: Invalid anchor selected {:?}", e);
error!("Invalid anchor selected {:?}", e);
return Err(());
}
};
Expand All @@ -301,7 +301,7 @@ impl AnchorSelection {
let mut deps = match params.dependents.get_mut(*e).map_err(|_| ()) {
Ok(dep) => dep,
Err(_) => {
println!("DEV ERROR: Invalid anchor selected {:?}", e);
error!("Invalid anchor selected {:?}", e);
return Err(());
}
};
Expand Down Expand Up @@ -394,8 +394,8 @@ impl EdgePlacement {
// Do nothing
}
Err(_) => {
println!(
"DEV ERROR: No AnchorDependents component found for \
error!(
"No AnchorDependents component found for \
{:?} while in SelectAnchor mode.",
old_anchor
);
Expand Down Expand Up @@ -435,8 +435,8 @@ impl Placement for EdgePlacement {
match params.edges.get_mut(target) {
Ok((edge, original)) => (target, edge, original),
Err(_) => {
println!(
"DEV ERROR: Entity {:?} is not the right kind of \
error!(
"Entity {:?} is not the right kind of \
element",
target,
);
Expand Down Expand Up @@ -592,15 +592,15 @@ impl Placement for EdgePlacement {
Self::update_dependencies(None, target, old_edge, *edge, params)?;
return Ok((TargetTransition::finished(), self.to_start()).into());
} else {
println!(
"DEV ERROR: Unable to find original for {target:?} \
error!(
"Unable to find original for {target:?} \
while backing out of edge replacement"
);
return Err(());
}
} else {
println!(
"DEV ERROR: Unable to find edge for {target:?} while \
error!(
"Unable to find edge for {target:?} while \
backing out of edge replacement"
);
return Err(());
Expand Down Expand Up @@ -678,8 +678,8 @@ impl Placement for PointPlacement {
let mut point = match params.points.get_mut(target) {
Ok(l) => l,
Err(_) => {
println!(
"DEV ERROR: Unable to get location {:?} while in \
error!(
"Unable to get location {:?} while in \
SelectAnchor mode.",
target
);
Expand Down Expand Up @@ -764,8 +764,8 @@ impl Placement for PointPlacement {
return Ok((TargetTransition::discontinued(), self.transition()).into());
}
} else {
println!(
"DEV ERROR: Cannot find point for location {target:?} while \
error!(
"Cannot find point for location {target:?} while \
trying to back out of SelectAnchor mode"
);
return Err(());
Expand Down Expand Up @@ -862,8 +862,8 @@ impl Placement for PathPlacement {
let (mut path, behavior) = match params.paths.get_mut(target) {
Ok(q) => q,
Err(_) => {
println!(
"DEV ERROR: Unable to find path info for {target:?} while \
error!(
"Unable to find path info for {target:?} while \
in SelectAnchor mode."
);
return Err(());
Expand Down Expand Up @@ -932,8 +932,8 @@ impl Placement for PathPlacement {
let path = match params.paths.get(target) {
Ok(p) => p.0,
Err(_) => {
println!(
"DEV ERROR: Unable to find path for {:?} while in \
error!(
"Unable to find path for {:?} while in \
SelectAnchor mode",
target,
);
Expand All @@ -952,8 +952,8 @@ impl Placement for PathPlacement {
let path = match params.paths.get(target) {
Ok(p) => p.0.clone(),
Err(_) => {
println!(
"DEV ERROR: Unable to find path for {:?} while in \
error!(
"Unable to find path for {:?} while in \
SelectAnchor mode",
target,
);
Expand Down Expand Up @@ -988,17 +988,17 @@ impl Placement for PathPlacement {
return Ok((TargetTransition::finished(), self.restart()).into());
}

println!(
"DEV ERROR: Path of length {} is missing the index {} \
error!(
"Path of length {} is missing the index {} \
that was supposed to be replaced.",
path.len(),
index
);
return Err(());
}

println!(
"DEV ERROR: Unable to find the placement of a path anchor \
error!(
"Unable to find the placement of a path anchor \
that is being replaced."
);
return Err(());
Expand Down Expand Up @@ -1081,8 +1081,8 @@ impl<'w, 's> SelectAnchorPlacementParams<'w, 's> {
let mut deps = match self.dependents.get_mut(to_anchor).map_err(|_| ()) {
Ok(dep) => dep,
Err(_) => {
println!(
"DEV ERROR: Trying to insert invalid anchor \
error!(
"Trying to insert invalid anchor \
{to_anchor:?} into entity {dependent:?}"
);
return Err(());
Expand All @@ -1107,8 +1107,8 @@ impl<'w, 's> SelectAnchorPlacementParams<'w, 's> {
let mut deps = match self.dependents.get_mut(from_anchor).map_err(|_| ()) {
Ok(dep) => dep,
Err(_) => {
println!(
"DEV ERROR: Removing invalid anchor {from_anchor:?} \
error!(
"Removing invalid anchor {from_anchor:?} \
from entity {dependent:?}"
);
return Err(());
Expand Down Expand Up @@ -1432,8 +1432,8 @@ impl SelectAnchor {
params.commands.entity(finished_target).remove::<Pending>();
self.placement.finalize(finished_target, params);
} else {
println!(
"DEV ERROR: An element was supposed to be finished by \
error!(
"An element was supposed to be finished by \
SelectAnchor, but we could not find it"
);
}
Expand Down Expand Up @@ -1665,8 +1665,8 @@ impl SelectAnchor3D {
let (e, anchor) = match params.anchors.get_mut(target) {
Ok(l) => l,
Err(_) => {
println!(
"DEV ERROR: Unable to get anchor {:?} while \
error!(
"Unable to get anchor {:?} while \
replacing 3D Anchor.",
target
);
Expand Down Expand Up @@ -1722,14 +1722,14 @@ impl SelectAnchor3D {
return Ok(());
}
None => {
println!("DEV ERROR: Reassigning parent for entity without a parent");
error!("Reassigning parent for entity without a parent");
return Err(());
}
}
}
return Err(());
} else {
println!("DEV error replacing anchor without original");
error!("DEV error replacing anchor without original");
return Err(());
}
}
Expand Down Expand Up @@ -1790,8 +1790,8 @@ impl SelectAnchor3D {
return Err(());
}
} else {
println!(
"DEV ERROR: Cannot find point for location {target:?} while \
error!(
"Cannot find point for location {target:?} while \
trying to back out of SelectAnchor mode"
);
return Err(());
Expand Down Expand Up @@ -1902,8 +1902,8 @@ pub fn handle_select_anchor_mode(
let for_element = match request.target {
Some(for_element) => for_element,
None => {
println!(
"DEV ERROR: for_element must be Some for ReplaceAnchor. \
error!(
"for_element must be Some for ReplaceAnchor. \
Reverting to Inspect Mode."
);
params.cleanup();
Expand All @@ -1915,8 +1915,8 @@ pub fn handle_select_anchor_mode(
let original = match request.placement.save_original(for_element, &mut params) {
Some(original) => original,
None => {
println!(
"DEV ERROR: cannot locate an original anchor for \
error!(
"cannot locate an original anchor for \
entity {:?}. Reverting to Inspect Mode.",
for_element,
);
Expand Down Expand Up @@ -1960,8 +1960,8 @@ pub fn handle_select_anchor_mode(
let tf = match transforms.get(params.cursor.frame) {
Ok(tf) => tf,
Err(_) => {
println!(
"DEV ERROR: Could not get transform for cursor frame \
error!(
"Could not get transform for cursor frame \
{:?} in SelectAnchor mode.",
params.cursor.frame,
);
Expand Down Expand Up @@ -2191,15 +2191,13 @@ pub fn handle_select_anchor_3d_mode(
parent
}
PlaceableObject::Model(ref a) => {
println!("Creating model for entity {:?}", id);
let mut model = a.clone();
let parent = workspace.root.expect("No workspace");
model.pose = compute_parent_inverse_pose(&cursor_tf, &transforms, parent);
params.commands.entity(id).insert(model);
parent
}
PlaceableObject::WorkcellVisual(ref a) => {
println!("Creating visual for entity {:?}", id);
let mut model = a.clone();
let parent = request
.parent
Expand All @@ -2211,7 +2209,6 @@ pub fn handle_select_anchor_3d_mode(
parent
}
PlaceableObject::WorkcellCollision(ref a) => {
println!("Creating collision for entity {:?}", id);
let mut model = a.clone();
let parent = request
.parent
Expand Down
4 changes: 2 additions & 2 deletions rmf_site_editor/src/keyboard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,14 @@ fn handle_keyboard_input(
if let Some(selection) = selection.0 {
delete.send(Delete::new(selection));
} else {
println!("No selected entity to delete");
warn!("No selected entity to delete");
}
}
}

if keyboard_input.just_pressed(KeyCode::D) {
debug_mode.0 = !debug_mode.0;
println!("Toggling debug mode: {debug_mode:?}");
info!("Toggling debug mode: {debug_mode:?}");
}

// Ctrl keybindings
Expand Down
Loading

0 comments on commit 077873a

Please sign in to comment.