Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,13 @@ jobs:
# Only main writes the cache, so a PR run cannot evict main's entry
# from the repo's 10GB budget. PR runs still restore from it.
save-if: ${{ github.ref == 'refs/heads/main' }}
- name: Install system deps
# realsense-sys links the system librealsense2. portaudio is for pyaudio.
run: |
curl -sSf --retry 3 https://librealsense.realsenseai.com/Debian/librealsenseai.asc | gpg --dearmor | sudo tee /etc/apt/keyrings/librealsenseai.gpg > /dev/null
echo "deb [signed-by=/etc/apt/keyrings/librealsenseai.gpg] https://librealsense.realsenseai.com/Debian/apt-repo $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/librealsense.list
sudo apt-get update
sudo apt-get install -y librealsense2-dev portaudio19-dev
- name: cargo fmt
run: cargo fmt --all -- --check
- name: cargo clippy
Expand All @@ -227,10 +234,6 @@ jobs:
uses: astral-sh/setup-uv@v10.0.1
with:
enable-cache: true
- name: Install dependency for pyaudio
run: |
sudo apt-get update
sudo apt-get install -y portaudio19-dev
- name: Build and test PyO3 bindings
# PyO3 extension modules (cdylib + `extension-module`) are the one case
# that still needs a plain build: pytest imports the compiled .so.
Expand Down
7 changes: 1 addition & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -157,12 +157,7 @@ repos:
git ls-files "*Cargo.toml" | while read -r m; do
cargo locate-project --manifest-path "$m" --workspace --message-format plain
done | sort -u | while read -r root; do
# A crate with its own flake carries system deps the root shell lacks.
if [ -f "$(dirname "$root")/flake.nix" ]; then
nix develop "path:$(dirname "$root")" -c cargo clippy --manifest-path "$root" --workspace --all-targets -- -D warnings
else
cargo clippy --manifest-path "$root" --workspace --all-targets -- -D warnings
fi
cargo clippy --manifest-path "$root" --workspace --all-targets -- -D warnings
done
'
language: system
Expand Down
90 changes: 82 additions & 8 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,26 @@ members = [
"dimos/mapping/ray_tracing/rust/py",
"dimos/navigation/nav_3d/mls_planner/rust",
"dimos/navigation/nav_3d/mls_planner/rust/py",
"dimos/hardware/sensors/camera/realsense/rust",
"dimos/hardware/sensors/lidar/virtual_mid360",
"examples/native-modules/rust",
]

[workspace.dependencies]
ahash = "0.8"
dimos-lcm = { git = "https://github.com/dimensionalOS/dimos-lcm.git", branch = "rust-codegen" }
dimos-module = { path = "native/rust/dimos-module" }
lcm-msgs = { git = "https://github.com/dimensionalOS/dimos-lcm.git", branch = "rust-codegen" }
nalgebra = "0.35.0"
numpy = "0.25"
pyo3 = { version = "0.25", features = ["extension-module", "abi3-py310"] }
rayon = "1"
serde = { version = "1", features = ["derive"] }
tokio = "1"
tracing = "0.1"
tracing-subscriber = "0.3"
validator = { version = "0.21", features = ["derive"] }

[profile.release]
lto = "thin"
codegen-units = 1
Expand Down
5 changes: 2 additions & 3 deletions bin/build-native-modules
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
"""Build every nix-backed native module, or decide whether CI needs to.

Walks the whole `dimos` package for any `NativeModuleConfig` subclass whose
`build_command` is a `nix build` (a `nix develop -c cargo build` leaves no
store path to publish, so it stays outside the gate). Discovery is pure AST (stdlib only, no dimos import),
so this script runs on a bare `python3` with nothing installed.
`build_command` is a `nix build`. Discovery is pure AST (stdlib only, no
dimos import), so this script runs on a bare `python3` with nothing installed.

Modes:

Expand Down
4 changes: 2 additions & 2 deletions dimos/hardware/sensors/camera/realsense/README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# RealSense

Capture is the rust module in `rust/`, built through its own flake (librealsense2 is not in the root shell):
Capture is the rust module in `rust/`, a workspace member. It links the system librealsense2 (`librealsense2-dev` from the [RealSense apt repo](https://github.com/realsenseai/librealsense/blob/master/doc/distribution_linux.md), or `pkgs.librealsense` in the nix shell):

```bash
cd dimos/hardware/sensors/camera/realsense/rust && nix develop path:. -c cargo build --release
cargo build --release -p dimos-realsense
```

`camera.py` launches it; `dimos run real-sense-camera-vis` shows color, depth and the cloud in Rerun.
7 changes: 4 additions & 3 deletions dimos/hardware/sensors/camera/realsense/camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

from pydantic import Field

from dimos.constants import DIMOS_PROJECT_ROOT
from dimos.core.native_module import NativeModule, NativeModuleConfig
from dimos.core.stream import Out
from dimos.hardware.sensors.camera.spec import DepthCameraConfig
Expand All @@ -35,9 +36,9 @@

class RealSenseCameraConfig(NativeModuleConfig, DepthCameraConfig):
cwd: str | None = "rust"
executable: str = "target/release/realsense_native"
# Own flake: librealsense2 isn't in the root shell.
build_command: str | None = "nix develop path:. -c cargo build --release"
# The crate is a workspace member, so cargo builds into the repo-root target dir.
executable: str = str(DIMOS_PROJECT_ROOT / "target" / "release" / "realsense_native")
build_command: str | None = "cargo build --release"
stdin_config: bool = True
# The frame stem and its namespace cross to rust like any other field.
base_fields: frozenset[str] = frozenset({"frame_id", "frame_id_prefix"})
Expand Down
Loading
Loading