Repository navigation
Conversation
https://github.com/user-attachments/assets/2aa24f8f-a759-452b-9fa8-6cdf4d967d78 Enable drawing conveyor belts and connections to models. Features added: - Conveyor belts drawing from top menu (similar to lanes) - Configurable conveyor belts dimensions (height, width, thickness), and metadata (speed, capacity) via inspector - Conveyor ports on models for conveyor belts to snap to - Billboards on models representing conveyor ports - Configurable conveyor ports properties via inspector/.gltf (port location, direction, width) - Importing models as conveyor nodes via model import from top menu > 'Add as Conveyor Node' - Checks to prevent invalid port connections (forks, multiple ports of same directions) - Texture tiling on belts to visualise conveyor flows between conveyor nodes - .site.json serialisation/deserialisation for conveyors & ports - NavGraph association for conveyors - Example on how to extract conveyor topology for material flow planning ## Implementation description Features implemented were discussed with several Orchestration team members. ### General Approach #### 1. Data serialization in `rmf_site_format` - Represented conveyor belts as `Edge<T>` entities connecting 2 anchors, bundled with dimension components (height, width, thickness), metadata (speed, capacity), and `AssociatedGraphs<T>`. - Models spawned as conveyor nodes store `conveyor_ports`, with each port keyed by the Anchor `SiteID`. Since conveyor edges reference these same Anchor IDs at their endpoints, the material flow topology between workcells and multi-segment belts is directly encoded in the .site.json file #### 2. Conveyor nodes & ports - Models can be imported as `ConveyorNode` via "Add as Conveyor Node" button during import OR via embedded GLTF `conveyor_ports` scene extras OR from `.site.json`. - Port configurations are stored on the model description and synchronized across all of its instances as child `Anchor` entities - Each Port anchor spawns a 2D billboard with a directional arrow (In/Out) for easy visualisation during conveyor drawing #### 3. Conveyor drawing & connection validation - Reused existing `create_edges` / `replace_side` anchor selection state methods with the new `Category::Conveyor`. When hovering near a model port, the cursor snaps to the port's anchor - Added `validate_conveyor_connection` and `validate_conveyor_port_direction` during edge creation, endpoint replacement, and inspector port edits to enforce valid connections - Prevents branching/forks (an anchor can connect to <=2 conveyor segments) - Traverses the connected conveyor chain to disallow multiple `In` ports or multiple `Out` ports on the same chain. #### 4. Chain syncs & visualisation - Uses BFS in `collect_connected_conveyors` over shared `Anchor` `Dependents` to treat connected conveyor segments as a single continuous chain. - Inspector edits to dimensions / metadata propagate to all connected chain segments. Connecting a chain to a `ConveyorPort` automatically snaps the chain's width and height to align with the port configs - Infers the direction of material flow along each connected chain from attached Out/In ports. Each segment's belt mesh UVs are scaled proportionally to the segment's length and width, so that directional arrows from new `conveyor.png` texture tiles uniformly across belt segments. ### Changes to shared systems Some noteworthy changes that were made to systems shared with other entities, which I hope to get some feedback on: #### 1. Added new `OutlineVisualization::Silhouette` - Existing `OutlineVisualization::Ordinary` attaches an `OutlineVolume` to every descendant mesh in the entity's hierarchy. Because conveyors are built out of multiple overlapping sub-meshes (mid-section, end caps, belt overlays, support stands), `Ordinary` rendered internal outlines around each individual sub-mesh instead of outlining the conveyor as a whole. - [+] New `OutlineVisualization::Silhouette` added, which places `OutlineVolume` on the root entity and `InheritOutline` on descendant meshes so all child meshes are merged into a single outer silhouette outline - `update_outline_visualization` previously traversed all `Children` of a hovered/selected entity and inserted/removed outline components on every descendant. When conveyor port `Anchor`s were attached as children of a `ModelInstance`, hovering / unhovering the parent model overwrote the child port anchor's own `OutlineVisualization::Anchor` components. - [+] Added a check (`if top != root && child_vis.is_some() { continue; }`) so parent outline updates do not overwrite child entities managing their own `OutlineVisualization` #### 2. `make_models_selectable` & `ModelLoader::spawn_model_instance` - `make_models_selectable` inserted `Selectable::new(model_entity)` onto every child entity of the parent model. When conveyor port `Anchor`s were spawned as children of a model instance, `make_models_selectable` overwrote each port anchor's `Selectable` component to point to the parent model, making port anchors impossible to hover or select independently. This broke snapping logic between drawn belts and model port anchors. - [+] Updated `make_models_selectable` to insert `interaction` on the ModelInstance entity and traverse only the loaded 3D scene hierarchy. Preserves the independent `Selectable` component on sibling editor attachments like port anchors #### 3. `AnchorFilter` & `are_anchors_siblings` - `AnchorFilter::filter_pick` and `are_anchors_siblings` assumed valid anchors could only be parented to a `Site`/`Level`/`LiftCabin`. Because conveyor port anchors are children of a `ModelInstance`, `AnchorFilter` rejected clicks on port anchors, and `are_anchors_siblings` treated a port anchor and a floor anchor on the same level as being on different levels. This broke conveyor belt snapping logic between port anchors. - [+] Updated `AnchorFilter` to accept anchors parented to a `ModelInstance`, and updated `are_anchors_siblings` and its callers to resolve a model-parented anchor's level by looking up the parent model's parent `ChildOf`. #### 4. `add_anchor_visual_cues` & `update_unassigned_anchor_cues` - `add_anchor_visual_cues` only matched `Category::Level`/`::Lift` when choosing the anchor mesh, falling back to `site_anchor_mesh` for `Category::Model`. `update_unassigned_anchor_cues` also marked any anchor with empty `Dependents` as `unassigned` in xray mode, which froces unconnected model port anchors to stay permanently visible across the map. - [+] Mapped `Category::Model` to `level_anchor_mesh` in `add_anchor_visual_cues`. Added `Without<Subordinate>` to `update_unassigned_anchor_cues` so subordinate port anchors are only visible during conveyor drawing. As far as I can tell, the above changes don't seem to affect other behaviours - let me know if there's any case that I should check for, or if there are more ideal workarounds! ### GenAI Use We follow [OSRA's policy on GenAI tools](https://github.com/openrobotics/osra-policies-and-procedures/blob/main/OSRF%20Policy%20on%20the%20Use%20of%20Generative%20Tools%20(%E2%80%9CGenerative%20AI%E2%80%9D)%20in%20Contributions.md) - [x] I used a GenAI tool in this PR. - [ ] I did not use GenAI Generated-by: Gemini Signed-off-by: Althea Tan <altheatan@google.com> Co-authored-by: Arjo Chakravarty <arjoc@intrinsic.ai>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR is @althea-tan's internship project. She wanted to leave a reviewable stack. Unfortunately, this repo doesn't support stacking yet!
You can find our past conversation here: #460
conveyor_demo.mp4
Enable drawing conveyor belts and connections to models. Features added:
Implementation description
Features implemented were discussed with several Orchestration team members.
General Approach
1. Data serialization in
rmf_site_formatEdge<T>entities connecting 2 anchors, bundled with dimension components (height, width, thickness), metadata (speed, capacity), andAssociatedGraphs<T>.conveyor_ports, with each port keyed by the AnchorSiteID. Since conveyor edges reference these same Anchor IDs at their endpoints, the material flow topology between workcells and multi-segment belts is directly encoded in the .site.json file2. Conveyor nodes & ports
ConveyorNodevia "Add as Conveyor Node" button during import OR via embedded GLTFconveyor_portsscene extras OR from.site.json.Anchorentities3. Conveyor drawing & connection validation
create_edges/replace_sideanchor selection state methods with the newCategory::Conveyor. When hovering near a model port, the cursor snaps to the port's anchorvalidate_conveyor_connectionandvalidate_conveyor_port_directionduring edge creation, endpoint replacement, and inspector port edits to enforce valid connectionsInports or multipleOutports on the same chain.4. Chain syncs & visualisation
collect_connected_conveyorsover sharedAnchorDependentsto treat connected conveyor segments as a single continuous chain.ConveyorPortautomatically snaps the chain's width and height to align with the port configsconveyor.pngtexture tiles uniformly across belt segments.Changes to shared systems
Some noteworthy changes that were made to systems shared with other entities, which I hope to get some feedback on:
1. Added new
OutlineVisualization::SilhouetteOutlineVisualization::Ordinaryattaches anOutlineVolumeto every descendant mesh in the entity's hierarchy. Because conveyors are built out of multiple overlapping sub-meshes (mid-section, end caps, belt overlays, support stands),Ordinaryrendered internal outlines around each individual sub-mesh instead of outlining the conveyor as a whole.OutlineVisualization::Silhouetteadded, which placesOutlineVolumeon the root entity andInheritOutlineon descendant meshes so all child meshes are merged into a single outer silhouette outlineupdate_outline_visualizationpreviously traversed allChildrenof a hovered/selected entity and inserted/removed outline components on every descendant. When conveyor portAnchors were attached as children of aModelInstance, hovering / unhovering the parent model overwrote the child port anchor's ownOutlineVisualization::Anchorcomponents.if top != root && child_vis.is_some() { continue; }) so parent outline updates do not overwrite child entities managing their ownOutlineVisualization2.
make_models_selectable&ModelLoader::spawn_model_instancemake_models_selectableinsertedSelectable::new(model_entity)onto every child entity of the parent model. When conveyor portAnchors were spawned as children of a model instance,make_models_selectableoverwrote each port anchor'sSelectablecomponent to point to the parent model, making port anchors impossible to hover or select independently. This broke snapping logic between drawn belts and model port anchors.make_models_selectableto insertinteractionon the ModelInstance entity and traverse only the loaded 3D scene hierarchy. Preserves the independentSelectablecomponent on sibling editor attachments like port anchors3.
AnchorFilter&are_anchors_siblingsAnchorFilter::filter_pickandare_anchors_siblingsassumed valid anchors could only be parented to aSite/Level/LiftCabin. Because conveyor port anchors are children of aModelInstance,AnchorFilterrejected clicks on port anchors, andare_anchors_siblingstreated a port anchor and a floor anchor on the same level as being on different levels. This broke conveyor belt snapping logic between port anchors.AnchorFilterto accept anchors parented to aModelInstance, and updatedare_anchors_siblingsand its callers to resolve a model-parented anchor's level by looking up the parent model's parentChildOf.4.
add_anchor_visual_cues&update_unassigned_anchor_cuesadd_anchor_visual_cuesonly matchedCategory::Level/::Liftwhen choosing the anchor mesh, falling back tosite_anchor_meshforCategory::Model.update_unassigned_anchor_cuesalso marked any anchor with emptyDependentsasunassignedin xray mode, which froces unconnected model port anchors to stay permanently visible across the map.Category::Modeltolevel_anchor_meshinadd_anchor_visual_cues. AddedWithout<Subordinate>toupdate_unassigned_anchor_cuesso subordinate port anchors are only visible during conveyor drawing.As far as I can tell, the above changes don't seem to affect other behaviours - let me know if there's any case that I should check for, or if there are more ideal workarounds!
GenAI Use
We follow OSRA's policy on GenAI tools
Generated-by: Gemini