Skip to content

Commit

Permalink
First implementation of Open-RMF workcell editor
Browse files Browse the repository at this point in the history
Signed-off-by: Luca Della Vedova <[email protected]>
Co-authored-by: Grey <[email protected]>
  • Loading branch information
luca-della-vedova and mxgrey authored Jan 8, 2025
1 parent 013d49d commit fe3f6bf
Show file tree
Hide file tree
Showing 58 changed files with 5,857 additions and 0 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/ci_linux.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: ci_linux

on:
pull_request:
workflow_dispatch:
push:
branches: [main]

env:
CARGO_TERM_COLOR: always

jobs:
build:

runs-on: ubuntu-latest

steps:
- name: deps
run: |
sudo apt-get update
sudo apt-get install libasound2-dev libudev-dev libgtk-3-dev
- uses: actions/checkout@v3
- name: Build rmf_workcell_format
run: |
cd rmf_workcell_format
cargo build
- name: Build rmf_workcell_editor
run: cargo build
- name: Run tests
run: cargo test
40 changes: 40 additions & 0 deletions .github/workflows/ci_web.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: ci_web

on:
pull_request:
workflow_dispatch:
push:
branches: [main]

env:
CARGO_TERM_COLOR: always

jobs:
build:

runs-on: ubuntu-latest

steps:

- name: rust-wasm-target
run: |
rustup target add wasm32-unknown-unknown
- name: apt-deps
run: |
sudo apt-get update
sudo apt-get install libasound2-dev libudev-dev binaryen
- name: cargo-deps
run: |
cargo install -f wasm-bindgen-cli --version 0.2.93
- uses: actions/checkout@v3

- name: build rmf_workcell_format
run: |
cd rmf_workcell_format
cargo build
- name: build rmf_workcell_editor
run: scripts/build-web.sh
42 changes: 42 additions & 0 deletions .github/workflows/ci_windows.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: ci_windows
on:
pull_request:
workflow_dispatch:
push:
branches: [main]

jobs:
build:
runs-on: windows-latest

steps:
- name: checkout
uses: actions/checkout@v3

# Run build
- name: Install Rustup using win.rustup.rs
run: |
# Disable the download progress bar which can cause perf issues
$ProgressPreference = "SilentlyContinue"
Invoke-WebRequest https://win.rustup.rs/ -OutFile rustup-init.exe
.\rustup-init.exe -y --default-host=x86_64-pc-windows-msvc --default-toolchain=none
del rustup-init.exe
rustup target add x86_64-pc-windows-msvc
shell: powershell

- name: build rmf_workcell_format
run: |
cd rmf_workcell_format
cargo build
- name: build rmf_workcell_editor
run: |
rustc -Vv
cargo -V
cargo build
shell: cmd

- name: test
run: |
cargo test
shell: cmd
29 changes: 29 additions & 0 deletions .github/workflows/style.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: style

on:
pull_request:
workflow_dispatch:
push:
branches: [main]

env:
CARGO_TERM_COLOR: always

jobs:
style:

runs-on: ubuntu-latest

steps:

- uses: actions/checkout@v3

- name: rustfmt
run: |
rustup component add rustfmt
- name: style
run: rustfmt --check --edition 2021 rmf_workcell_format/src/lib.rs rmf_workcell_editor/src/lib.rs rmf_workcell_editor/src/main.rs

- name: minimal feature build
run: cd rmf_workcell_format && cargo check --no-default-features
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
target
web/librmf_workcell_editor.d.ts
web/librmf_workcell_editor.js
web/librmf_workcell_editor_bg.wasm
web/librmf_workcell_editor_bg_optimized.wasm
web/librmf_workcell_editor_bg.wasm.d.ts
/test_output/
22 changes: 22 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[workspace]
members = [
"rmf_workcell_editor",
"rmf_workcell_format",
]

# This is needed for packages that are part of a workspace to use the 2nd version
# of the cargo dependency resolving algorithm. In ordinary crates this would be
# enabled with edition="2021", but it seems that when a crate is in a workspace,
# the workspace needs to explicitly specify this.
# For more see: https://doc.rust-lang.org/edition-guide/rust-2021/default-cargo-resolver.html
resolver = "2"

# Compile time optimizations as suggested in
# https://bevyengine.org/learn/quick-start/getting-started/setup/#compile-with-performance-optimizations
# Enable a small amount of optimization in debug mode
[profile.dev]
opt-level = 1

# Enable high optimizations for dependencies (incl. Bevy), but not for our code:
[profile.dev.package."*"]
opt-level = 3
86 changes: 86 additions & 0 deletions assets/demo_workcells/demo.workcell.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
{
"name": "test_workcell",
"id": 0,
"frames": {
"1": {
"parent": 0,
"name": "frame_1",
"Pose3D": {
"trans": [
5.0,
0.0,
0.0
],
"rot": {
"euler_xyz": [
{
"deg": 45.0
},
{
"deg": 30.0
},
{
"deg": 90.0
}
]
}
}
},
"2": {
"parent": 0,
"name": "frame_2",
"Pose3D": {
"trans": [
0.0,
5.0,
0.0
],
"rot": {
"euler_xyz": [
{
"deg": 45.0
},
{
"deg": 30.0
},
{
"deg": 90.0
}
]
}
}
},
"3": {
"parent": 1,
"name": "frame_3",
"Pose3D": {
"trans": [
1.0,
0.31817698,
0.60250926
],
"rot": {
"euler_xyz": [
{
"deg": 92.758385
},
{
"deg": -73.071754
},
{
"deg": -171.64337
}
]
}
}
}
},
"visuals": {
},
"collisions": {
},
"inertias": {
},
"joints": {
}
}
35 changes: 35 additions & 0 deletions rmf_workcell_editor/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
[package]
name = "rmf_workcell_editor"
version = "0.0.1"
edition = "2021"

[lib]
crate-type = ["cdylib", "rlib"]
name = "librmf_workcell_editor"

[[bin]]
path = "src/main.rs"
name = "rmf_workcell_editor"

[dependencies]
# PR merged after 0.10 but not released yet, bump to 0.10.1 once merged
bevy_infinite_grid = { git = "https://github.com/ForesightMiningSoftwareCorporation/bevy_infinite_grid", rev = "86018dd" }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
wasm-bindgen = "=0.2.93"
bevy = { version = "0.12", features = ["pnm", "jpeg", "tga"] }
thiserror = "*"
rmf_workcell_format = { path = "../rmf_workcell_format", features = ["bevy_support"] }
rmf_site_editor = { git = "https://github.com/open-rmf/rmf_site", tag = "v0.0.1"}
urdf-rs = "0.7"
yaserde = "0.7"
tera = "1.19.1"
anyhow = "*"

[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
clap = { version = "4.0.10", features = ["color", "derive", "help", "usage", "suggestions"] }
bevy_impulse = { git = "https://github.com/open-rmf/bevy_impulse", branch = "main" }

[target.'cfg(target_arch = "wasm32")'.dependencies]
console_error_panic_hook = "0.1.7"
bevy_impulse = { git = "https://github.com/open-rmf/bevy_impulse", branch = "main", features = ["single_threaded_async"]}
16 changes: 16 additions & 0 deletions rmf_workcell_editor/package.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<package format="3">
<name>rmf_workcell_editor</name>
<version>0.0.1</version>
<description>An editor and visualizer for workcells</description>
<maintainer email="[email protected]">Luca Della Vedova</maintainer>
<license>Apache License 2.0</license>

<depend>rmf_workcell_format</depend>
<depend>gtk3</depend>
<depend>libudev-dev</depend>
<depend>libasound2-dev</depend>

<export>
<build_type>ament_cargo</build_type>
</export>
</package>
5 changes: 5 additions & 0 deletions rmf_workcell_editor/src/demo_world.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pub fn demo_workcell() -> Vec<u8> {
return include_str!("../../assets/demo_workcells/demo.workcell.json")
.as_bytes()
.to_vec();
}
48 changes: 48 additions & 0 deletions rmf_workcell_editor/src/interaction/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*
* Copyright (C) 2022 Open Source Robotics Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/

pub use librmf_site_editor::interaction::InteractionPlugin as SiteInteractionPlugin;
// Reexported types used for widgets / plugins
pub use librmf_site_editor::interaction::{
aligned_z_axis, extract_selector_input, hover_service, print_if_err, set_visibility,
AnchorVisualization, CategoryVisibility, CategoryVisibilityPlugin, CommonNodeErrors, Cursor,
DragPlaneBundle, GizmoBlockers, HighlightAnchors, Hover, Hovering, InspectorFilter,
InspectorService, InteractionAssets, InteractionState, IntersectGroundPlaneParams,
PickingBlockers, Preview, RunSelector, Select, Selectable, Selection, SelectionFilter,
SelectionNodeResult, SelectionServiceStages, SelectorInput, SetCategoryVisibility,
SiteRaycastSet, VisualCue,
};

use crate::WorkcellVisualizationMarker;

pub mod select;
pub use select::*;

use bevy::prelude::*;

#[derive(Default)]
pub struct InteractionPlugin;

impl Plugin for InteractionPlugin {
fn build(&self, app: &mut App) {
app.add_plugins((
SiteInteractionPlugin::default(),
CategoryVisibilityPlugin::<WorkcellVisualizationMarker>::visible(true),
place_object::ObjectPlacementPlugin::default(),
));
}
}
24 changes: 24 additions & 0 deletions rmf_workcell_editor/src/interaction/select.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
* Copyright (C) 2022 Open Source Robotics Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/

pub mod place_object;
pub use place_object::*;

pub mod place_object_3d;
pub use place_object_3d::*;

pub mod replace_parent_3d;
Loading

0 comments on commit fe3f6bf

Please sign in to comment.