Skip to content

Commit

Permalink
Fix compilation for rmf_site_format
Browse files Browse the repository at this point in the history
Signed-off-by: Luca Della Vedova <[email protected]>
  • Loading branch information
luca-della-vedova committed Aug 11, 2023
1 parent d2fb61f commit 5dbc16d
Show file tree
Hide file tree
Showing 10 changed files with 28 additions and 26 deletions.
10 changes: 8 additions & 2 deletions .github/workflows/ci_linux.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,13 @@ jobs:
sudo apt-get update
sudo apt-get install libasound2-dev libudev-dev libgtk-3-dev
- uses: actions/checkout@v3
- name: Build
run: cargo build
- name: Build rmf_site_format
run: |
cd rmf_site_format
cargo build
- name: Build rmf_site_editor
run: |
cd -
cargo build
- name: Run tests
run: cargo test
4 changes: 1 addition & 3 deletions rmf_site_editor/src/site/save.rs
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,6 @@ fn generate_levels(
&AssetSource,
&Pose,
&IsStatic,
&ConstraintDependents,
&Scale,
&SiteID,
&Parent,
Expand Down Expand Up @@ -450,7 +449,7 @@ fn generate_levels(
}
}

for (name, source, pose, is_static, constraint_dependents, scale, id, parent) in &q_models {
for (name, source, pose, is_static, scale, id, parent) in &q_models {
if let Ok((_, level_id, _, _, _)) = q_levels.get(parent.get()) {
if let Some(level) = levels.get_mut(&level_id.0) {
level.models.insert(
Expand All @@ -460,7 +459,6 @@ fn generate_levels(
source: source.clone(),
pose: pose.clone(),
is_static: is_static.clone(),
constraints: constraint_dependents.clone(),
scale: scale.clone(),
marker: ModelMarker,
},
Expand Down
5 changes: 2 additions & 3 deletions rmf_site_editor/src/site/sdf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ use crate::SdfRoot;
use sdformat_rs::{SdfGeometry, SdfPose, Vector3d};

use rmf_site_format::{
Angle, AssetSource, ConstraintDependents, Geometry, IsStatic, MeshPrimitive, Model,
ModelMarker, NameInSite, Pose, Rotation, Scale, WorkcellCollisionMarker, WorkcellVisualMarker,
Angle, AssetSource, Geometry, IsStatic, MeshPrimitive, Model, ModelMarker, NameInSite, Pose,
Rotation, Scale, WorkcellCollisionMarker, WorkcellVisualMarker,
};

// TODO(luca) reduce chances for panic and do proper error handling here
Expand Down Expand Up @@ -92,7 +92,6 @@ pub fn handle_new_sdf_roots(mut commands: Commands, new_sdfs: Query<(Entity, &Sd
source: compute_model_source(&sdf.path, &mesh.uri),
pose,
is_static: IsStatic(sdf.model.r#static.unwrap_or(false)),
constraints: ConstraintDependents::default(),
scale: parse_scale(&mesh.scale),
marker: ModelMarker,
})
Expand Down
2 changes: 1 addition & 1 deletion rmf_site_format/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ serde_yaml = "0.8.23"
serde_json = "*"
ron = "0.7"
thiserror = "*"
glam = "0.22"
glam = { version = "0.22", features = ["serde"] }
# add features=["bevy"] to a dependent Cargo.toml to get the bevy-related features
bevy = { version = "0.9", optional = true }
urdf-rs = "0.7"
Expand Down
5 changes: 2 additions & 3 deletions rmf_site_format/src/legacy/model.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::{
Angle, AssetSource, ConstraintDependents, IsStatic, Model as SiteModel, ModelMarker,
NameInSite, Pose, Rotation, Scale,
Angle, AssetSource, IsStatic, Model as SiteModel, ModelMarker, NameInSite, Pose, Rotation,
Scale,
};
use glam::DVec2;
use serde::{Deserialize, Serialize};
Expand Down Expand Up @@ -33,7 +33,6 @@ impl Model {
rot: Rotation::Yaw(Angle::Deg(self.yaw.to_degrees() as f32)),
},
is_static: IsStatic(self.static_),
constraints: ConstraintDependents::default(),
scale: Scale::default(),
marker: ModelMarker,
}
Expand Down
10 changes: 8 additions & 2 deletions rmf_site_format/src/legacy/nav_graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,13 +172,19 @@ impl NavVertexProperties {
None => return props,
};
props.name = location.name.0.clone();
props.is_charger = location.tags.iter().find(|t| t.is_charger()).is_some();
props.is_charger = location.tags.0.iter().find(|t| t.is_charger()).is_some();
props.is_holding_point = location
.tags
.0
.iter()
.find(|t| t.is_holding_point())
.is_some();
props.is_parking_spot = location.tags.iter().find(|t| t.is_parking_spot()).is_some();
props.is_parking_spot = location
.tags
.0
.iter()
.find(|t| t.is_parking_spot())
.is_some();

props
}
Expand Down
5 changes: 2 additions & 3 deletions rmf_site_format/src/legacy/vertex.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use super::rbmf::*;
use crate::{
is_default, AssetSource, AssociatedGraphs, ConstraintDependents, IsStatic, Location,
LocationTag, LocationTags, Model, ModelMarker, NameInSite, Pose, Scale,
is_default, AssetSource, AssociatedGraphs, IsStatic, Location, LocationTag, LocationTags,
Model, ModelMarker, NameInSite, Pose, Scale,
};
use glam::DVec2;
use serde::{Deserialize, Serialize};
Expand Down Expand Up @@ -63,7 +63,6 @@ impl Vertex {
source: AssetSource::Search(me.spawn_robot_type.1.clone()),
pose: Pose::default(),
is_static: IsStatic(false),
constraints: ConstraintDependents::default(),
scale: Scale::default(),
marker: ModelMarker,
}))
Expand Down
4 changes: 2 additions & 2 deletions rmf_site_format/src/misc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,8 @@ impl RectFace {
}
}

#[derive(Serialize, Deserialize, Deref, DerefMut, PartialEq, Clone, Debug)]
#[cfg_attr(feature = "bevy", derive(Component))]
#[derive(Serialize, Deserialize, PartialEq, Clone, Debug)]
#[cfg_attr(feature = "bevy", derive(Component, Deref, DerefMut))]
pub struct Scale(pub Vec3);

impl Default for Scale {
Expand Down
5 changes: 0 additions & 5 deletions rmf_site_format/src/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@ pub struct Model {
#[serde(default, skip_serializing_if = "is_default")]
/// Whether this model should be able to move in simulation
pub is_static: IsStatic,
#[serde(skip)]
/// List of mesh constraints that apply to this model
/// Skipped in serialization since the information is already contained in MeshConstraints
pub constraints: ConstraintDependents,
/// Scale to be applied to the model
#[serde(default, skip_serializing_if = "is_default")]
pub scale: Scale,
Expand All @@ -55,7 +51,6 @@ impl Default for Model {
source: AssetSource::default(),
pose: Pose::default(),
is_static: IsStatic(false),
constraints: ConstraintDependents::default(),
scale: Scale::default(),
marker: ModelMarker,
}
Expand Down
4 changes: 2 additions & 2 deletions rmf_site_format/src/workcell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ pub enum MeshElement {

/// Attached to Model entities to keep track of constraints attached to them,
/// for change detection and hierarchy propagation
#[derive(Serialize, Deserialize, Debug, Default, Clone, PartialEq)]
#[cfg_attr(feature = "bevy", derive(Component, Deref, DerefMut))]
#[cfg(feature = "bevy")]
#[derive(Component, Deref, DerefMut, Serialize, Deserialize, Debug, Default, Clone, PartialEq)]
pub struct ConstraintDependents(pub HashSet<Entity>);

#[derive(Serialize, Deserialize, Debug, Default, Clone)]
Expand Down

0 comments on commit 5dbc16d

Please sign in to comment.