Skip to content

Commit a2f0c59

Browse files
committed
Add HCDF fragment enhancement with composite visuals and frames
- Add cache module with SHA-based model deduplication - Support composite visuals (multiple GLB models per device) - Add reference frame visualization with hover tooltips - Implement HCDF fragment loading from XML files - Add MCUmgr HCDF group constants for remote queries - Update fragment matching (exact vs wildcard) - Add FrameGizmo component with RGB axis rendering - Add "Show Reference Frames" checkbox in UI - Rename mcnt1hub.glb to mcxnt1hub.glb Signed-off-by: Benjamin Perseghetti <bperseghetti@rudislabs.com>
1 parent 8aeab41 commit a2f0c59

File tree

20 files changed

+1813
-156
lines changed

20 files changed

+1813
-156
lines changed

Cargo.lock

Lines changed: 34 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 58 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ cargo build --release -p dendrite-qr
6565
| `dendrite-daemon` | Main daemon binary with web server and discovery |
6666
| `dendrite-web` | Bevy-based WebGPU visualization (compiles to WASM) |
6767
| `dendrite-qr` | CLI tool to generate QR codes for mobile connection |
68-
| `dendrite-core` | Core types, device registry, fragment loading |
68+
| `dendrite-core` | Core types, HCDF parsing, fragment database, SHA-based caching |
6969
| `dendrite-mcumgr` | Async MCUmgr protocol client (wraps mcumgr-client) |
7070
| `dendrite-discovery` | Network discovery (ARP scanning, MCUmgr probing) |
7171

@@ -202,44 +202,73 @@ ws.onmessage = (e) => {
202202

203203
## Device Fragments
204204

205-
Device definitions are stored in `fragments/`. Each fragment describes a board type:
205+
Device definitions map board/application combinations to 3D models and reference frames. Fragments can be defined locally or fetched from [hcdf.cognipilot.org](https://hcdf.cognipilot.org).
206+
207+
### Local Fragments (TOML)
206208

207209
```toml
208210
# fragments/index.toml
209-
[[fragments]]
210-
path = "spinali.toml"
211-
212-
[[fragments]]
213-
path = "rtk_f9p.toml"
211+
version = "1.0"
212+
213+
[[fragment]]
214+
board = "mr_mcxn_t1"
215+
app = "optical-flow"
216+
model = "optical_flow.glb"
217+
description = "PMW3901 optical flow sensor on MR-MCXN-T1"
218+
219+
[[fragment]]
220+
board = "mr_mcxn_t1"
221+
app = "*" # Wildcard - matches any app
222+
model = "mcxnt1hub.glb"
223+
description = "MR-MCXN-T1 development board"
214224
```
215225

216-
```toml
217-
# fragments/spinali.toml
218-
[fragment]
219-
name = "spinali"
220-
board = "spinali"
221-
description = "CogniPilot Spinali IMU board"
222-
223-
[fragment.model]
224-
path = "spinali.glb"
225-
scale = 0.001
226-
227-
[fragment.match]
228-
# Match criteria for auto-identification
229-
board_regex = "spinali.*"
226+
### Remote Fragments (HCDF)
227+
228+
Devices can report an HCDF URL via MCUmgr. The daemon fetches and caches these automatically:
229+
230+
```xml
231+
<?xml version="1.0"?>
232+
<hcdf version="1.2">
233+
<comp name="optical-flow-assembly" role="sensor">
234+
<description>PMW3901 optical flow sensor</description>
235+
236+
<!-- Multiple visuals with individual poses -->
237+
<visual name="board">
238+
<pose>0 0 0 0 0 0</pose>
239+
<model href="models/fbf4836d-mcxnt1hub.glb" sha="fbf4836d..."/>
240+
</visual>
241+
<visual name="sensor">
242+
<pose>0 0 -0.005 3.14159 0 0</pose>
243+
<model href="models/72eef172-optical_flow.glb" sha="72eef172..."/>
244+
</visual>
245+
246+
<!-- Reference frames (shown via "Show Reference Frames" checkbox) -->
247+
<frame name="flow">
248+
<description>Optical flow sensor frame</description>
249+
<pose>0 0 -0.005 3.14159 0 0</pose>
250+
</frame>
251+
</comp>
252+
</hcdf>
230253
```
231254

255+
Models are cached locally with SHA-prefixed names (`{short_sha}-{name}.glb`) for deduplication.
256+
232257
## 3D Models
233258

234-
Place glTF/GLB models in `assets/models/`. Models are loaded based on fragment definitions and displayed in the 3D view. The web UI supports:
259+
Place glTF/GLB models in `assets/models/`. Models are loaded based on fragment definitions and displayed in the 3D view.
260+
261+
Public models are hosted at [hcdf.cognipilot.org](https://hcdf.cognipilot.org) (see [hcdf_models repository](https://github.com/CogniPilot/hcdf_models)).
262+
263+
### Web UI Features
235264

236-
- Orbit camera (drag to rotate)
237-
- Pan (shift+drag or two-finger drag)
238-
- Zoom (scroll or pinch)
239-
- Device selection (click/tap on 3D models)
240-
- Position/rotation editing
241-
- Connection status indicators (green=online, red=offline, white=unknown)
242-
- Toggle connectivity checking via "Check connection" checkbox
265+
- **Camera**: Orbit (drag), pan (right-drag), zoom (scroll/pinch)
266+
- **Selection**: Click devices to view details and edit position/rotation
267+
- **Composite visuals**: Devices can have multiple 3D models at different poses
268+
- **Reference frames**: Toggle "Show Reference Frames" to visualize coordinate frames
269+
- **Frame tooltips**: Hover over frame gizmos to see name and description
270+
- **Connection status**: Green=online, red=offline, white=unknown (when heartbeat disabled)
271+
- **Connectivity checking**: Toggle via "Check connection" checkbox
243272

244273
## GitHub Pages Deployment
245274

crates/dendrite-core/Cargo.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,8 @@ uuid = { workspace = true }
1515
thiserror = { workspace = true }
1616
anyhow = { workspace = true }
1717
tracing = { workspace = true }
18+
sha2 = "0.10"
19+
hex = "0.4"
20+
21+
[dev-dependencies]
22+
tempfile = "3.18"

0 commit comments

Comments
 (0)