diff --git a/rmf_site_format/src/legacy/lift.rs b/rmf_site_format/src/legacy/lift.rs index d5d16b11..5022bd83 100644 --- a/rmf_site_format/src/legacy/lift.rs +++ b/rmf_site_format/src/legacy/lift.rs @@ -45,8 +45,14 @@ impl Lift { // TODO(MXG): Rewrite this with glam now that we've accepted it as a dependency let x = self.x as f32; let y = self.y as f32; - let d = self.depth as f32 / 2.0; - let w = self.width as f32 / 2.0; + // NOTE: Coordinate axes changed between the legacy format and the + // new format. Width used to be along the local x axis, and depth + // used to be along the local y axis, but now that is flipped to + // better align with the robotics convention of the local x axis + // being forward/backward while the local y axis is the lateral + // direction (side-to-side). + let d = self.width as f32 / 2.0; + let w = self.depth as f32 / 2.0; let theta = self.yaw as f32; let rotate = |x, y| { ( @@ -95,8 +101,14 @@ impl Lift { let dx = door.x as f32; let dy = door.y as f32; - let half_width = self.width as f32 / 2.0; - let half_depth = self.depth as f32 / 2.0; + // NOTE: Coordinate axes changed between the legacy format and the + // new format. Width used to be along the local x axis, and depth + // used to be along the local y axis, but now that is flipped to + // better align with the robotics convention of the local x axis + // being forward/backward while the local y axis is the lateral + // direction (side-to-side). + let half_width = self.depth as f32 / 2.0; + let half_depth = self.width as f32 / 2.0; let cabin_face = if dx.abs() < 1e-3 { // Very small x value means the door must be on the left or right face @@ -208,8 +220,14 @@ impl Lift { } } - let width = self.width as f32; - let depth = self.depth as f32; + // NOTE: Coordinate axes changed between the legacy format and the + // new format. Width used to be along the local x axis, and depth + // used to be along the local y axis, but now that is flipped to + // better align with the robotics convention of the local x axis + // being forward/backward while the local y axis is the lateral + // direction (side-to-side). + let width = self.depth as f32; + let depth = self.width as f32; let cabin = RectangularLiftCabin { width, depth,