diff --git a/.github/workflows/message-codegen.yml b/.github/workflows/message-codegen.yml index 11ad11f84fa..987ba978806 100644 --- a/.github/workflows/message-codegen.yml +++ b/.github/workflows/message-codegen.yml @@ -23,6 +23,7 @@ on: - docs/usage/transforms.md - dimos/hardware/sensors/camera/** - dimos/perception/detection/** + - dimos/perception/depth2depth_cloud/** - dimos/perception/fiducial/** - dimos/perception/localize/** - dimos/perception/detection/project.py @@ -205,5 +206,12 @@ jobs: - name: Verify generated ZED frames without the proprietary SDK if: runner.os == 'Linux' run: | - .native-review/bin/python -I -c 'import dimos; import pytest; import sys; raise SystemExit(pytest.main(sys.argv[1:]))' --noconftest --import-mode=importlib -o addopts='' -q "$PWD/dimos/hardware/sensors/camera/zed/test_messages.py" + .native-review/bin/python -I -c 'from dimos.hardware.sensors.camera.zed import messages, compat; import pytest; import sys; assert all("site-packages" in str(module.__file__) for module in (messages, compat)); raise SystemExit(pytest.main(sys.argv[1:]))' --noconftest --import-mode=importlib -o addopts='' -q "$PWD/dimos/hardware/sensors/camera/zed/test_messages.py" MYPYPATH="$PWD/build/message-source/python" .native-review/bin/python -m mypy --follow-imports=silent dimos/hardware/sensors/camera/zed/camera.py dimos/hardware/sensors/camera/zed/compat.py dimos/hardware/sensors/camera/zed/messages.py + - name: Verify native generated depth-cloud messages and point layouts + if: runner.os == 'Linux' + run: | + .native-review/bin/python -I -c 'from dimos.perception.depth2depth_cloud import module; import pytest; import sys; assert "site-packages" in str(module.__file__); raise SystemExit(pytest.main(sys.argv[1:]))' --noconftest --import-mode=importlib -o addopts='' -q "$PWD/dimos/perception/depth2depth_cloud/test_depth2depth_cloud_config.py" + MYPYPATH="$PWD/build/message-source/python" .native-review/bin/python -m mypy --follow-imports=silent dimos/perception/depth2depth_cloud/module.py + cargo test --locked --manifest-path dimos/perception/depth2depth_cloud/rust/Cargo.toml -j 2 --lib + cargo test --locked --manifest-path native/rust/dimos-module/Cargo.toml -j 2 pointcloud::tests diff --git a/dimos/experimental/memory/rust/Cargo.lock b/dimos/experimental/memory/rust/Cargo.lock index e0158b7e713..1c8b515d0ea 100644 --- a/dimos/experimental/memory/rust/Cargo.lock +++ b/dimos/experimental/memory/rust/Cargo.lock @@ -657,7 +657,7 @@ dependencies = [ [[package]] name = "dimos-lcm" version = "0.1.0" -source = "git+https://github.com/dimensionalOS/dimos-lcm.git?branch=rust-codegen#04d78e8622500244123ba9cefa4c51b4cb454549" +source = "git+https://github.com/dimensionalOS/dimos-lcm.git?rev=04d78e8622500244123ba9cefa4c51b4cb454549#04d78e8622500244123ba9cefa4c51b4cb454549" dependencies = [ "byteorder", "socket2 0.5.10", @@ -672,7 +672,7 @@ dependencies = [ "crossbeam-channel", "crossbeam-utils", "dimos-module", - "lcm-msgs", + "lcm-msgs 0.1.0 (git+https://github.com/dimensionalOS/dimos-lcm.git?branch=rust-codegen)", "lz4_flex 0.14.0", "mcap", "rayon", @@ -689,11 +689,11 @@ dependencies = [ [[package]] name = "dimos-module" version = "0.1.0" -source = "git+https://github.com/dimensionalOS/dimos?rev=6663bcb6e5e18f43a6cb9cf77ccbec613e310443#6663bcb6e5e18f43a6cb9cf77ccbec613e310443" +source = "git+https://github.com/dimensionalOS/dimos?rev=fbbd1b5233886cc2cd4aa64756e730bb63c443e3#fbbd1b5233886cc2cd4aa64756e730bb63c443e3" dependencies = [ "dimos-lcm", "dimos-module-macros", - "lcm-msgs", + "lcm-msgs 0.1.0 (git+https://github.com/dimensionalOS/dimos-lcm.git?rev=04d78e8622500244123ba9cefa4c51b4cb454549)", "nalgebra", "rayon", "serde", @@ -709,7 +709,7 @@ dependencies = [ [[package]] name = "dimos-module-macros" version = "0.1.0" -source = "git+https://github.com/dimensionalOS/dimos?rev=6663bcb6e5e18f43a6cb9cf77ccbec613e310443#6663bcb6e5e18f43a6cb9cf77ccbec613e310443" +source = "git+https://github.com/dimensionalOS/dimos?rev=fbbd1b5233886cc2cd4aa64756e730bb63c443e3#fbbd1b5233886cc2cd4aa64756e730bb63c443e3" dependencies = [ "proc-macro2", "quote", @@ -1555,6 +1555,14 @@ dependencies = [ "byteorder", ] +[[package]] +name = "lcm-msgs" +version = "0.1.0" +source = "git+https://github.com/dimensionalOS/dimos-lcm.git?rev=04d78e8622500244123ba9cefa4c51b4cb454549#04d78e8622500244123ba9cefa4c51b4cb454549" +dependencies = [ + "byteorder", +] + [[package]] name = "libc" version = "0.2.189" diff --git a/dimos/experimental/memory/rust/Cargo.toml b/dimos/experimental/memory/rust/Cargo.toml index 7ac39440148..6938f5a2c37 100644 --- a/dimos/experimental/memory/rust/Cargo.toml +++ b/dimos/experimental/memory/rust/Cargo.toml @@ -9,7 +9,7 @@ license = "Apache-2.0" anyhow = "1" crossbeam-channel = "0.5" crossbeam-utils = "0.8" -dimos-module = { git = "https://github.com/dimensionalOS/dimos", rev = "6663bcb6e5e18f43a6cb9cf77ccbec613e310443" } +dimos-module = { git = "https://github.com/dimensionalOS/dimos", rev = "fbbd1b5233886cc2cd4aa64756e730bb63c443e3" } lcm-msgs = { git = "https://github.com/dimensionalOS/dimos-lcm.git", branch = "rust-codegen" } lz4_flex = "0.14.0" mcap = { version = "0.25.0", default-features = false, features = ["zstd"] } diff --git a/dimos/experimental/memory/rust/crate-hashes.json b/dimos/experimental/memory/rust/crate-hashes.json index 4c5fde86d6c..e5e671115ab 100644 --- a/dimos/experimental/memory/rust/crate-hashes.json +++ b/dimos/experimental/memory/rust/crate-hashes.json @@ -1,6 +1,7 @@ { - "git+https://github.com/dimensionalOS/dimos-lcm.git?branch=rust-codegen#dimos-lcm@0.1.0": "sha256-GGkx4Mn6NYP6KZecmoRLKGWIih/+y8OgNn12DeXX6n8=", "git+https://github.com/dimensionalOS/dimos-lcm.git?branch=rust-codegen#lcm-msgs@0.1.0": "sha256-GGkx4Mn6NYP6KZecmoRLKGWIih/+y8OgNn12DeXX6n8=", - "git+https://github.com/dimensionalOS/dimos?rev=6663bcb6e5e18f43a6cb9cf77ccbec613e310443#dimos-module-macros@0.1.0": "sha256-6ikqdS3sroOJGI4WGuSyFx2yZjtJ+4Qgt+IGlkFl+qA=", - "git+https://github.com/dimensionalOS/dimos?rev=6663bcb6e5e18f43a6cb9cf77ccbec613e310443#dimos-module@0.1.0": "sha256-6ikqdS3sroOJGI4WGuSyFx2yZjtJ+4Qgt+IGlkFl+qA=" + "git+https://github.com/dimensionalOS/dimos-lcm.git?rev=04d78e8622500244123ba9cefa4c51b4cb454549#dimos-lcm@0.1.0": "sha256-GGkx4Mn6NYP6KZecmoRLKGWIih/+y8OgNn12DeXX6n8=", + "git+https://github.com/dimensionalOS/dimos-lcm.git?rev=04d78e8622500244123ba9cefa4c51b4cb454549#lcm-msgs@0.1.0": "sha256-GGkx4Mn6NYP6KZecmoRLKGWIih/+y8OgNn12DeXX6n8=", + "git+https://github.com/dimensionalOS/dimos?rev=fbbd1b5233886cc2cd4aa64756e730bb63c443e3#dimos-module-macros@0.1.0": "sha256-8kEU7z2EQmAf+MGMbnBKuvEl76V1Hfj2dvQGTTpI47M=", + "git+https://github.com/dimensionalOS/dimos?rev=fbbd1b5233886cc2cd4aa64756e730bb63c443e3#dimos-module@0.1.0": "sha256-8kEU7z2EQmAf+MGMbnBKuvEl76V1Hfj2dvQGTTpI47M=" } \ No newline at end of file diff --git a/dimos/hardware/sensors/lidar/livox/rust/Cargo.lock b/dimos/hardware/sensors/lidar/livox/rust/Cargo.lock index d4f9a187f15..351c6599bd6 100644 --- a/dimos/hardware/sensors/lidar/livox/rust/Cargo.lock +++ b/dimos/hardware/sensors/lidar/livox/rust/Cargo.lock @@ -609,7 +609,7 @@ dependencies = [ [[package]] name = "dimos-lcm" version = "0.1.0" -source = "git+https://github.com/dimensionalOS/dimos-lcm.git?branch=rust-codegen#04d78e8622500244123ba9cefa4c51b4cb454549" +source = "git+https://github.com/dimensionalOS/dimos-lcm.git?rev=04d78e8622500244123ba9cefa4c51b4cb454549#04d78e8622500244123ba9cefa4c51b4cb454549" dependencies = [ "byteorder", "socket2 0.5.10", @@ -621,7 +621,7 @@ name = "dimos-livox" version = "0.1.0" dependencies = [ "dimos-module", - "lcm-msgs", + "lcm-msgs 0.1.0 (git+https://github.com/dimensionalOS/dimos-lcm.git?branch=rust-codegen)", "livox-wire", "serde", "serde_json", @@ -636,11 +636,11 @@ dependencies = [ [[package]] name = "dimos-module" version = "0.1.0" -source = "git+https://github.com/dimensionalOS/dimos?rev=6663bcb6e5e18f43a6cb9cf77ccbec613e310443#6663bcb6e5e18f43a6cb9cf77ccbec613e310443" +source = "git+https://github.com/dimensionalOS/dimos?rev=fbbd1b5233886cc2cd4aa64756e730bb63c443e3#fbbd1b5233886cc2cd4aa64756e730bb63c443e3" dependencies = [ "dimos-lcm", "dimos-module-macros", - "lcm-msgs", + "lcm-msgs 0.1.0 (git+https://github.com/dimensionalOS/dimos-lcm.git?rev=04d78e8622500244123ba9cefa4c51b4cb454549)", "nalgebra", "rayon", "serde", @@ -656,7 +656,7 @@ dependencies = [ [[package]] name = "dimos-module-macros" version = "0.1.0" -source = "git+https://github.com/dimensionalOS/dimos?rev=6663bcb6e5e18f43a6cb9cf77ccbec613e310443#6663bcb6e5e18f43a6cb9cf77ccbec613e310443" +source = "git+https://github.com/dimensionalOS/dimos?rev=fbbd1b5233886cc2cd4aa64756e730bb63c443e3#fbbd1b5233886cc2cd4aa64756e730bb63c443e3" dependencies = [ "proc-macro2", "quote", @@ -1454,6 +1454,14 @@ dependencies = [ "byteorder", ] +[[package]] +name = "lcm-msgs" +version = "0.1.0" +source = "git+https://github.com/dimensionalOS/dimos-lcm.git?rev=04d78e8622500244123ba9cefa4c51b4cb454549#04d78e8622500244123ba9cefa4c51b4cb454549" +dependencies = [ + "byteorder", +] + [[package]] name = "libc" version = "0.2.189" diff --git a/dimos/hardware/sensors/lidar/livox/rust/Cargo.toml b/dimos/hardware/sensors/lidar/livox/rust/Cargo.toml index 2b042fdd770..101cabbe174 100644 --- a/dimos/hardware/sensors/lidar/livox/rust/Cargo.toml +++ b/dimos/hardware/sensors/lidar/livox/rust/Cargo.toml @@ -22,7 +22,7 @@ imu = "sensor_msgs.Imu" [dependencies] livox-wire = { git = "https://github.com/dimensionalOS/livox-wire", rev = "441c4a16dbe2adb0683ece976cc800c6d7fbc790" } -dimos-module = { git = "https://github.com/dimensionalOS/dimos", rev = "6663bcb6e5e18f43a6cb9cf77ccbec613e310443" } +dimos-module = { git = "https://github.com/dimensionalOS/dimos", rev = "fbbd1b5233886cc2cd4aa64756e730bb63c443e3" } lcm-msgs = { git = "https://github.com/dimensionalOS/dimos-lcm.git", branch = "rust-codegen" } serde = { version = "1", features = ["derive"] } serde_json = "1" diff --git a/dimos/hardware/sensors/lidar/livox/rust/crate-hashes.json b/dimos/hardware/sensors/lidar/livox/rust/crate-hashes.json index 25a968ff3d3..cdc38776ae0 100644 --- a/dimos/hardware/sensors/lidar/livox/rust/crate-hashes.json +++ b/dimos/hardware/sensors/lidar/livox/rust/crate-hashes.json @@ -1,7 +1,8 @@ { - "git+https://github.com/dimensionalOS/dimos-lcm.git?branch=rust-codegen#dimos-lcm@0.1.0": "sha256-GGkx4Mn6NYP6KZecmoRLKGWIih/+y8OgNn12DeXX6n8=", "git+https://github.com/dimensionalOS/dimos-lcm.git?branch=rust-codegen#lcm-msgs@0.1.0": "sha256-GGkx4Mn6NYP6KZecmoRLKGWIih/+y8OgNn12DeXX6n8=", - "git+https://github.com/dimensionalOS/dimos?rev=6663bcb6e5e18f43a6cb9cf77ccbec613e310443#dimos-module-macros@0.1.0": "sha256-6ikqdS3sroOJGI4WGuSyFx2yZjtJ+4Qgt+IGlkFl+qA=", - "git+https://github.com/dimensionalOS/dimos?rev=6663bcb6e5e18f43a6cb9cf77ccbec613e310443#dimos-module@0.1.0": "sha256-6ikqdS3sroOJGI4WGuSyFx2yZjtJ+4Qgt+IGlkFl+qA=", + "git+https://github.com/dimensionalOS/dimos-lcm.git?rev=04d78e8622500244123ba9cefa4c51b4cb454549#dimos-lcm@0.1.0": "sha256-GGkx4Mn6NYP6KZecmoRLKGWIih/+y8OgNn12DeXX6n8=", + "git+https://github.com/dimensionalOS/dimos-lcm.git?rev=04d78e8622500244123ba9cefa4c51b4cb454549#lcm-msgs@0.1.0": "sha256-GGkx4Mn6NYP6KZecmoRLKGWIih/+y8OgNn12DeXX6n8=", + "git+https://github.com/dimensionalOS/dimos?rev=fbbd1b5233886cc2cd4aa64756e730bb63c443e3#dimos-module-macros@0.1.0": "sha256-8kEU7z2EQmAf+MGMbnBKuvEl76V1Hfj2dvQGTTpI47M=", + "git+https://github.com/dimensionalOS/dimos?rev=fbbd1b5233886cc2cd4aa64756e730bb63c443e3#dimos-module@0.1.0": "sha256-8kEU7z2EQmAf+MGMbnBKuvEl76V1Hfj2dvQGTTpI47M=", "git+https://github.com/dimensionalOS/livox-wire?rev=441c4a16dbe2adb0683ece976cc800c6d7fbc790#0.1.0": "sha256-wDNVchRiqm4N9wPGwvYJ9JssmPOC33wBTE4QT6vZkGA=" } \ No newline at end of file diff --git a/dimos/hardware/sensors/lidar/pointlio/rust/Cargo.lock b/dimos/hardware/sensors/lidar/pointlio/rust/Cargo.lock index cedde0f558f..cb1e230bbb9 100644 --- a/dimos/hardware/sensors/lidar/pointlio/rust/Cargo.lock +++ b/dimos/hardware/sensors/lidar/pointlio/rust/Cargo.lock @@ -609,7 +609,7 @@ dependencies = [ [[package]] name = "dimos-lcm" version = "0.1.0" -source = "git+https://github.com/dimensionalOS/dimos-lcm.git?branch=rust-codegen#04d78e8622500244123ba9cefa4c51b4cb454549" +source = "git+https://github.com/dimensionalOS/dimos-lcm.git?rev=04d78e8622500244123ba9cefa4c51b4cb454549#04d78e8622500244123ba9cefa4c51b4cb454549" dependencies = [ "byteorder", "socket2 0.5.10", @@ -619,11 +619,11 @@ dependencies = [ [[package]] name = "dimos-module" version = "0.1.0" -source = "git+https://github.com/dimensionalOS/dimos?rev=6663bcb6e5e18f43a6cb9cf77ccbec613e310443#6663bcb6e5e18f43a6cb9cf77ccbec613e310443" +source = "git+https://github.com/dimensionalOS/dimos?rev=fbbd1b5233886cc2cd4aa64756e730bb63c443e3#fbbd1b5233886cc2cd4aa64756e730bb63c443e3" dependencies = [ "dimos-lcm", "dimos-module-macros", - "lcm-msgs", + "lcm-msgs 0.1.0 (git+https://github.com/dimensionalOS/dimos-lcm.git?rev=04d78e8622500244123ba9cefa4c51b4cb454549)", "nalgebra", "rayon", "serde", @@ -639,7 +639,7 @@ dependencies = [ [[package]] name = "dimos-module-macros" version = "0.1.0" -source = "git+https://github.com/dimensionalOS/dimos?rev=6663bcb6e5e18f43a6cb9cf77ccbec613e310443#6663bcb6e5e18f43a6cb9cf77ccbec613e310443" +source = "git+https://github.com/dimensionalOS/dimos?rev=fbbd1b5233886cc2cd4aa64756e730bb63c443e3#fbbd1b5233886cc2cd4aa64756e730bb63c443e3" dependencies = [ "proc-macro2", "quote", @@ -652,7 +652,7 @@ name = "dimos-pointlio" version = "0.1.0" dependencies = [ "dimos-module", - "lcm-msgs", + "lcm-msgs 0.1.0 (git+https://github.com/dimensionalOS/dimos-lcm.git?branch=rust-codegen)", "livox-wire", "pointlio-core", "serde", @@ -1443,6 +1443,14 @@ dependencies = [ "byteorder", ] +[[package]] +name = "lcm-msgs" +version = "0.1.0" +source = "git+https://github.com/dimensionalOS/dimos-lcm.git?rev=04d78e8622500244123ba9cefa4c51b4cb454549#04d78e8622500244123ba9cefa4c51b4cb454549" +dependencies = [ + "byteorder", +] + [[package]] name = "libc" version = "0.2.189" diff --git a/dimos/hardware/sensors/lidar/pointlio/rust/Cargo.toml b/dimos/hardware/sensors/lidar/pointlio/rust/Cargo.toml index a6cb8b21048..b450c43a1ea 100644 --- a/dimos/hardware/sensors/lidar/pointlio/rust/Cargo.toml +++ b/dimos/hardware/sensors/lidar/pointlio/rust/Cargo.toml @@ -33,7 +33,7 @@ odometry = "nav_msgs.Odometry" livox-wire = { git = "https://github.com/dimensionalOS/livox-wire", rev = "441c4a16dbe2adb0683ece976cc800c6d7fbc790" } # Direct dependencies of the copied livox wire/pipeline/pcap modules. See src/lib.rs. pointlio-core = { git = "https://github.com/dimensionalOS/dimos-module-pointlio.git", rev = "22a5403f827d030b248ae473c2808b5d405b3d55" } -dimos-module = { git = "https://github.com/dimensionalOS/dimos", rev = "6663bcb6e5e18f43a6cb9cf77ccbec613e310443" } +dimos-module = { git = "https://github.com/dimensionalOS/dimos", rev = "fbbd1b5233886cc2cd4aa64756e730bb63c443e3" } lcm-msgs = { git = "https://github.com/dimensionalOS/dimos-lcm.git", branch = "rust-codegen" } serde = { version = "1", features = ["derive"] } serde_json = "1" diff --git a/dimos/hardware/sensors/lidar/pointlio/rust/crate-hashes.json b/dimos/hardware/sensors/lidar/pointlio/rust/crate-hashes.json index 68580a734b5..d4f14eb9c8d 100644 --- a/dimos/hardware/sensors/lidar/pointlio/rust/crate-hashes.json +++ b/dimos/hardware/sensors/lidar/pointlio/rust/crate-hashes.json @@ -1,8 +1,9 @@ { - "git+https://github.com/dimensionalOS/dimos-lcm.git?branch=rust-codegen#dimos-lcm@0.1.0": "sha256-GGkx4Mn6NYP6KZecmoRLKGWIih/+y8OgNn12DeXX6n8=", "git+https://github.com/dimensionalOS/dimos-lcm.git?branch=rust-codegen#lcm-msgs@0.1.0": "sha256-GGkx4Mn6NYP6KZecmoRLKGWIih/+y8OgNn12DeXX6n8=", + "git+https://github.com/dimensionalOS/dimos-lcm.git?rev=04d78e8622500244123ba9cefa4c51b4cb454549#dimos-lcm@0.1.0": "sha256-GGkx4Mn6NYP6KZecmoRLKGWIih/+y8OgNn12DeXX6n8=", + "git+https://github.com/dimensionalOS/dimos-lcm.git?rev=04d78e8622500244123ba9cefa4c51b4cb454549#lcm-msgs@0.1.0": "sha256-GGkx4Mn6NYP6KZecmoRLKGWIih/+y8OgNn12DeXX6n8=", "git+https://github.com/dimensionalOS/dimos-module-pointlio.git?rev=22a5403f827d030b248ae473c2808b5d405b3d55#pointlio-core@0.1.0": "sha256-FjUcsZVI8nTcmKw8WhdxBuHelBjOCeJmyEsyqRxDvX0=", - "git+https://github.com/dimensionalOS/dimos?rev=6663bcb6e5e18f43a6cb9cf77ccbec613e310443#dimos-module-macros@0.1.0": "sha256-6ikqdS3sroOJGI4WGuSyFx2yZjtJ+4Qgt+IGlkFl+qA=", - "git+https://github.com/dimensionalOS/dimos?rev=6663bcb6e5e18f43a6cb9cf77ccbec613e310443#dimos-module@0.1.0": "sha256-6ikqdS3sroOJGI4WGuSyFx2yZjtJ+4Qgt+IGlkFl+qA=", + "git+https://github.com/dimensionalOS/dimos?rev=fbbd1b5233886cc2cd4aa64756e730bb63c443e3#dimos-module-macros@0.1.0": "sha256-8kEU7z2EQmAf+MGMbnBKuvEl76V1Hfj2dvQGTTpI47M=", + "git+https://github.com/dimensionalOS/dimos?rev=fbbd1b5233886cc2cd4aa64756e730bb63c443e3#dimos-module@0.1.0": "sha256-8kEU7z2EQmAf+MGMbnBKuvEl76V1Hfj2dvQGTTpI47M=", "git+https://github.com/dimensionalOS/livox-wire?rev=441c4a16dbe2adb0683ece976cc800c6d7fbc790#0.1.0": "sha256-wDNVchRiqm4N9wPGwvYJ9JssmPOC33wBTE4QT6vZkGA=" } \ No newline at end of file diff --git a/dimos/hardware/sensors/lidar/virtual_mid360/Cargo.lock b/dimos/hardware/sensors/lidar/virtual_mid360/Cargo.lock index d5b83c0f4e9..64357d40eb2 100644 --- a/dimos/hardware/sensors/lidar/virtual_mid360/Cargo.lock +++ b/dimos/hardware/sensors/lidar/virtual_mid360/Cargo.lock @@ -609,7 +609,7 @@ dependencies = [ [[package]] name = "dimos-lcm" version = "0.1.0" -source = "git+https://github.com/dimensionalOS/dimos-lcm.git?branch=rust-codegen#04d78e8622500244123ba9cefa4c51b4cb454549" +source = "git+https://github.com/dimensionalOS/dimos-lcm.git?rev=04d78e8622500244123ba9cefa4c51b4cb454549#04d78e8622500244123ba9cefa4c51b4cb454549" dependencies = [ "byteorder", "socket2 0.5.10", @@ -619,7 +619,7 @@ dependencies = [ [[package]] name = "dimos-module" version = "0.1.0" -source = "git+https://github.com/dimensionalOS/dimos?rev=6663bcb6e5e18f43a6cb9cf77ccbec613e310443#6663bcb6e5e18f43a6cb9cf77ccbec613e310443" +source = "git+https://github.com/dimensionalOS/dimos?rev=fbbd1b5233886cc2cd4aa64756e730bb63c443e3#fbbd1b5233886cc2cd4aa64756e730bb63c443e3" dependencies = [ "dimos-lcm", "dimos-module-macros", @@ -639,7 +639,7 @@ dependencies = [ [[package]] name = "dimos-module-macros" version = "0.1.0" -source = "git+https://github.com/dimensionalOS/dimos?rev=6663bcb6e5e18f43a6cb9cf77ccbec613e310443#6663bcb6e5e18f43a6cb9cf77ccbec613e310443" +source = "git+https://github.com/dimensionalOS/dimos?rev=fbbd1b5233886cc2cd4aa64756e730bb63c443e3#fbbd1b5233886cc2cd4aa64756e730bb63c443e3" dependencies = [ "proc-macro2", "quote", @@ -1436,7 +1436,7 @@ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" [[package]] name = "lcm-msgs" version = "0.1.0" -source = "git+https://github.com/dimensionalOS/dimos-lcm.git?branch=rust-codegen#04d78e8622500244123ba9cefa4c51b4cb454549" +source = "git+https://github.com/dimensionalOS/dimos-lcm.git?rev=04d78e8622500244123ba9cefa4c51b4cb454549#04d78e8622500244123ba9cefa4c51b4cb454549" dependencies = [ "byteorder", ] diff --git a/dimos/hardware/sensors/lidar/virtual_mid360/Cargo.toml b/dimos/hardware/sensors/lidar/virtual_mid360/Cargo.toml index 220a2de1080..c0d4715701f 100644 --- a/dimos/hardware/sensors/lidar/virtual_mid360/Cargo.toml +++ b/dimos/hardware/sensors/lidar/virtual_mid360/Cargo.toml @@ -10,7 +10,7 @@ path = "src/main.rs" [dependencies] livox-wire = { git = "https://github.com/dimensionalOS/livox-wire", rev = "441c4a16dbe2adb0683ece976cc800c6d7fbc790" } # Direct dependencies of the copied livox wire/pipeline/pcap modules. See src/main.rs. -dimos-module = { git = "https://github.com/dimensionalOS/dimos", rev = "6663bcb6e5e18f43a6cb9cf77ccbec613e310443" } +dimos-module = { git = "https://github.com/dimensionalOS/dimos", rev = "fbbd1b5233886cc2cd4aa64756e730bb63c443e3" } tokio = { version = "1", features = ["rt-multi-thread", "macros", "time", "net", "sync"] } serde = { version = "1", features = ["derive"] } socket2 = "0.6" diff --git a/dimos/hardware/sensors/lidar/virtual_mid360/crate-hashes.json b/dimos/hardware/sensors/lidar/virtual_mid360/crate-hashes.json index 25a968ff3d3..89af0f86abc 100644 --- a/dimos/hardware/sensors/lidar/virtual_mid360/crate-hashes.json +++ b/dimos/hardware/sensors/lidar/virtual_mid360/crate-hashes.json @@ -1,7 +1,7 @@ { - "git+https://github.com/dimensionalOS/dimos-lcm.git?branch=rust-codegen#dimos-lcm@0.1.0": "sha256-GGkx4Mn6NYP6KZecmoRLKGWIih/+y8OgNn12DeXX6n8=", - "git+https://github.com/dimensionalOS/dimos-lcm.git?branch=rust-codegen#lcm-msgs@0.1.0": "sha256-GGkx4Mn6NYP6KZecmoRLKGWIih/+y8OgNn12DeXX6n8=", - "git+https://github.com/dimensionalOS/dimos?rev=6663bcb6e5e18f43a6cb9cf77ccbec613e310443#dimos-module-macros@0.1.0": "sha256-6ikqdS3sroOJGI4WGuSyFx2yZjtJ+4Qgt+IGlkFl+qA=", - "git+https://github.com/dimensionalOS/dimos?rev=6663bcb6e5e18f43a6cb9cf77ccbec613e310443#dimos-module@0.1.0": "sha256-6ikqdS3sroOJGI4WGuSyFx2yZjtJ+4Qgt+IGlkFl+qA=", + "git+https://github.com/dimensionalOS/dimos-lcm.git?rev=04d78e8622500244123ba9cefa4c51b4cb454549#dimos-lcm@0.1.0": "sha256-GGkx4Mn6NYP6KZecmoRLKGWIih/+y8OgNn12DeXX6n8=", + "git+https://github.com/dimensionalOS/dimos-lcm.git?rev=04d78e8622500244123ba9cefa4c51b4cb454549#lcm-msgs@0.1.0": "sha256-GGkx4Mn6NYP6KZecmoRLKGWIih/+y8OgNn12DeXX6n8=", + "git+https://github.com/dimensionalOS/dimos?rev=fbbd1b5233886cc2cd4aa64756e730bb63c443e3#dimos-module-macros@0.1.0": "sha256-8kEU7z2EQmAf+MGMbnBKuvEl76V1Hfj2dvQGTTpI47M=", + "git+https://github.com/dimensionalOS/dimos?rev=fbbd1b5233886cc2cd4aa64756e730bb63c443e3#dimos-module@0.1.0": "sha256-8kEU7z2EQmAf+MGMbnBKuvEl76V1Hfj2dvQGTTpI47M=", "git+https://github.com/dimensionalOS/livox-wire?rev=441c4a16dbe2adb0683ece976cc800c6d7fbc790#0.1.0": "sha256-wDNVchRiqm4N9wPGwvYJ9JssmPOC33wBTE4QT6vZkGA=" } \ No newline at end of file diff --git a/dimos/mapping/dim_slam/rust/Cargo.lock b/dimos/mapping/dim_slam/rust/Cargo.lock index 9308b22cb40..c56d02a05c5 100644 --- a/dimos/mapping/dim_slam/rust/Cargo.lock +++ b/dimos/mapping/dim_slam/rust/Cargo.lock @@ -557,7 +557,7 @@ dependencies = [ "cu_vslam_rs", "dim_slam", "dimos-module", - "lcm-msgs", + "lcm-msgs 0.1.0 (git+https://github.com/dimensionalOS/dimos-lcm.git?branch=rust-codegen)", "serde", "tokio", "tracing", @@ -578,7 +578,7 @@ dependencies = [ [[package]] name = "dimos-lcm" version = "0.1.0" -source = "git+https://github.com/dimensionalOS/dimos-lcm.git?branch=rust-codegen#04d78e8622500244123ba9cefa4c51b4cb454549" +source = "git+https://github.com/dimensionalOS/dimos-lcm.git?rev=04d78e8622500244123ba9cefa4c51b4cb454549#04d78e8622500244123ba9cefa4c51b4cb454549" dependencies = [ "byteorder", "socket2 0.5.10", @@ -588,11 +588,11 @@ dependencies = [ [[package]] name = "dimos-module" version = "0.1.0" -source = "git+https://github.com/dimensionalOS/dimos?rev=6663bcb6e5e18f43a6cb9cf77ccbec613e310443#6663bcb6e5e18f43a6cb9cf77ccbec613e310443" +source = "git+https://github.com/dimensionalOS/dimos?rev=fbbd1b5233886cc2cd4aa64756e730bb63c443e3#fbbd1b5233886cc2cd4aa64756e730bb63c443e3" dependencies = [ "dimos-lcm", "dimos-module-macros", - "lcm-msgs", + "lcm-msgs 0.1.0 (git+https://github.com/dimensionalOS/dimos-lcm.git?rev=04d78e8622500244123ba9cefa4c51b4cb454549)", "nalgebra", "rayon", "serde", @@ -608,7 +608,7 @@ dependencies = [ [[package]] name = "dimos-module-macros" version = "0.1.0" -source = "git+https://github.com/dimensionalOS/dimos?rev=6663bcb6e5e18f43a6cb9cf77ccbec613e310443#6663bcb6e5e18f43a6cb9cf77ccbec613e310443" +source = "git+https://github.com/dimensionalOS/dimos?rev=fbbd1b5233886cc2cd4aa64756e730bb63c443e3#fbbd1b5233886cc2cd4aa64756e730bb63c443e3" dependencies = [ "proc-macro2", "quote", @@ -1395,6 +1395,14 @@ dependencies = [ "byteorder", ] +[[package]] +name = "lcm-msgs" +version = "0.1.0" +source = "git+https://github.com/dimensionalOS/dimos-lcm.git?rev=04d78e8622500244123ba9cefa4c51b4cb454549#04d78e8622500244123ba9cefa4c51b4cb454549" +dependencies = [ + "byteorder", +] + [[package]] name = "libc" version = "0.2.189" diff --git a/dimos/mapping/dim_slam/rust/Cargo.toml b/dimos/mapping/dim_slam/rust/Cargo.toml index 8df62977ea2..88d8ae76005 100644 --- a/dimos/mapping/dim_slam/rust/Cargo.toml +++ b/dimos/mapping/dim_slam/rust/Cargo.toml @@ -15,7 +15,7 @@ dim_slam = { git = "https://github.com/dimensionalOS/dimSLAM", tag = "v0.4.1" } # Unused directly, but cargo hands DEP_CUVSLAM_LIB_DIR only to immediate dependents # and build.rs needs it for the rpath. cu_vslam_rs = "0.2.0" -dimos-module = { git = "https://github.com/dimensionalOS/dimos", rev = "6663bcb6e5e18f43a6cb9cf77ccbec613e310443" } +dimos-module = { git = "https://github.com/dimensionalOS/dimos", rev = "fbbd1b5233886cc2cd4aa64756e730bb63c443e3" } lcm-msgs = { git = "https://github.com/dimensionalOS/dimos-lcm.git", branch = "rust-codegen" } tokio = { version = "1", features = ["rt-multi-thread", "macros"] } tracing = "0.1" diff --git a/dimos/mapping/dim_slam/rust/crate-hashes.json b/dimos/mapping/dim_slam/rust/crate-hashes.json index 980a12b1ffc..de09dfc570a 100644 --- a/dimos/mapping/dim_slam/rust/crate-hashes.json +++ b/dimos/mapping/dim_slam/rust/crate-hashes.json @@ -1,7 +1,8 @@ { "git+https://github.com/dimensionalOS/dimSLAM?tag=v0.4.1#dim_slam@0.1.0": "sha256-jx3QjYNclt3JFJOonGIAzfoJeJ5bhowx70a7LumF6IA=", - "git+https://github.com/dimensionalOS/dimos-lcm.git?branch=rust-codegen#dimos-lcm@0.1.0": "sha256-GGkx4Mn6NYP6KZecmoRLKGWIih/+y8OgNn12DeXX6n8=", "git+https://github.com/dimensionalOS/dimos-lcm.git?branch=rust-codegen#lcm-msgs@0.1.0": "sha256-GGkx4Mn6NYP6KZecmoRLKGWIih/+y8OgNn12DeXX6n8=", - "git+https://github.com/dimensionalOS/dimos?rev=6663bcb6e5e18f43a6cb9cf77ccbec613e310443#dimos-module-macros@0.1.0": "sha256-6ikqdS3sroOJGI4WGuSyFx2yZjtJ+4Qgt+IGlkFl+qA=", - "git+https://github.com/dimensionalOS/dimos?rev=6663bcb6e5e18f43a6cb9cf77ccbec613e310443#dimos-module@0.1.0": "sha256-6ikqdS3sroOJGI4WGuSyFx2yZjtJ+4Qgt+IGlkFl+qA=" + "git+https://github.com/dimensionalOS/dimos-lcm.git?rev=04d78e8622500244123ba9cefa4c51b4cb454549#dimos-lcm@0.1.0": "sha256-GGkx4Mn6NYP6KZecmoRLKGWIih/+y8OgNn12DeXX6n8=", + "git+https://github.com/dimensionalOS/dimos-lcm.git?rev=04d78e8622500244123ba9cefa4c51b4cb454549#lcm-msgs@0.1.0": "sha256-GGkx4Mn6NYP6KZecmoRLKGWIih/+y8OgNn12DeXX6n8=", + "git+https://github.com/dimensionalOS/dimos?rev=fbbd1b5233886cc2cd4aa64756e730bb63c443e3#dimos-module-macros@0.1.0": "sha256-8kEU7z2EQmAf+MGMbnBKuvEl76V1Hfj2dvQGTTpI47M=", + "git+https://github.com/dimensionalOS/dimos?rev=fbbd1b5233886cc2cd4aa64756e730bb63c443e3#dimos-module@0.1.0": "sha256-8kEU7z2EQmAf+MGMbnBKuvEl76V1Hfj2dvQGTTpI47M=" } \ No newline at end of file diff --git a/dimos/mapping/ray_tracing/rust/Cargo.lock b/dimos/mapping/ray_tracing/rust/Cargo.lock index 4412e44ee34..8e62024b766 100644 --- a/dimos/mapping/ray_tracing/rust/Cargo.lock +++ b/dimos/mapping/ray_tracing/rust/Cargo.lock @@ -588,7 +588,7 @@ dependencies = [ [[package]] name = "dimos-lcm" version = "0.1.0" -source = "git+https://github.com/dimensionalOS/dimos-lcm.git?branch=rust-codegen#04d78e8622500244123ba9cefa4c51b4cb454549" +source = "git+https://github.com/dimensionalOS/dimos-lcm.git?rev=04d78e8622500244123ba9cefa4c51b4cb454549#04d78e8622500244123ba9cefa4c51b4cb454549" dependencies = [ "byteorder", "socket2 0.5.10", @@ -598,11 +598,11 @@ dependencies = [ [[package]] name = "dimos-module" version = "0.1.0" -source = "git+https://github.com/dimensionalOS/dimos?rev=6663bcb6e5e18f43a6cb9cf77ccbec613e310443#6663bcb6e5e18f43a6cb9cf77ccbec613e310443" +source = "git+https://github.com/dimensionalOS/dimos?rev=fbbd1b5233886cc2cd4aa64756e730bb63c443e3#fbbd1b5233886cc2cd4aa64756e730bb63c443e3" dependencies = [ "dimos-lcm", "dimos-module-macros", - "lcm-msgs", + "lcm-msgs 0.1.0 (git+https://github.com/dimensionalOS/dimos-lcm.git?rev=04d78e8622500244123ba9cefa4c51b4cb454549)", "nalgebra", "rayon", "serde", @@ -618,7 +618,7 @@ dependencies = [ [[package]] name = "dimos-module-macros" version = "0.1.0" -source = "git+https://github.com/dimensionalOS/dimos?rev=6663bcb6e5e18f43a6cb9cf77ccbec613e310443#6663bcb6e5e18f43a6cb9cf77ccbec613e310443" +source = "git+https://github.com/dimensionalOS/dimos?rev=fbbd1b5233886cc2cd4aa64756e730bb63c443e3#fbbd1b5233886cc2cd4aa64756e730bb63c443e3" dependencies = [ "proc-macro2", "quote", @@ -633,7 +633,7 @@ dependencies = [ "ahash", "arrayvec", "dimos-module", - "lcm-msgs", + "lcm-msgs 0.1.0 (git+https://github.com/dimensionalOS/dimos-lcm.git?branch=rust-codegen)", "nalgebra", "rayon", "serde", @@ -1438,6 +1438,14 @@ dependencies = [ "byteorder", ] +[[package]] +name = "lcm-msgs" +version = "0.1.0" +source = "git+https://github.com/dimensionalOS/dimos-lcm.git?rev=04d78e8622500244123ba9cefa4c51b4cb454549#04d78e8622500244123ba9cefa4c51b4cb454549" +dependencies = [ + "byteorder", +] + [[package]] name = "libc" version = "0.2.189" diff --git a/dimos/mapping/ray_tracing/rust/Cargo.toml b/dimos/mapping/ray_tracing/rust/Cargo.toml index e96b69ebefa..0a8203509d3 100644 --- a/dimos/mapping/ray_tracing/rust/Cargo.toml +++ b/dimos/mapping/ray_tracing/rust/Cargo.toml @@ -35,7 +35,7 @@ region_bounds = "geometry_msgs.PoseStamped" map_regions = "sensor_msgs.PointCloud2" [dependencies] -dimos-module = { git = "https://github.com/dimensionalOS/dimos", rev = "6663bcb6e5e18f43a6cb9cf77ccbec613e310443" } +dimos-module = { git = "https://github.com/dimensionalOS/dimos", rev = "fbbd1b5233886cc2cd4aa64756e730bb63c443e3" } lcm-msgs = { git = "https://github.com/dimensionalOS/dimos-lcm.git", branch = "rust-codegen" } tokio = { version = "1", features = ["rt-multi-thread", "macros", "signal"] } serde = { version = "1", features = ["derive"] } diff --git a/dimos/mapping/ray_tracing/rust/crate-hashes.json b/dimos/mapping/ray_tracing/rust/crate-hashes.json index 4c5fde86d6c..e5e671115ab 100644 --- a/dimos/mapping/ray_tracing/rust/crate-hashes.json +++ b/dimos/mapping/ray_tracing/rust/crate-hashes.json @@ -1,6 +1,7 @@ { - "git+https://github.com/dimensionalOS/dimos-lcm.git?branch=rust-codegen#dimos-lcm@0.1.0": "sha256-GGkx4Mn6NYP6KZecmoRLKGWIih/+y8OgNn12DeXX6n8=", "git+https://github.com/dimensionalOS/dimos-lcm.git?branch=rust-codegen#lcm-msgs@0.1.0": "sha256-GGkx4Mn6NYP6KZecmoRLKGWIih/+y8OgNn12DeXX6n8=", - "git+https://github.com/dimensionalOS/dimos?rev=6663bcb6e5e18f43a6cb9cf77ccbec613e310443#dimos-module-macros@0.1.0": "sha256-6ikqdS3sroOJGI4WGuSyFx2yZjtJ+4Qgt+IGlkFl+qA=", - "git+https://github.com/dimensionalOS/dimos?rev=6663bcb6e5e18f43a6cb9cf77ccbec613e310443#dimos-module@0.1.0": "sha256-6ikqdS3sroOJGI4WGuSyFx2yZjtJ+4Qgt+IGlkFl+qA=" + "git+https://github.com/dimensionalOS/dimos-lcm.git?rev=04d78e8622500244123ba9cefa4c51b4cb454549#dimos-lcm@0.1.0": "sha256-GGkx4Mn6NYP6KZecmoRLKGWIih/+y8OgNn12DeXX6n8=", + "git+https://github.com/dimensionalOS/dimos-lcm.git?rev=04d78e8622500244123ba9cefa4c51b4cb454549#lcm-msgs@0.1.0": "sha256-GGkx4Mn6NYP6KZecmoRLKGWIih/+y8OgNn12DeXX6n8=", + "git+https://github.com/dimensionalOS/dimos?rev=fbbd1b5233886cc2cd4aa64756e730bb63c443e3#dimos-module-macros@0.1.0": "sha256-8kEU7z2EQmAf+MGMbnBKuvEl76V1Hfj2dvQGTTpI47M=", + "git+https://github.com/dimensionalOS/dimos?rev=fbbd1b5233886cc2cd4aa64756e730bb63c443e3#dimos-module@0.1.0": "sha256-8kEU7z2EQmAf+MGMbnBKuvEl76V1Hfj2dvQGTTpI47M=" } \ No newline at end of file diff --git a/dimos/models/embedding/clip.py b/dimos/models/embedding/clip.py index ad5e3e0cc6c..f429dc62a93 100644 --- a/dimos/models/embedding/clip.py +++ b/dimos/models/embedding/clip.py @@ -17,12 +17,12 @@ from functools import cached_property from typing import overload -from dimos.messages.sensor_msgs.msg import Image from PIL import Image as PILImage import torch import torch.nn.functional as functional from transformers import CLIPModel as HFCLIPModel, CLIPProcessor +from dimos.messages.sensor_msgs.msg import Image from dimos.models.base import HuggingFaceModel from dimos.models.embedding.base import Embedding, EmbeddingModel, HuggingFaceEmbeddingModelConfig from dimos.msgs.image import image_to_rgb diff --git a/dimos/models/embedding/dino.py b/dimos/models/embedding/dino.py index 5b0d24fd137..022a442ebf7 100644 --- a/dimos/models/embedding/dino.py +++ b/dimos/models/embedding/dino.py @@ -17,12 +17,12 @@ from functools import cached_property from typing import Any, overload -from dimos.messages.sensor_msgs.msg import Image from PIL import Image as PILImage import torch import torch.nn.functional as functional from transformers import AutoImageProcessor, AutoModel +from dimos.messages.sensor_msgs.msg import Image from dimos.models.base import HuggingFaceModel from dimos.models.embedding.base import Embedding, EmbeddingModel, HuggingFaceEmbeddingModelConfig from dimos.msgs.image import image_to_rgb diff --git a/dimos/models/embedding/siglip.py b/dimos/models/embedding/siglip.py index bb0ed762943..8cabb1afdf4 100644 --- a/dimos/models/embedding/siglip.py +++ b/dimos/models/embedding/siglip.py @@ -17,12 +17,12 @@ from functools import cached_property from typing import overload -from dimos.messages.sensor_msgs.msg import Image from PIL import Image as PILImage import torch import torch.nn.functional as functional from transformers import SiglipModel as HFSiglipModel, SiglipProcessor +from dimos.messages.sensor_msgs.msg import Image from dimos.models.base import HuggingFaceModel from dimos.models.embedding.base import Embedding, EmbeddingModel, HuggingFaceEmbeddingModelConfig from dimos.msgs.image import image_to_rgb diff --git a/dimos/models/embedding/siglip2.py b/dimos/models/embedding/siglip2.py index f8f1fe8861b..c85932f9176 100644 --- a/dimos/models/embedding/siglip2.py +++ b/dimos/models/embedding/siglip2.py @@ -17,12 +17,12 @@ from functools import cached_property from typing import overload -from dimos.messages.sensor_msgs.msg import Image from PIL import Image as PILImage import torch import torch.nn.functional as functional from transformers import SiglipModel as HFSiglipModel, SiglipProcessor +from dimos.messages.sensor_msgs.msg import Image from dimos.models.base import HuggingFaceModel from dimos.models.embedding.base import Embedding, EmbeddingModel, HuggingFaceEmbeddingModelConfig from dimos.msgs.image import image_to_rgb diff --git a/dimos/models/embedding/test_generated_images.py b/dimos/models/embedding/test_generated_images.py index e3c1245ab07..a51f9778ba4 100644 --- a/dimos/models/embedding/test_generated_images.py +++ b/dimos/models/embedding/test_generated_images.py @@ -29,20 +29,25 @@ from dimos.msgs.image import image_from_array, image_view -@pytest.mark.parametrize("model_type", [CLIPModel,DINOModel,SigLIPModel,SigLIP2Model]) -def test_generated_embeddings_keep_zero_source_time_and_convert_rgb(mocker,model_type): - processor,network=mocker.Mock(),mocker.Mock() - features=torch.tensor([[3.0,4.0]]) - processor.return_value=BatchFeature(data={"pixel_values":torch.zeros(1,3,4,8)}) - network.get_image_features.return_value=features - network.return_value=BaseModelOutputWithPooling(last_hidden_state=features[:,None,:],pooler_output=features) - mocker.patch.object(model_type,"_processor",new_callable=PropertyMock,return_value=processor) - mocker.patch.object(model_type,"_model",new_callable=PropertyMock,return_value=network) - image=image_from_array(np.full((4,8,3),[0,0,255],dtype=np.uint8),encoding="bgr8", - header=Header(frame_id="camera",stamp=Time(sec=0,nanosec=0))) - model=model_type(device="cpu") - result=model.embed(image) +@pytest.mark.parametrize("model_type", [CLIPModel, DINOModel, SigLIPModel, SigLIP2Model]) +def test_generated_embeddings_keep_zero_source_time_and_convert_rgb(mocker, model_type): + processor, network = mocker.Mock(), mocker.Mock() + features = torch.tensor([[3.0, 4.0]]) + processor.return_value = BatchFeature(data={"pixel_values": torch.zeros(1, 3, 4, 8)}) + network.get_image_features.return_value = features + network.return_value = BaseModelOutputWithPooling( + last_hidden_state=features[:, None, :], pooler_output=features + ) + mocker.patch.object(model_type, "_processor", new_callable=PropertyMock, return_value=processor) + mocker.patch.object(model_type, "_model", new_callable=PropertyMock, return_value=network) + image = image_from_array( + np.full((4, 8, 3), [0, 0, 255], dtype=np.uint8), + encoding="bgr8", + header=Header(frame_id="camera", stamp=Time(sec=0, nanosec=0)), + ) + model = model_type(device="cpu") + result = model.embed(image) assert result.timestamp == 0.0 - torch.testing.assert_close(result.vector,torch.tensor([0.6,0.8])) - assert processor.call_args.kwargs["images"][0].getpixel((0,0)) == (255,0,0) - np.testing.assert_array_equal(image_view(image)[0,0],[0,0,255]) + torch.testing.assert_close(result.vector, torch.tensor([0.6, 0.8])) + assert processor.call_args.kwargs["images"][0].getpixel((0, 0)) == (255, 0, 0) + np.testing.assert_array_equal(image_view(image)[0, 0], [0, 0, 255]) diff --git a/dimos/models/embedding/treid.py b/dimos/models/embedding/treid.py index ce36b5d004b..3ce7331eec3 100644 --- a/dimos/models/embedding/treid.py +++ b/dimos/models/embedding/treid.py @@ -19,11 +19,11 @@ from functools import cached_property -from dimos.messages.sensor_msgs.msg import Image import torch import torch.nn.functional as functional from torchreid import utils as torchreid_utils +from dimos.messages.sensor_msgs.msg import Image from dimos.models.base import LocalModel from dimos.models.embedding.base import Embedding, EmbeddingModel, EmbeddingModelConfig from dimos.msgs.image import image_to_bgr diff --git a/dimos/navigation/global_planner/mls_planner/rust/Cargo.lock b/dimos/navigation/global_planner/mls_planner/rust/Cargo.lock index 6e331d800ac..416501605ab 100644 --- a/dimos/navigation/global_planner/mls_planner/rust/Cargo.lock +++ b/dimos/navigation/global_planner/mls_planner/rust/Cargo.lock @@ -582,7 +582,7 @@ dependencies = [ [[package]] name = "dimos-lcm" version = "0.1.0" -source = "git+https://github.com/dimensionalOS/dimos-lcm.git?branch=rust-codegen#04d78e8622500244123ba9cefa4c51b4cb454549" +source = "git+https://github.com/dimensionalOS/dimos-lcm.git?rev=04d78e8622500244123ba9cefa4c51b4cb454549#04d78e8622500244123ba9cefa4c51b4cb454549" dependencies = [ "byteorder", "socket2 0.5.10", @@ -595,7 +595,7 @@ version = "0.1.0" dependencies = [ "ahash", "dimos-module", - "lcm-msgs", + "lcm-msgs 0.1.0 (git+https://github.com/dimensionalOS/dimos-lcm.git?branch=rust-codegen)", "rayon", "serde", "smallvec", @@ -619,11 +619,11 @@ dependencies = [ [[package]] name = "dimos-module" version = "0.1.0" -source = "git+https://github.com/dimensionalOS/dimos?rev=6663bcb6e5e18f43a6cb9cf77ccbec613e310443#6663bcb6e5e18f43a6cb9cf77ccbec613e310443" +source = "git+https://github.com/dimensionalOS/dimos?rev=fbbd1b5233886cc2cd4aa64756e730bb63c443e3#fbbd1b5233886cc2cd4aa64756e730bb63c443e3" dependencies = [ "dimos-lcm", "dimos-module-macros", - "lcm-msgs", + "lcm-msgs 0.1.0 (git+https://github.com/dimensionalOS/dimos-lcm.git?rev=04d78e8622500244123ba9cefa4c51b4cb454549)", "nalgebra", "rayon", "serde", @@ -639,7 +639,7 @@ dependencies = [ [[package]] name = "dimos-module-macros" version = "0.1.0" -source = "git+https://github.com/dimensionalOS/dimos?rev=6663bcb6e5e18f43a6cb9cf77ccbec613e310443#6663bcb6e5e18f43a6cb9cf77ccbec613e310443" +source = "git+https://github.com/dimensionalOS/dimos?rev=fbbd1b5233886cc2cd4aa64756e730bb63c443e3#fbbd1b5233886cc2cd4aa64756e730bb63c443e3" dependencies = [ "proc-macro2", "quote", @@ -1433,6 +1433,14 @@ dependencies = [ "byteorder", ] +[[package]] +name = "lcm-msgs" +version = "0.1.0" +source = "git+https://github.com/dimensionalOS/dimos-lcm.git?rev=04d78e8622500244123ba9cefa4c51b4cb454549#04d78e8622500244123ba9cefa4c51b4cb454549" +dependencies = [ + "byteorder", +] + [[package]] name = "libc" version = "0.2.189" diff --git a/dimos/navigation/global_planner/mls_planner/rust/Cargo.toml b/dimos/navigation/global_planner/mls_planner/rust/Cargo.toml index 9f47c6ad8fa..f49f819b51b 100644 --- a/dimos/navigation/global_planner/mls_planner/rust/Cargo.toml +++ b/dimos/navigation/global_planner/mls_planner/rust/Cargo.toml @@ -37,7 +37,7 @@ node_edges = "nav_msgs.LineSegments3D" path = "nav_msgs.Path" [dependencies] -dimos-module = { git = "https://github.com/dimensionalOS/dimos", rev = "6663bcb6e5e18f43a6cb9cf77ccbec613e310443" } +dimos-module = { git = "https://github.com/dimensionalOS/dimos", rev = "fbbd1b5233886cc2cd4aa64756e730bb63c443e3" } lcm-msgs = { git = "https://github.com/dimensionalOS/dimos-lcm.git", branch = "rust-codegen" } tokio = { version = "1", features = ["rt-multi-thread", "macros", "signal", "time"] } serde = { version = "1", features = ["derive"] } diff --git a/dimos/navigation/global_planner/mls_planner/rust/crate-hashes.json b/dimos/navigation/global_planner/mls_planner/rust/crate-hashes.json index 4c5fde86d6c..e5e671115ab 100644 --- a/dimos/navigation/global_planner/mls_planner/rust/crate-hashes.json +++ b/dimos/navigation/global_planner/mls_planner/rust/crate-hashes.json @@ -1,6 +1,7 @@ { - "git+https://github.com/dimensionalOS/dimos-lcm.git?branch=rust-codegen#dimos-lcm@0.1.0": "sha256-GGkx4Mn6NYP6KZecmoRLKGWIih/+y8OgNn12DeXX6n8=", "git+https://github.com/dimensionalOS/dimos-lcm.git?branch=rust-codegen#lcm-msgs@0.1.0": "sha256-GGkx4Mn6NYP6KZecmoRLKGWIih/+y8OgNn12DeXX6n8=", - "git+https://github.com/dimensionalOS/dimos?rev=6663bcb6e5e18f43a6cb9cf77ccbec613e310443#dimos-module-macros@0.1.0": "sha256-6ikqdS3sroOJGI4WGuSyFx2yZjtJ+4Qgt+IGlkFl+qA=", - "git+https://github.com/dimensionalOS/dimos?rev=6663bcb6e5e18f43a6cb9cf77ccbec613e310443#dimos-module@0.1.0": "sha256-6ikqdS3sroOJGI4WGuSyFx2yZjtJ+4Qgt+IGlkFl+qA=" + "git+https://github.com/dimensionalOS/dimos-lcm.git?rev=04d78e8622500244123ba9cefa4c51b4cb454549#dimos-lcm@0.1.0": "sha256-GGkx4Mn6NYP6KZecmoRLKGWIih/+y8OgNn12DeXX6n8=", + "git+https://github.com/dimensionalOS/dimos-lcm.git?rev=04d78e8622500244123ba9cefa4c51b4cb454549#lcm-msgs@0.1.0": "sha256-GGkx4Mn6NYP6KZecmoRLKGWIih/+y8OgNn12DeXX6n8=", + "git+https://github.com/dimensionalOS/dimos?rev=fbbd1b5233886cc2cd4aa64756e730bb63c443e3#dimos-module-macros@0.1.0": "sha256-8kEU7z2EQmAf+MGMbnBKuvEl76V1Hfj2dvQGTTpI47M=", + "git+https://github.com/dimensionalOS/dimos?rev=fbbd1b5233886cc2cd4aa64756e730bb63c443e3#dimos-module@0.1.0": "sha256-8kEU7z2EQmAf+MGMbnBKuvEl76V1Hfj2dvQGTTpI47M=" } \ No newline at end of file diff --git a/dimos/navigation/local_planner/rust/Cargo.lock b/dimos/navigation/local_planner/rust/Cargo.lock index 97e25524ce5..d70b3b9742e 100644 --- a/dimos/navigation/local_planner/rust/Cargo.lock +++ b/dimos/navigation/local_planner/rust/Cargo.lock @@ -582,7 +582,7 @@ dependencies = [ [[package]] name = "dimos-lcm" version = "0.1.0" -source = "git+https://github.com/dimensionalOS/dimos-lcm.git?branch=rust-codegen#04d78e8622500244123ba9cefa4c51b4cb454549" +source = "git+https://github.com/dimensionalOS/dimos-lcm.git?rev=04d78e8622500244123ba9cefa4c51b4cb454549#04d78e8622500244123ba9cefa4c51b4cb454549" dependencies = [ "byteorder", "socket2 0.5.10", @@ -594,7 +594,7 @@ name = "dimos-local-planner" version = "0.1.0" dependencies = [ "dimos-module", - "lcm-msgs", + "lcm-msgs 0.1.0 (git+https://github.com/dimensionalOS/dimos-lcm.git?branch=rust-codegen)", "serde", "serde_json", "tokio", @@ -606,11 +606,11 @@ dependencies = [ [[package]] name = "dimos-module" version = "0.1.0" -source = "git+https://github.com/dimensionalOS/dimos?rev=6663bcb6e5e18f43a6cb9cf77ccbec613e310443#6663bcb6e5e18f43a6cb9cf77ccbec613e310443" +source = "git+https://github.com/dimensionalOS/dimos?rev=fbbd1b5233886cc2cd4aa64756e730bb63c443e3#fbbd1b5233886cc2cd4aa64756e730bb63c443e3" dependencies = [ "dimos-lcm", "dimos-module-macros", - "lcm-msgs", + "lcm-msgs 0.1.0 (git+https://github.com/dimensionalOS/dimos-lcm.git?rev=04d78e8622500244123ba9cefa4c51b4cb454549)", "nalgebra", "rayon", "serde", @@ -626,7 +626,7 @@ dependencies = [ [[package]] name = "dimos-module-macros" version = "0.1.0" -source = "git+https://github.com/dimensionalOS/dimos?rev=6663bcb6e5e18f43a6cb9cf77ccbec613e310443#6663bcb6e5e18f43a6cb9cf77ccbec613e310443" +source = "git+https://github.com/dimensionalOS/dimos?rev=fbbd1b5233886cc2cd4aa64756e730bb63c443e3#fbbd1b5233886cc2cd4aa64756e730bb63c443e3" dependencies = [ "proc-macro2", "quote", @@ -1405,6 +1405,14 @@ dependencies = [ "byteorder", ] +[[package]] +name = "lcm-msgs" +version = "0.1.0" +source = "git+https://github.com/dimensionalOS/dimos-lcm.git?rev=04d78e8622500244123ba9cefa4c51b4cb454549#04d78e8622500244123ba9cefa4c51b4cb454549" +dependencies = [ + "byteorder", +] + [[package]] name = "libc" version = "0.2.189" diff --git a/dimos/navigation/local_planner/rust/Cargo.toml b/dimos/navigation/local_planner/rust/Cargo.toml index 99cb298684a..0ed78fad589 100644 --- a/dimos/navigation/local_planner/rust/Cargo.toml +++ b/dimos/navigation/local_planner/rust/Cargo.toml @@ -17,7 +17,7 @@ required-features = ["module"] [dependencies] serde = { version = "1", features = ["derive"] } serde_json = { version = "1", features = ["float_roundtrip"] } -dimos-module = { git = "https://github.com/dimensionalOS/dimos", rev = "6663bcb6e5e18f43a6cb9cf77ccbec613e310443", optional = true } +dimos-module = { git = "https://github.com/dimensionalOS/dimos", rev = "fbbd1b5233886cc2cd4aa64756e730bb63c443e3", optional = true } lcm-msgs = { git = "https://github.com/dimensionalOS/dimos-lcm.git", branch = "rust-codegen", optional = true } tokio = { version = "1", features = ["rt-multi-thread", "macros", "signal", "time"], optional = true } tracing = { version = "0.1", optional = true } diff --git a/dimos/navigation/local_planner/rust/crate-hashes.json b/dimos/navigation/local_planner/rust/crate-hashes.json index 4c5fde86d6c..e5e671115ab 100644 --- a/dimos/navigation/local_planner/rust/crate-hashes.json +++ b/dimos/navigation/local_planner/rust/crate-hashes.json @@ -1,6 +1,7 @@ { - "git+https://github.com/dimensionalOS/dimos-lcm.git?branch=rust-codegen#dimos-lcm@0.1.0": "sha256-GGkx4Mn6NYP6KZecmoRLKGWIih/+y8OgNn12DeXX6n8=", "git+https://github.com/dimensionalOS/dimos-lcm.git?branch=rust-codegen#lcm-msgs@0.1.0": "sha256-GGkx4Mn6NYP6KZecmoRLKGWIih/+y8OgNn12DeXX6n8=", - "git+https://github.com/dimensionalOS/dimos?rev=6663bcb6e5e18f43a6cb9cf77ccbec613e310443#dimos-module-macros@0.1.0": "sha256-6ikqdS3sroOJGI4WGuSyFx2yZjtJ+4Qgt+IGlkFl+qA=", - "git+https://github.com/dimensionalOS/dimos?rev=6663bcb6e5e18f43a6cb9cf77ccbec613e310443#dimos-module@0.1.0": "sha256-6ikqdS3sroOJGI4WGuSyFx2yZjtJ+4Qgt+IGlkFl+qA=" + "git+https://github.com/dimensionalOS/dimos-lcm.git?rev=04d78e8622500244123ba9cefa4c51b4cb454549#dimos-lcm@0.1.0": "sha256-GGkx4Mn6NYP6KZecmoRLKGWIih/+y8OgNn12DeXX6n8=", + "git+https://github.com/dimensionalOS/dimos-lcm.git?rev=04d78e8622500244123ba9cefa4c51b4cb454549#lcm-msgs@0.1.0": "sha256-GGkx4Mn6NYP6KZecmoRLKGWIih/+y8OgNn12DeXX6n8=", + "git+https://github.com/dimensionalOS/dimos?rev=fbbd1b5233886cc2cd4aa64756e730bb63c443e3#dimos-module-macros@0.1.0": "sha256-8kEU7z2EQmAf+MGMbnBKuvEl76V1Hfj2dvQGTTpI47M=", + "git+https://github.com/dimensionalOS/dimos?rev=fbbd1b5233886cc2cd4aa64756e730bb63c443e3#dimos-module@0.1.0": "sha256-8kEU7z2EQmAf+MGMbnBKuvEl76V1Hfj2dvQGTTpI47M=" } \ No newline at end of file diff --git a/dimos/navigation/trajectory_follower/fancy/rust/Cargo.lock b/dimos/navigation/trajectory_follower/fancy/rust/Cargo.lock index f319e21e7c4..58eb12a5f3e 100644 --- a/dimos/navigation/trajectory_follower/fancy/rust/Cargo.lock +++ b/dimos/navigation/trajectory_follower/fancy/rust/Cargo.lock @@ -582,7 +582,7 @@ dependencies = [ [[package]] name = "dimos-lcm" version = "0.1.0" -source = "git+https://github.com/dimensionalOS/dimos-lcm.git?branch=rust-codegen#04d78e8622500244123ba9cefa4c51b4cb454549" +source = "git+https://github.com/dimensionalOS/dimos-lcm.git?rev=04d78e8622500244123ba9cefa4c51b4cb454549#04d78e8622500244123ba9cefa4c51b4cb454549" dependencies = [ "byteorder", "socket2 0.5.10", @@ -594,7 +594,7 @@ name = "dimos-local-planner" version = "0.1.0" dependencies = [ "dimos-module", - "lcm-msgs", + "lcm-msgs 0.1.0 (git+https://github.com/dimensionalOS/dimos-lcm.git?branch=rust-codegen)", "serde", "serde_json", "tokio", @@ -606,11 +606,11 @@ dependencies = [ [[package]] name = "dimos-module" version = "0.1.0" -source = "git+https://github.com/dimensionalOS/dimos?rev=6663bcb6e5e18f43a6cb9cf77ccbec613e310443#6663bcb6e5e18f43a6cb9cf77ccbec613e310443" +source = "git+https://github.com/dimensionalOS/dimos?rev=fbbd1b5233886cc2cd4aa64756e730bb63c443e3#fbbd1b5233886cc2cd4aa64756e730bb63c443e3" dependencies = [ "dimos-lcm", "dimos-module-macros", - "lcm-msgs", + "lcm-msgs 0.1.0 (git+https://github.com/dimensionalOS/dimos-lcm.git?rev=04d78e8622500244123ba9cefa4c51b4cb454549)", "nalgebra", "rayon", "serde", @@ -626,7 +626,7 @@ dependencies = [ [[package]] name = "dimos-module-macros" version = "0.1.0" -source = "git+https://github.com/dimensionalOS/dimos?rev=6663bcb6e5e18f43a6cb9cf77ccbec613e310443#6663bcb6e5e18f43a6cb9cf77ccbec613e310443" +source = "git+https://github.com/dimensionalOS/dimos?rev=fbbd1b5233886cc2cd4aa64756e730bb63c443e3#fbbd1b5233886cc2cd4aa64756e730bb63c443e3" dependencies = [ "proc-macro2", "quote", @@ -640,7 +640,7 @@ version = "0.1.0" dependencies = [ "dimos-local-planner", "dimos-module", - "lcm-msgs", + "lcm-msgs 0.1.0 (git+https://github.com/dimensionalOS/dimos-lcm.git?branch=rust-codegen)", "numpy", "pyo3", "serde", @@ -1437,6 +1437,14 @@ dependencies = [ "byteorder", ] +[[package]] +name = "lcm-msgs" +version = "0.1.0" +source = "git+https://github.com/dimensionalOS/dimos-lcm.git?rev=04d78e8622500244123ba9cefa4c51b4cb454549#04d78e8622500244123ba9cefa4c51b4cb454549" +dependencies = [ + "byteorder", +] + [[package]] name = "libc" version = "0.2.189" diff --git a/dimos/navigation/trajectory_follower/fancy/rust/Cargo.toml b/dimos/navigation/trajectory_follower/fancy/rust/Cargo.toml index ad24d3e149e..5be6ed8dfc2 100644 --- a/dimos/navigation/trajectory_follower/fancy/rust/Cargo.toml +++ b/dimos/navigation/trajectory_follower/fancy/rust/Cargo.toml @@ -20,7 +20,7 @@ required-features = ["module"] # The body (`Emb`) the laws are parameterised from; python feature off, see adapter. dimos-local-planner = { path = "../../../local_planner/rust", default-features = false } serde = { version = "1", features = ["derive"], optional = true } -dimos-module = { git = "https://github.com/dimensionalOS/dimos", rev = "6663bcb6e5e18f43a6cb9cf77ccbec613e310443", optional = true } +dimos-module = { git = "https://github.com/dimensionalOS/dimos", rev = "fbbd1b5233886cc2cd4aa64756e730bb63c443e3", optional = true } lcm-msgs = { git = "https://github.com/dimensionalOS/dimos-lcm.git", branch = "rust-codegen", optional = true } tokio = { version = "1", features = ["rt-multi-thread", "macros", "signal", "time"], optional = true } tracing = { version = "0.1", optional = true } diff --git a/dimos/navigation/trajectory_follower/fancy/rust/crate-hashes.json b/dimos/navigation/trajectory_follower/fancy/rust/crate-hashes.json index 4c5fde86d6c..e5e671115ab 100644 --- a/dimos/navigation/trajectory_follower/fancy/rust/crate-hashes.json +++ b/dimos/navigation/trajectory_follower/fancy/rust/crate-hashes.json @@ -1,6 +1,7 @@ { - "git+https://github.com/dimensionalOS/dimos-lcm.git?branch=rust-codegen#dimos-lcm@0.1.0": "sha256-GGkx4Mn6NYP6KZecmoRLKGWIih/+y8OgNn12DeXX6n8=", "git+https://github.com/dimensionalOS/dimos-lcm.git?branch=rust-codegen#lcm-msgs@0.1.0": "sha256-GGkx4Mn6NYP6KZecmoRLKGWIih/+y8OgNn12DeXX6n8=", - "git+https://github.com/dimensionalOS/dimos?rev=6663bcb6e5e18f43a6cb9cf77ccbec613e310443#dimos-module-macros@0.1.0": "sha256-6ikqdS3sroOJGI4WGuSyFx2yZjtJ+4Qgt+IGlkFl+qA=", - "git+https://github.com/dimensionalOS/dimos?rev=6663bcb6e5e18f43a6cb9cf77ccbec613e310443#dimos-module@0.1.0": "sha256-6ikqdS3sroOJGI4WGuSyFx2yZjtJ+4Qgt+IGlkFl+qA=" + "git+https://github.com/dimensionalOS/dimos-lcm.git?rev=04d78e8622500244123ba9cefa4c51b4cb454549#dimos-lcm@0.1.0": "sha256-GGkx4Mn6NYP6KZecmoRLKGWIih/+y8OgNn12DeXX6n8=", + "git+https://github.com/dimensionalOS/dimos-lcm.git?rev=04d78e8622500244123ba9cefa4c51b4cb454549#lcm-msgs@0.1.0": "sha256-GGkx4Mn6NYP6KZecmoRLKGWIih/+y8OgNn12DeXX6n8=", + "git+https://github.com/dimensionalOS/dimos?rev=fbbd1b5233886cc2cd4aa64756e730bb63c443e3#dimos-module-macros@0.1.0": "sha256-8kEU7z2EQmAf+MGMbnBKuvEl76V1Hfj2dvQGTTpI47M=", + "git+https://github.com/dimensionalOS/dimos?rev=fbbd1b5233886cc2cd4aa64756e730bb63c443e3#dimos-module@0.1.0": "sha256-8kEU7z2EQmAf+MGMbnBKuvEl76V1Hfj2dvQGTTpI47M=" } \ No newline at end of file diff --git a/dimos/navigation/trajectory_follower/fancy/rust/flake.lock b/dimos/navigation/trajectory_follower/fancy/rust/flake.lock index d3f170199e1..a5947ad83a3 100644 --- a/dimos/navigation/trajectory_follower/fancy/rust/flake.lock +++ b/dimos/navigation/trajectory_follower/fancy/rust/flake.lock @@ -90,11 +90,11 @@ }, "locked": { "dir": "dimos/navigation/local_planner/rust", - "lastModified": 1792134367, - "narHash": "sha256-MFGVh66kb5TXulN5CAtnNbUTDBDxjdSogd7gqhVSt14=", + "lastModified": 1792472589, + "narHash": "sha256-spLoKmcHg3vp9Jrkx4TPllNivCg+gMeuYEcjqMK7ehU=", "owner": "dimensionalOS", "repo": "dimos", - "rev": "b938c8a601dae4a0de3af093f1af2e36950bfdbb", + "rev": "75318e5adf7a67bc651d1cda4b9d5d440e23bd88", "type": "github" }, "original": { diff --git a/dimos/perception/depth2depth_cloud/module.py b/dimos/perception/depth2depth_cloud/module.py index 36d2cdc4d0d..917a3ef2b6c 100644 --- a/dimos/perception/depth2depth_cloud/module.py +++ b/dimos/perception/depth2depth_cloud/module.py @@ -23,10 +23,8 @@ from dimos.core.native_module import NativeModule, NativeModuleConfig from dimos.core.stream import In, Out -from dimos.msgs.sensor_msgs.CameraInfo import CameraInfo -from dimos.msgs.sensor_msgs.CompressedImage import CompressedImage -from dimos.msgs.sensor_msgs.PointCloud2 import PointCloud2 -from dimos.msgs.tf2_msgs.TFMessage import TFMessage +from dimos.messages.sensor_msgs.msg import CameraInfo, CompressedImage, PointCloud2 +from dimos.messages.tf2_msgs.msg import TFMessage def has_nvidia_gpu() -> bool: diff --git a/dimos/perception/depth2depth_cloud/rust/Cargo.lock b/dimos/perception/depth2depth_cloud/rust/Cargo.lock index 57ec25d21e6..f33bea2c3f7 100644 --- a/dimos/perception/depth2depth_cloud/rust/Cargo.lock +++ b/dimos/perception/depth2depth_cloud/rust/Cargo.lock @@ -831,8 +831,8 @@ name = "dimos-depth2depth-cloud" version = "0.1.0" dependencies = [ "depth2depth", + "dimos-generated-messages", "dimos-module", - "lcm-msgs", "nalgebra", "rayon", "serde", @@ -842,10 +842,21 @@ dependencies = [ "validator", ] +[[package]] +name = "dimos-generated-messages" +version = "0.0.14" +dependencies = [ + "heapless", + "re_cdr", + "ros2msg", + "serde", + "serde-big-array", +] + [[package]] name = "dimos-lcm" version = "0.1.0" -source = "git+https://github.com/dimensionalOS/dimos-lcm.git?branch=rust-codegen#04d78e8622500244123ba9cefa4c51b4cb454549" +source = "git+https://github.com/dimensionalOS/dimos-lcm.git?rev=04d78e8622500244123ba9cefa4c51b4cb454549#04d78e8622500244123ba9cefa4c51b4cb454549" dependencies = [ "byteorder", "socket2 0.5.10", @@ -855,13 +866,13 @@ dependencies = [ [[package]] name = "dimos-module" version = "0.1.0" -source = "git+https://github.com/dimensionalOS/dimos?rev=6663bcb6e5e18f43a6cb9cf77ccbec613e310443#6663bcb6e5e18f43a6cb9cf77ccbec613e310443" dependencies = [ "dimos-lcm", "dimos-module-macros", "lcm-msgs", "nalgebra", "rayon", + "re_cdr", "serde", "serde_json", "tokio", @@ -875,7 +886,6 @@ dependencies = [ [[package]] name = "dimos-module-macros" version = "0.1.0" -source = "git+https://github.com/dimensionalOS/dimos?rev=6663bcb6e5e18f43a6cb9cf77ccbec613e310443#6663bcb6e5e18f43a6cb9cf77ccbec613e310443" dependencies = [ "proc-macro2", "quote", @@ -1616,6 +1626,15 @@ dependencies = [ "zerocopy", ] +[[package]] +name = "hash32" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47d60b12902ba28e2730cd37e95b8c9223af2808df9e902d4df49588d1470606" +dependencies = [ + "byteorder", +] + [[package]] name = "hashbrown" version = "0.12.3" @@ -1660,6 +1679,17 @@ version = "0.17.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a" +[[package]] +name = "heapless" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bfb9eb618601c89945a70e254898da93b13be0388091d42117462b265bb3fad" +dependencies = [ + "hash32", + "serde", + "stable_deref_trait", +] + [[package]] name = "heck" version = "0.5.0" @@ -2078,7 +2108,7 @@ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" [[package]] name = "lcm-msgs" version = "0.1.0" -source = "git+https://github.com/dimensionalOS/dimos-lcm.git?branch=rust-codegen#04d78e8622500244123ba9cefa4c51b4cb454549" +source = "git+https://github.com/dimensionalOS/dimos-lcm.git?rev=04d78e8622500244123ba9cefa4c51b4cb454549#04d78e8622500244123ba9cefa4c51b4cb454549" dependencies = [ "byteorder", ] @@ -2828,6 +2858,16 @@ dependencies = [ "zerocopy", ] +[[package]] +name = "prettyplease" +version = "0.2.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b" +dependencies = [ + "proc-macro2", + "syn 2.0.119", +] + [[package]] name = "proc-macro-crate" version = "3.5.0" @@ -3162,6 +3202,18 @@ dependencies = [ "yasna", ] +[[package]] +name = "re_cdr" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bba10c21433b597481f366b978cdf2617e56785b38cb0dcc3833c6b8ad7e061a" +dependencies = [ + "bytemuck", + "byteorder", + "serde", + "thiserror 2.0.20", +] + [[package]] name = "reborrow" version = "0.5.5" @@ -3284,6 +3336,23 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "ros2msg" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2fe291be5cb6d4b8e6bf9c9de80c40bd1cb09ecac50deafa2fdcae0027e04988" +dependencies = [ + "heck", + "pest", + "pest_derive", + "prettyplease", + "proc-macro2", + "quote", + "regex", + "syn 2.0.119", + "thiserror 2.0.20", +] + [[package]] name = "rustc-hash" version = "2.1.3" @@ -3566,6 +3635,15 @@ dependencies = [ "serde_derive", ] +[[package]] +name = "serde-big-array" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11fc7cc2c76d73e0f27ee52abbd64eec84d46f370c88371120433196934e4b7f" +dependencies = [ + "serde", +] + [[package]] name = "serde_core" version = "1.0.229" diff --git a/dimos/perception/depth2depth_cloud/rust/Cargo.toml b/dimos/perception/depth2depth_cloud/rust/Cargo.toml index 08b0649468f..0029d419dd0 100644 --- a/dimos/perception/depth2depth_cloud/rust/Cargo.toml +++ b/dimos/perception/depth2depth_cloud/rust/Cargo.toml @@ -21,17 +21,17 @@ path = "dimos_depth2depth_cloud::module::Depth2DepthCloud" python = "dimos.perception.depth2depth_cloud.module:Depth2DepthCloud" [package.metadata.dimos.module.depth2depth_cloud.inputs] -image = "sensor_msgs.CompressedImage" -camera_info = "sensor_msgs.CameraInfo" -lidar = "sensor_msgs.PointCloud2" -tf = "tf2_msgs.TFMessage" +image = "sensor_msgs/msg/CompressedImage" +camera_info = "sensor_msgs/msg/CameraInfo" +lidar = "sensor_msgs/msg/PointCloud2" +tf = "tf2_msgs/msg/TFMessage" [package.metadata.dimos.module.depth2depth_cloud.outputs] -depth_cloud = "sensor_msgs.PointCloud2" +depth_cloud = "sensor_msgs/msg/PointCloud2" [dependencies] -dimos-module = { git = "https://github.com/dimensionalOS/dimos", rev = "6663bcb6e5e18f43a6cb9cf77ccbec613e310443" } -lcm-msgs = { git = "https://github.com/dimensionalOS/dimos-lcm.git", branch = "rust-codegen" } +dimos-module = { path = "../../../../native/rust/dimos-module", features = ["cdr"] } +dimos-generated-messages = { path = "../../../../build/message-source/rust" } tokio = { version = "1", features = ["rt-multi-thread", "macros", "signal"] } serde = { version = "1", features = ["derive"] } tracing = "0.1" diff --git a/dimos/perception/depth2depth_cloud/rust/crate-hashes.json b/dimos/perception/depth2depth_cloud/rust/crate-hashes.json index 4c5fde86d6c..677538f3a27 100644 --- a/dimos/perception/depth2depth_cloud/rust/crate-hashes.json +++ b/dimos/perception/depth2depth_cloud/rust/crate-hashes.json @@ -1,6 +1,4 @@ { - "git+https://github.com/dimensionalOS/dimos-lcm.git?branch=rust-codegen#dimos-lcm@0.1.0": "sha256-GGkx4Mn6NYP6KZecmoRLKGWIih/+y8OgNn12DeXX6n8=", - "git+https://github.com/dimensionalOS/dimos-lcm.git?branch=rust-codegen#lcm-msgs@0.1.0": "sha256-GGkx4Mn6NYP6KZecmoRLKGWIih/+y8OgNn12DeXX6n8=", - "git+https://github.com/dimensionalOS/dimos?rev=6663bcb6e5e18f43a6cb9cf77ccbec613e310443#dimos-module-macros@0.1.0": "sha256-6ikqdS3sroOJGI4WGuSyFx2yZjtJ+4Qgt+IGlkFl+qA=", - "git+https://github.com/dimensionalOS/dimos?rev=6663bcb6e5e18f43a6cb9cf77ccbec613e310443#dimos-module@0.1.0": "sha256-6ikqdS3sroOJGI4WGuSyFx2yZjtJ+4Qgt+IGlkFl+qA=" + "git+https://github.com/dimensionalOS/dimos-lcm.git?rev=04d78e8622500244123ba9cefa4c51b4cb454549#dimos-lcm@0.1.0": "sha256-GGkx4Mn6NYP6KZecmoRLKGWIih/+y8OgNn12DeXX6n8=", + "git+https://github.com/dimensionalOS/dimos-lcm.git?rev=04d78e8622500244123ba9cefa4c51b4cb454549#lcm-msgs@0.1.0": "sha256-GGkx4Mn6NYP6KZecmoRLKGWIih/+y8OgNn12DeXX6n8=" } \ No newline at end of file diff --git a/dimos/perception/depth2depth_cloud/rust/flake.nix b/dimos/perception/depth2depth_cloud/rust/flake.nix index 14d86bcec2b..2901288ad19 100644 --- a/dimos/perception/depth2depth_cloud/rust/flake.nix +++ b/dimos/perception/depth2depth_cloud/rust/flake.nix @@ -1,5 +1,5 @@ { - description = "depth2depth_cloud native module for DimOS: the depth2depth crate behind an LCM wrapper"; + description = "depth2depth_cloud native module for DimOS: the depth2depth crate with CDR messages over the selected transport"; inputs = { nix-filter.url = "github:numtide/nix-filter"; @@ -32,7 +32,30 @@ cudaPackages = if system == "aarch64-linux" then pkgs.cudaPackages_12_6 else pkgs.cudaPackages_12_8; name = "dimos-depth2depth-cloud"; - src = nix-filter.lib { root = ./.; exclude = [ "target" "build" "result" "__pycache__" ]; }; + moduleSource = nix-filter.lib { root = ./.; exclude = [ "target" "build" "result" "__pycache__" ]; }; + sharedArchive = pkgs.fetchurl { + url = "https://codeload.github.com/dimensionalOS/dimos/tar.gz/b547716883d0f2619e53d241351357347400a40a"; + sha256 = "1ec7f63d9ff57a3e5f151009a2b71472b2c90a3c4f17c29f98a6215cbef18c6b"; + }; + sharedSource = pkgs.runCommand "dimos-depth-cloud-sdk-source" { + nativeBuildInputs = [ pkgs.gnutar pkgs.gzip ]; + } '' + mkdir -p $out + tar -xzf ${sharedArchive} --strip-components=1 -C $out + ''; + messageSource = (import "${sharedSource}/native/message-source.nix" { inherit pkgs; }).source; + # Cargo resolves only these explicit local paths. No checkout or generation + # process is needed at runtime; the message derivation is shared with pip. + src = pkgs.runCommand "depth-cloud-cdr-source" { } '' + cp -r ${moduleSource} $out + chmod -R u+w $out + mkdir -p $out/sdk + cp -r ${sharedSource}/native/rust/dimos-module ${sharedSource}/native/rust/dimos-module-macros $out/sdk/ + cp -r ${messageSource}/rust $out/messages + substituteInPlace $out/Cargo.toml \ + --replace-fail '../../../../native/rust/dimos-module' 'sdk/dimos-module' \ + --replace-fail '../../../../build/message-source/rust' 'messages' + ''; generated = crate2nix.tools.${system}.generatedCargoNix { inherit name src; }; ours = [ name "dimos-module" "dimos-module-macros" ]; diff --git a/dimos/perception/depth2depth_cloud/rust/src/module.rs b/dimos/perception/depth2depth_cloud/rust/src/module.rs index 3e40d6498c4..12246ff5bd6 100644 --- a/dimos/perception/depth2depth_cloud/rust/src/module.rs +++ b/dimos/perception/depth2depth_cloud/rust/src/module.rs @@ -31,10 +31,15 @@ use std::time::{Duration, Instant}; use depth2depth::{ Calibration, CalibrationConfig, CloudOptions, Config as ModelConfig, Depth2Depth, }; -use dimos_module::pointcloud::extract_xyz; +use dimos_generated_messages::builtin_interfaces::msg::time::Time; +use dimos_generated_messages::sensor_msgs::msg::camera_info::CameraInfo; +use dimos_generated_messages::sensor_msgs::msg::compressed_image::CompressedImage; +use dimos_generated_messages::sensor_msgs::msg::point_cloud2::PointCloud2; +use dimos_generated_messages::sensor_msgs::msg::point_field::PointField; +use dimos_generated_messages::std_msgs::msg::header::Header; +use dimos_module::cdr; +use dimos_module::pointcloud::{extract_xyz_rows, ExtractError}; use dimos_module::{native_config, warn_throttled, Input, Module, Output, Tf}; -use lcm_msgs::sensor_msgs::{CameraInfo, CompressedImage, PointCloud2, PointField}; -use lcm_msgs::std_msgs::{Header, Time}; use nalgebra::{Isometry3, Point3}; use tokio::sync::Notify; use tokio::task::JoinHandle; @@ -42,6 +47,124 @@ use tracing::info; use crate::undistort::{Lens, UndistortMap}; +fn encode_cloud(cloud: &PointCloud2) -> Vec { + cdr::encode(cloud).expect("serialize a valid generated PointCloud2") +} + +fn extract_xyz(cloud: &PointCloud2) -> Result, ExtractError> { + let offset = |name: &str| { + cloud + .fields + .iter() + .find(|field| { + field.name == name && field.datatype == PointField::FLOAT32 && field.count == 1 + }) + .map(|field| field.offset as usize) + .ok_or(ExtractError("missing a scalar float32 xyz field")) + }; + extract_xyz_rows( + &cloud.data, + [cloud.width as usize, cloud.height as usize], + [cloud.point_step as usize, cloud.row_step as usize], + [offset("x")?, offset("y")?, offset("z")?], + cloud.is_bigendian, + ) +} + +fn decode_tf(bytes: &[u8]) -> std::io::Result> { + use dimos_generated_messages::tf2_msgs::msg::tf_message::TFMessage; + use nalgebra::{Quaternion, Translation3, UnitQuaternion}; + let message: TFMessage = cdr::decode(bytes)?; + message + .transforms + .into_iter() + .map(|edge| { + let p = edge.transform.translation; + let q = edge.transform.rotation; + if ![p.x, p.y, p.z, q.x, q.y, q.z, q.w] + .iter() + .all(|v| v.is_finite()) + { + return Err(std::io::Error::new( + std::io::ErrorKind::InvalidData, + "nonfinite TF components", + )); + } + let rotation = UnitQuaternion::try_new(Quaternion::new(q.w, q.x, q.y, q.z), 1e-9) + .ok_or_else(|| { + std::io::Error::new(std::io::ErrorKind::InvalidData, "zero TF quaternion") + })?; + if edge.header.stamp.nanosec >= 1_000_000_000 { + return Err(std::io::Error::new( + std::io::ErrorKind::InvalidData, + "unnormalized TF stamp", + )); + } + Ok(dimos_module::tf::Transform::new( + edge.header.frame_id, + edge.child_frame_id, + seconds(&edge.header.stamp), + Isometry3::from_parts(Translation3::new(p.x, p.y, p.z), rotation), + )) + }) + .collect() +} + +fn encode_tf(transforms: &[dimos_module::tf::Transform]) -> std::io::Result> { + use dimos_generated_messages::{ + geometry_msgs::msg::{ + quaternion::Quaternion, transform::Transform, transform_stamped::TransformStamped, + vector3::Vector3, + }, + tf2_msgs::msg::tf_message::TFMessage, + }; + let transforms = transforms + .iter() + .map(|value| { + let ns = (value.ts * 1e9).round(); + if !ns.is_finite() || ns < i64::MIN as f64 || ns > i64::MAX as f64 { + return Err(std::io::Error::new( + std::io::ErrorKind::InvalidInput, + "TF timestamp is outside range", + )); + } + let ns = ns as i64; + let sec = i32::try_from(ns.div_euclid(1_000_000_000)).map_err(|_| { + std::io::Error::new( + std::io::ErrorKind::InvalidInput, + "TF seconds exceed ROS int32", + ) + })?; + let p = value.translation(); + let q = value.rotation(); + Ok(TransformStamped { + header: Header { + stamp: Time { + sec, + nanosec: ns.rem_euclid(1_000_000_000) as u32, + }, + frame_id: value.parent.clone(), + }, + child_frame_id: value.child.clone(), + transform: Transform { + translation: Vector3 { + x: p.x, + y: p.y, + z: p.z, + }, + rotation: Quaternion { + x: q.i, + y: q.j, + z: q.k, + w: q.w, + }, + }, + }) + }) + .collect::>>()?; + cdr::encode(&TFMessage { transforms }) +} + const TIMING_REPORT_EVERY: Duration = Duration::from_secs(5); /// Scans up to this far after a frame still anchor it... const SCAN_LEAD_S: f64 = 0.5; @@ -122,19 +245,19 @@ pub struct Config { #[derive(Module)] #[module(name = "depth2depth_cloud", setup = start, teardown = stop)] pub struct Depth2DepthCloud { - #[input(decode = CompressedImage::decode, handler = on_image)] + #[input(decode = cdr::decode, handler = on_image)] image: Input, - #[input(decode = CameraInfo::decode, handler = on_camera_info)] + #[input(decode = cdr::decode, handler = on_camera_info)] camera_info: Input, - #[input(decode = PointCloud2::decode, handler = on_lidar)] + #[input(decode = cdr::decode, handler = on_lidar)] lidar: Input, - #[tf] + #[tf(decode = decode_tf, encode = encode_tf)] tf: Tf, - #[output(encode = PointCloud2::encode)] + #[output(encode = encode_cloud)] depth_cloud: Output, #[config] @@ -418,8 +541,8 @@ impl Worker { }; let decoded = Instant::now(); if !undistort.as_ref().is_some_and(|(held, held_width, _)| { - held.K == info.K - && held.D == info.D + held.k == info.k + && held.d == info.d && held.distortion_model == info.distortion_model && held.width == info.width && *held_width == width @@ -712,10 +835,10 @@ fn decode_rgb(image: &CompressedImage, scale: usize) -> Option<(Vec, usize, } fn make_cloud(points: &[[f32; 3]], source: &Header, frame_id: String) -> PointCloud2 { - let field = |name: &str, offset: i32| PointField { + let field = |name: &str, offset: u32| PointField { name: name.into(), offset, - datatype: PointField::FLOAT32 as u8, + datatype: PointField::FLOAT32, count: 1, }; let data: Vec = points @@ -725,16 +848,15 @@ fn make_cloud(points: &[[f32; 3]], source: &Header, frame_id: String) -> PointCl .collect(); PointCloud2 { header: Header { - seq: source.seq, stamp: source.stamp.clone(), frame_id, }, height: 1, - width: points.len() as i32, + width: points.len() as u32, fields: vec![field("x", 0), field("y", 4), field("z", 8)], is_bigendian: false, point_step: 12, - row_step: 12 * points.len() as i32, + row_step: 12 * points.len() as u32, data, is_dense: true, } @@ -754,7 +876,7 @@ fn or_derived(configured: usize, derived: usize) -> usize { } fn seconds(stamp: &Time) -> f64 { - stamp.sec as f64 + stamp.nsec as f64 * 1e-9 + stamp.sec as f64 + stamp.nanosec as f64 * 1e-9 } /// Config, then calibration, then image frame, since drivers stamp frames nobody publishes a transform for. @@ -824,6 +946,48 @@ impl Timing { mod tests { use super::*; + #[test] + fn generated_cloud_roundtrips_cdr_with_exact_negative_and_epoch_stamps() { + for stamp in [ + Time { + sec: -1, + nanosec: 999_999_999, + }, + Time { + sec: 1_700_000_000, + nanosec: 123_456_789, + }, + ] { + let header = Header { + stamp: stamp.clone(), + frame_id: "camera".into(), + }; + let cloud = make_cloud(&[[1., 2., 3.]], &header, "optical".into()); + let received: PointCloud2 = cdr::decode(&encode_cloud(&cloud)).unwrap(); + assert_eq!(received.header.stamp.sec, stamp.sec); + assert_eq!(received.header.stamp.nanosec, stamp.nanosec); + assert_eq!(received.header.frame_id, "optical"); + assert_eq!(extract_xyz(&received).unwrap(), vec![[1., 2., 3.]]); + } + } + + #[test] + fn cdr_tf_adapter_preserves_frames_and_rejects_wrong_encoding() { + let transform = dimos_module::tf::Transform::new( + "world", + "camera", + -0.25, + Isometry3::translation(1., 2., 3.), + ); + let decoded = decode_tf(&encode_tf(&[transform]).unwrap()).unwrap(); + assert_eq!(decoded.len(), 1); + assert_eq!(decoded[0].parent, "world"); + assert_eq!(decoded[0].child, "camera"); + assert_eq!(decoded[0].ts, -0.25); + assert_eq!(decoded[0].translation(), nalgebra::Vector3::new(1., 2., 3.)); + assert!(decode_tf(&[0, 3, 0, 0]).is_err()); + } + #[test] fn a_stage_behind_takes_the_newest_item_and_counts_the_ones_it_missed() { let latest = Latest::default(); @@ -845,8 +1009,12 @@ mod tests { #[test] fn a_non_jpeg_format_is_refused_rather_than_fed_to_the_decoder() { let png = CompressedImage { + header: Header { + stamp: Time { sec: 0, nanosec: 0 }, + frame_id: String::new(), + }, format: "png".into(), - ..Default::default() + data: Vec::new(), }; assert!(decode_rgb(&png, 1).is_none()); } @@ -854,8 +1022,7 @@ mod tests { #[test] fn the_cloud_carries_the_points_and_the_source_stamp() { let header = Header { - seq: 7, - stamp: Time { sec: 3, nsec: 4 }, + stamp: Time { sec: 3, nanosec: 4 }, frame_id: "image".into(), }; let cloud = make_cloud( @@ -867,7 +1034,7 @@ mod tests { ( cloud.width, cloud.header.frame_id.as_str(), - cloud.header.stamp.nsec + cloud.header.stamp.nanosec ), (2, "camera", 4) ); diff --git a/dimos/perception/depth2depth_cloud/rust/src/undistort.rs b/dimos/perception/depth2depth_cloud/rust/src/undistort.rs index 41751feff60..23f1132e9ab 100644 --- a/dimos/perception/depth2depth_cloud/rust/src/undistort.rs +++ b/dimos/perception/depth2depth_cloud/rust/src/undistort.rs @@ -16,7 +16,7 @@ //! projection both assume straight lines stay straight. use depth2depth::Pinhole; -use lcm_msgs::sensor_msgs::CameraInfo; +use dimos_generated_messages::sensor_msgs::msg::camera_info::CameraInfo; use rayon::prelude::*; /// Pinhole + distortion, as it arrives in a `CameraInfo`. @@ -56,21 +56,21 @@ impl Lens { /// The lens as seen in an image `scale` times the calibration's resolution; None without usable intrinsics /// or for a distortion model this cannot undistort. pub fn from_info(info: &CameraInfo, scale: f64) -> Option { - let (fx, fy) = (info.K[0], info.K[4]); + let (fx, fy) = (info.k[0], info.k[4]); if !(fx > 0.0 && fy > 0.0 && fx.is_finite() && fy.is_finite()) { return None; } let model = Model::from_name(&info.distortion_model)?; // Eight coefficients mean the rational model whatever `distortion_model` claims; some drivers mislabel it plumb_bob. let mut distortion = [0.0; 8]; - for (slot, value) in distortion.iter_mut().zip(&info.D) { + for (slot, value) in distortion.iter_mut().zip(&info.d) { *slot = *value; } Some(Self { fx: fx * scale, fy: fy * scale, - cx: (info.K[2] + 0.5) * scale - 0.5, - cy: (info.K[5] + 0.5) * scale - 0.5, + cx: (info.k[2] + 0.5) * scale - 0.5, + cy: (info.k[5] + 0.5) * scale - 0.5, model, distortion, }) @@ -185,9 +185,27 @@ mod tests { CameraInfo { width: 1920, height: 1536, - K: [1000.0, 0.0, 959.5, 0.0, 1000.0, 767.5, 0.0, 0.0, 1.0], - D: coefficients.to_vec(), - ..Default::default() + k: [1000.0, 0.0, 959.5, 0.0, 1000.0, 767.5, 0.0, 0.0, 1.0], + d: coefficients.to_vec(), + header: dimos_generated_messages::std_msgs::msg::header::Header { + stamp: dimos_generated_messages::builtin_interfaces::msg::time::Time { + sec: 0, + nanosec: 0, + }, + frame_id: String::new(), + }, + distortion_model: "plumb_bob".into(), + r: [0.; 9], + p: [0.; 12], + binning_x: 0, + binning_y: 0, + roi: dimos_generated_messages::sensor_msgs::msg::region_of_interest::RegionOfInterest { + x_offset: 0, + y_offset: 0, + width: 0, + height: 0, + do_rectify: false, + }, } } @@ -227,7 +245,7 @@ mod tests { let mut head = info(&[ -0.6792, -0.638, 0.0002, -0.0002, -0.0302, -0.2868, -0.9987, -0.1752, ]); - head.K = [1012.59, 0.0, 962.21, 0.0, 1012.13, 765.67, 0.0, 0.0, 1.0]; + head.k = [1012.59, 0.0, 962.21, 0.0, 1012.13, 765.67, 0.0, 0.0, 1.0]; let lens = Lens::from_info(&head, 1.0).unwrap(); for ((x, y), (u, v)) in [ ((-0.9467, -0.7570), (300.77, 237.5)), @@ -246,7 +264,7 @@ mod tests { // The Go2 front camera (front_camera_720.yaml); OpenCV's fisheye::distortPoints puts these rays here. let mut go2 = info(&[-0.0730943, -0.0234114, -0.0069306, 0.0092387]); go2.distortion_model = "equidistant".into(); - go2.K = [ + go2.k = [ 797.4756, 0.0, 643.5352, 0.0, 796.4872, 349.2784, 0.0, 0.0, 1.0, ]; let lens = Lens::from_info(&go2, 1.0).unwrap(); @@ -274,7 +292,7 @@ mod tests { #[test] fn zero_focal_length_is_refused() { let mut bad = info(&[0.0; 5]); - bad.K[0] = 0.0; + bad.k[0] = 0.0; assert!(Lens::from_info(&bad, 1.0).is_none()); } diff --git a/dimos/perception/depth2depth_cloud/test_depth2depth_cloud_config.py b/dimos/perception/depth2depth_cloud/test_depth2depth_cloud_config.py index d04478f913b..47ba6aa1ad9 100644 --- a/dimos/perception/depth2depth_cloud/test_depth2depth_cloud_config.py +++ b/dimos/perception/depth2depth_cloud/test_depth2depth_cloud_config.py @@ -16,15 +16,16 @@ from __future__ import annotations +from pathlib import Path import re from pydantic import ValidationError import pytest -from dimos.constants import DIMOS_PROJECT_ROOT +from dimos.perception.depth2depth_cloud import module from dimos.perception.depth2depth_cloud.module import Depth2DepthCloudConfig -RUST_MODULE = DIMOS_PROJECT_ROOT / "dimos/perception/depth2depth_cloud/rust/src/module.rs" +RUST_MODULE = Path(__file__).with_name("rust") / "src/module.rs" def test_every_field_the_rust_config_requires_is_sent(): @@ -59,8 +60,6 @@ def test_a_jpeg_scale_the_decoder_cannot_do_is_refused(): def test_an_nvidia_gpu_builds_tensorrt_and_anything_else_the_cpu_build(monkeypatch): - from dimos.perception.depth2depth_cloud import module - monkeypatch.setattr(module, "has_nvidia_gpu", lambda: False) assert Depth2DepthCloudConfig().build_command == "nix build -L path:." monkeypatch.setattr(module, "has_nvidia_gpu", lambda: True) diff --git a/dimos/robot/unitree/go2/dds/rust/Cargo.lock b/dimos/robot/unitree/go2/dds/rust/Cargo.lock index d0f71e3b2e3..6498e911a01 100644 --- a/dimos/robot/unitree/go2/dds/rust/Cargo.lock +++ b/dimos/robot/unitree/go2/dds/rust/Cargo.lock @@ -667,7 +667,7 @@ dependencies = [ "cdr", "cyclonedds-rs", "dimos-module", - "lcm-msgs", + "lcm-msgs 0.1.0 (git+https://github.com/dimensionalOS/dimos-lcm.git?branch=rust-codegen)", "serde", "serde-big-array", "serde_json", @@ -679,7 +679,7 @@ dependencies = [ [[package]] name = "dimos-lcm" version = "0.1.0" -source = "git+https://github.com/dimensionalOS/dimos-lcm.git?branch=rust-codegen#04d78e8622500244123ba9cefa4c51b4cb454549" +source = "git+https://github.com/dimensionalOS/dimos-lcm.git?rev=04d78e8622500244123ba9cefa4c51b4cb454549#04d78e8622500244123ba9cefa4c51b4cb454549" dependencies = [ "byteorder", "socket2 0.5.10", @@ -689,11 +689,11 @@ dependencies = [ [[package]] name = "dimos-module" version = "0.1.0" -source = "git+https://github.com/dimensionalOS/dimos?rev=6663bcb6e5e18f43a6cb9cf77ccbec613e310443#6663bcb6e5e18f43a6cb9cf77ccbec613e310443" +source = "git+https://github.com/dimensionalOS/dimos?rev=fbbd1b5233886cc2cd4aa64756e730bb63c443e3#fbbd1b5233886cc2cd4aa64756e730bb63c443e3" dependencies = [ "dimos-lcm", "dimos-module-macros", - "lcm-msgs", + "lcm-msgs 0.1.0 (git+https://github.com/dimensionalOS/dimos-lcm.git?rev=04d78e8622500244123ba9cefa4c51b4cb454549)", "nalgebra", "rayon", "serde", @@ -709,7 +709,7 @@ dependencies = [ [[package]] name = "dimos-module-macros" version = "0.1.0" -source = "git+https://github.com/dimensionalOS/dimos?rev=6663bcb6e5e18f43a6cb9cf77ccbec613e310443#6663bcb6e5e18f43a6cb9cf77ccbec613e310443" +source = "git+https://github.com/dimensionalOS/dimos?rev=fbbd1b5233886cc2cd4aa64756e730bb63c443e3#fbbd1b5233886cc2cd4aa64756e730bb63c443e3" dependencies = [ "proc-macro2", "quote", @@ -1513,6 +1513,14 @@ dependencies = [ "byteorder", ] +[[package]] +name = "lcm-msgs" +version = "0.1.0" +source = "git+https://github.com/dimensionalOS/dimos-lcm.git?rev=04d78e8622500244123ba9cefa4c51b4cb454549#04d78e8622500244123ba9cefa4c51b4cb454549" +dependencies = [ + "byteorder", +] + [[package]] name = "libc" version = "0.2.189" diff --git a/dimos/robot/unitree/go2/dds/rust/Cargo.toml b/dimos/robot/unitree/go2/dds/rust/Cargo.toml index e9c79457575..822d6d05f69 100644 --- a/dimos/robot/unitree/go2/dds/rust/Cargo.toml +++ b/dimos/robot/unitree/go2/dds/rust/Cargo.toml @@ -16,7 +16,7 @@ path = "src/bin/go2_dds.rs" [dependencies] # Our forks, vendored: the robot has no GitHub access. See vendor/*/Cargo.toml. cyclonedds-rs = { path = "vendor/cyclonedds-rs", default-features = false } -dimos-module = { git = "https://github.com/dimensionalOS/dimos", rev = "6663bcb6e5e18f43a6cb9cf77ccbec613e310443" } +dimos-module = { git = "https://github.com/dimensionalOS/dimos", rev = "fbbd1b5233886cc2cd4aa64756e730bb63c443e3" } lcm-msgs = { git = "https://github.com/dimensionalOS/dimos-lcm.git", branch = "rust-codegen" } serde = { version = "1", features = ["derive"] } serde-big-array = "0.5" diff --git a/dimos/robot/unitree/go2/dds/rust/crate-hashes.json b/dimos/robot/unitree/go2/dds/rust/crate-hashes.json index 4c5fde86d6c..e5e671115ab 100644 --- a/dimos/robot/unitree/go2/dds/rust/crate-hashes.json +++ b/dimos/robot/unitree/go2/dds/rust/crate-hashes.json @@ -1,6 +1,7 @@ { - "git+https://github.com/dimensionalOS/dimos-lcm.git?branch=rust-codegen#dimos-lcm@0.1.0": "sha256-GGkx4Mn6NYP6KZecmoRLKGWIih/+y8OgNn12DeXX6n8=", "git+https://github.com/dimensionalOS/dimos-lcm.git?branch=rust-codegen#lcm-msgs@0.1.0": "sha256-GGkx4Mn6NYP6KZecmoRLKGWIih/+y8OgNn12DeXX6n8=", - "git+https://github.com/dimensionalOS/dimos?rev=6663bcb6e5e18f43a6cb9cf77ccbec613e310443#dimos-module-macros@0.1.0": "sha256-6ikqdS3sroOJGI4WGuSyFx2yZjtJ+4Qgt+IGlkFl+qA=", - "git+https://github.com/dimensionalOS/dimos?rev=6663bcb6e5e18f43a6cb9cf77ccbec613e310443#dimos-module@0.1.0": "sha256-6ikqdS3sroOJGI4WGuSyFx2yZjtJ+4Qgt+IGlkFl+qA=" + "git+https://github.com/dimensionalOS/dimos-lcm.git?rev=04d78e8622500244123ba9cefa4c51b4cb454549#dimos-lcm@0.1.0": "sha256-GGkx4Mn6NYP6KZecmoRLKGWIih/+y8OgNn12DeXX6n8=", + "git+https://github.com/dimensionalOS/dimos-lcm.git?rev=04d78e8622500244123ba9cefa4c51b4cb454549#lcm-msgs@0.1.0": "sha256-GGkx4Mn6NYP6KZecmoRLKGWIih/+y8OgNn12DeXX6n8=", + "git+https://github.com/dimensionalOS/dimos?rev=fbbd1b5233886cc2cd4aa64756e730bb63c443e3#dimos-module-macros@0.1.0": "sha256-8kEU7z2EQmAf+MGMbnBKuvEl76V1Hfj2dvQGTTpI47M=", + "git+https://github.com/dimensionalOS/dimos?rev=fbbd1b5233886cc2cd4aa64756e730bb63c443e3#dimos-module@0.1.0": "sha256-8kEU7z2EQmAf+MGMbnBKuvEl76V1Hfj2dvQGTTpI47M=" } \ No newline at end of file diff --git a/examples/native-modules/rust/Cargo.lock b/examples/native-modules/rust/Cargo.lock index 5d93b115412..294151795fd 100644 --- a/examples/native-modules/rust/Cargo.lock +++ b/examples/native-modules/rust/Cargo.lock @@ -582,7 +582,7 @@ dependencies = [ [[package]] name = "dimos-lcm" version = "0.1.0" -source = "git+https://github.com/dimensionalOS/dimos-lcm.git?branch=rust-codegen#04d78e8622500244123ba9cefa4c51b4cb454549" +source = "git+https://github.com/dimensionalOS/dimos-lcm.git?rev=04d78e8622500244123ba9cefa4c51b4cb454549#04d78e8622500244123ba9cefa4c51b4cb454549" dependencies = [ "byteorder", "socket2 0.5.10", @@ -592,11 +592,11 @@ dependencies = [ [[package]] name = "dimos-module" version = "0.1.0" -source = "git+https://github.com/dimensionalOS/dimos?rev=6663bcb6e5e18f43a6cb9cf77ccbec613e310443#6663bcb6e5e18f43a6cb9cf77ccbec613e310443" +source = "git+https://github.com/dimensionalOS/dimos?rev=fbbd1b5233886cc2cd4aa64756e730bb63c443e3#fbbd1b5233886cc2cd4aa64756e730bb63c443e3" dependencies = [ "dimos-lcm", "dimos-module-macros", - "lcm-msgs", + "lcm-msgs 0.1.0 (git+https://github.com/dimensionalOS/dimos-lcm.git?rev=04d78e8622500244123ba9cefa4c51b4cb454549)", "nalgebra", "rayon", "serde", @@ -612,7 +612,7 @@ dependencies = [ [[package]] name = "dimos-module-macros" version = "0.1.0" -source = "git+https://github.com/dimensionalOS/dimos?rev=6663bcb6e5e18f43a6cb9cf77ccbec613e310443#6663bcb6e5e18f43a6cb9cf77ccbec613e310443" +source = "git+https://github.com/dimensionalOS/dimos?rev=fbbd1b5233886cc2cd4aa64756e730bb63c443e3#fbbd1b5233886cc2cd4aa64756e730bb63c443e3" dependencies = [ "proc-macro2", "quote", @@ -625,7 +625,7 @@ name = "dimos-native-module-examples" version = "0.1.0" dependencies = [ "dimos-module", - "lcm-msgs", + "lcm-msgs 0.1.0 (git+https://github.com/dimensionalOS/dimos-lcm.git?branch=rust-codegen)", "serde", "tokio", "tracing", @@ -1403,6 +1403,14 @@ dependencies = [ "byteorder", ] +[[package]] +name = "lcm-msgs" +version = "0.1.0" +source = "git+https://github.com/dimensionalOS/dimos-lcm.git?rev=04d78e8622500244123ba9cefa4c51b4cb454549#04d78e8622500244123ba9cefa4c51b4cb454549" +dependencies = [ + "byteorder", +] + [[package]] name = "libc" version = "0.2.189" diff --git a/examples/native-modules/rust/Cargo.toml b/examples/native-modules/rust/Cargo.toml index b7d0cf69700..13623541665 100644 --- a/examples/native-modules/rust/Cargo.toml +++ b/examples/native-modules/rust/Cargo.toml @@ -20,7 +20,7 @@ name = "tf_broadcaster" path = "src/tf_broadcaster.rs" [dependencies] -dimos-module = { git = "https://github.com/dimensionalOS/dimos", rev = "6663bcb6e5e18f43a6cb9cf77ccbec613e310443" } +dimos-module = { git = "https://github.com/dimensionalOS/dimos", rev = "fbbd1b5233886cc2cd4aa64756e730bb63c443e3" } lcm-msgs = { git = "https://github.com/dimensionalOS/dimos-lcm.git", branch = "rust-codegen" } tokio = { version = "1", features = ["rt-multi-thread", "macros", "time"] } serde = { version = "1", features = ["derive"] } diff --git a/examples/native-modules/rust/crate-hashes.json b/examples/native-modules/rust/crate-hashes.json index 4c5fde86d6c..e5e671115ab 100644 --- a/examples/native-modules/rust/crate-hashes.json +++ b/examples/native-modules/rust/crate-hashes.json @@ -1,6 +1,7 @@ { - "git+https://github.com/dimensionalOS/dimos-lcm.git?branch=rust-codegen#dimos-lcm@0.1.0": "sha256-GGkx4Mn6NYP6KZecmoRLKGWIih/+y8OgNn12DeXX6n8=", "git+https://github.com/dimensionalOS/dimos-lcm.git?branch=rust-codegen#lcm-msgs@0.1.0": "sha256-GGkx4Mn6NYP6KZecmoRLKGWIih/+y8OgNn12DeXX6n8=", - "git+https://github.com/dimensionalOS/dimos?rev=6663bcb6e5e18f43a6cb9cf77ccbec613e310443#dimos-module-macros@0.1.0": "sha256-6ikqdS3sroOJGI4WGuSyFx2yZjtJ+4Qgt+IGlkFl+qA=", - "git+https://github.com/dimensionalOS/dimos?rev=6663bcb6e5e18f43a6cb9cf77ccbec613e310443#dimos-module@0.1.0": "sha256-6ikqdS3sroOJGI4WGuSyFx2yZjtJ+4Qgt+IGlkFl+qA=" + "git+https://github.com/dimensionalOS/dimos-lcm.git?rev=04d78e8622500244123ba9cefa4c51b4cb454549#dimos-lcm@0.1.0": "sha256-GGkx4Mn6NYP6KZecmoRLKGWIih/+y8OgNn12DeXX6n8=", + "git+https://github.com/dimensionalOS/dimos-lcm.git?rev=04d78e8622500244123ba9cefa4c51b4cb454549#lcm-msgs@0.1.0": "sha256-GGkx4Mn6NYP6KZecmoRLKGWIih/+y8OgNn12DeXX6n8=", + "git+https://github.com/dimensionalOS/dimos?rev=fbbd1b5233886cc2cd4aa64756e730bb63c443e3#dimos-module-macros@0.1.0": "sha256-8kEU7z2EQmAf+MGMbnBKuvEl76V1Hfj2dvQGTTpI47M=", + "git+https://github.com/dimensionalOS/dimos?rev=fbbd1b5233886cc2cd4aa64756e730bb63c443e3#dimos-module@0.1.0": "sha256-8kEU7z2EQmAf+MGMbnBKuvEl76V1Hfj2dvQGTTpI47M=" } \ No newline at end of file diff --git a/native/rust/dimos-module/src/pointcloud.rs b/native/rust/dimos-module/src/pointcloud.rs index 31b8ef0aee6..1e6b7ddba7a 100644 --- a/native/rust/dimos-module/src/pointcloud.rs +++ b/native/rust/dimos-module/src/pointcloud.rs @@ -58,45 +58,78 @@ pub fn extract_xyz(msg: &PointCloud2) -> Result, ExtractError> { if step == 0 { return Err(ExtractError("point_step is 0")); } - let n = count(msg.width, "negative width")? - .checked_mul(count(msg.height, "negative height")?) - .ok_or(ExtractError("width*height overflows"))?; - let needed = n + let width = count(msg.width, "negative width")?; + let height = count(msg.height, "negative height")?; + let row_step = width .checked_mul(step) - .ok_or(ExtractError("width*height*point_step overflows"))?; - if msg.data.len() < needed { - return Err(ExtractError( - "data buffer shorter than width*height*point_step", - )); - } - for off in [xo, yo, zo] { - if off.checked_add(4).is_none_or(|end| end > step) { + .ok_or(ExtractError("row size overflows"))?; + extract_xyz_rows( + &msg.data, + [width, height], + [step, row_step], + [xo, yo, zo], + false, + ) +} + +/// Read finite float32 xyz values from validated field offsets, respecting row padding. +/// Message adapters retain their own schema types and pass only the wire layout here. +pub fn extract_xyz_rows( + data: &[u8], + dimensions: [usize; 2], + steps: [usize; 2], + offsets: [usize; 3], + big_endian: bool, +) -> Result, ExtractError> { + let [width, height] = dimensions; + let [step, row_step] = steps; + if step == 0 { + return Err(ExtractError("point_step is 0")); + } + let packed = width + .checked_mul(step) + .ok_or(ExtractError("row size overflows"))?; + if row_step < packed { + return Err(ExtractError("row_step is shorter than a row")); + } + let needed = height + .checked_mul(row_step) + .ok_or(ExtractError("row buffer size overflows"))?; + if data.len() < needed { + return Err(ExtractError("data buffer shorter than rows")); + } + for offset in offsets { + if offset.checked_add(4).is_none_or(|end| end > step) { return Err(ExtractError( "xyz field offsets do not fit within point_step", )); } } - - let mut out = Vec::with_capacity(n); - for base in (0..needed).step_by(step) { - let x = read_f32_le(&msg.data, base + xo); - let y = read_f32_le(&msg.data, base + yo); - let z = read_f32_le(&msg.data, base + zo); - if x.is_finite() && y.is_finite() && z.is_finite() { - out.push([x, y, z]); + let mut out = Vec::new(); + if width == 0 || height == 0 { + return Ok(out); + } + for row in 0..height { + for column in 0..width { + let base = row * row_step + column * step; + let point = offsets.map(|offset| { + let bytes: [u8; 4] = data[base + offset..base + offset + 4] + .try_into() + .expect("bounds checked above"); + if big_endian { + f32::from_be_bytes(bytes) + } else { + f32::from_le_bytes(bytes) + } + }); + if point.iter().all(|value| value.is_finite()) { + out.push(point); + } } } Ok(out) } -#[inline] -fn read_f32_le(buf: &[u8], off: usize) -> f32 { - let bytes: [u8; 4] = buf[off..off + 4] - .try_into() - .expect("bounds checked by caller"); - f32::from_le_bytes(bytes) -} - #[cfg(test)] mod tests { use super::*; @@ -129,6 +162,40 @@ mod tests { } } + #[test] + fn padded_rows_and_both_byte_orders_preserve_finite_points() { + for big_endian in [false, true] { + let mut bytes = Vec::new(); + for xyz in [[1.0f32, 2.0, 3.0], [4.0, 5.0, 6.0]] { + for value in xyz { + bytes.extend(if big_endian { + value.to_be_bytes() + } else { + value.to_le_bytes() + }); + } + bytes.extend([255u8; 4]); + } + assert_eq!( + extract_xyz_rows(&bytes, [1, 2], [12, 16], [0, 4, 8], big_endian).unwrap(), + vec![[1., 2., 3.], [4., 5., 6.]] + ); + } + } + + #[test] + fn malformed_row_layouts_are_rejected_before_allocation_or_indexing() { + for (dimensions, steps, offsets) in [ + ([1, 1], [12, 11], [0, 4, 8]), + ([1, 2], [12, 16], [0, 4, 8]), + ([1, 1], [12, 12], [0, 4, usize::MAX]), + ([usize::MAX, 1], [12, 12], [0, 4, 8]), + ([1, usize::MAX], [12, 16], [0, 4, 8]), + ] { + assert!(extract_xyz_rows(&[0; 16], dimensions, steps, offsets, false).is_err()); + } + } + #[test] fn drops_non_finite_points_and_moves_nothing() { let cloud = cloud_of(&[[1.0, 2.0, 0.3], [f32::NAN, 0.0, 0.0], [0.0, 0.0, 0.0]]);