Skip to content

Add conveyor belts (#460) - #465

Open
arjo129 wants to merge 1 commit into
mainfrom
epic/conveyors
Open

arjo129 wants to merge 1 commit into
mainfrom
epic/conveyors

Conversation

@arjo129

@arjo129 arjo129 commented Dec 1, 2026

Copy link
Copy Markdown
Member

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:

  • 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 Anchors 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 Anchors 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

  • I used a GenAI tool in this PR.
  • I did not use GenAI

Generated-by: Gemini

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>
@mxgrey mxgrey added this to PMC Board Dec 1, 2026
@github-project-automation github-project-automation Bot moved this to Inbox in PMC Board Dec 1, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Inbox

Development

Successfully merging this pull request may close these issues.

2 participants