diff --git a/crates/re_viewer/src/depthai/depthai.rs b/crates/re_viewer/src/depthai/depthai.rs index 7d818ae70095..d32f354d3a51 100644 --- a/crates/re_viewer/src/depthai/depthai.rs +++ b/crates/re_viewer/src/depthai/depthai.rs @@ -355,6 +355,8 @@ pub struct ToFConfig { enable_temperature_correction: Option, enable_wiggle_correction: Option, enable_phase_unwrapping: Option, + enable_phase_shuffle_temporal_filter: Option, + enable_burst_mode: Option, #[serde(skip)] modified: bool, } @@ -370,6 +372,8 @@ impl Default for ToFConfig { enable_temperature_correction: None, enable_wiggle_correction: None, enable_phase_unwrapping: None, + enable_phase_shuffle_temporal_filter: Some(true), + enable_burst_mode: Some(false), modified: false, } } @@ -408,6 +412,14 @@ impl ToFConfig { self.enable_phase_unwrapping } + pub fn get_enable_phase_shuffle_temporal_filter(&self) -> Option { + self.enable_phase_shuffle_temporal_filter + } + + pub fn get_enable_burst_mode(&self) -> Option { + self.enable_burst_mode + } + pub fn set_median_filter(&mut self, median: MedianFilter) { if self.median != median { self.modified = true; @@ -464,6 +476,20 @@ impl ToFConfig { self.enable_phase_unwrapping = enable; } + pub fn set_enable_phase_shuffle_temporal_filter(&mut self, enable: Option) { + if self.enable_phase_shuffle_temporal_filter != enable { + self.modified = true; + } + self.enable_phase_shuffle_temporal_filter = enable; + } + + pub fn set_enable_burst_mode(&mut self, enable: Option) { + if self.enable_burst_mode != enable { + self.modified = true; + } + self.enable_burst_mode = enable; + } + pub fn is_modified(&self) -> bool { self.modified } diff --git a/crates/re_viewer/src/ui/device_settings_panel.rs b/crates/re_viewer/src/ui/device_settings_panel.rs index ccb573d65ddf..e33a175abe14 100644 --- a/crates/re_viewer/src/ui/device_settings_panel.rs +++ b/crates/re_viewer/src/ui/device_settings_panel.rs @@ -355,6 +355,35 @@ impl DeviceSettingsPanel { enable_wiggle_correction, )); } + let mut enable_phase_shuffle_temporal_filter = tof_config + .get_enable_phase_shuffle_temporal_filter() + .unwrap_or(false); + if ctx + .re_ui + .labeled_toggle_switch( + ui, + "Enable phase shuffle temporal filter", + &mut enable_phase_shuffle_temporal_filter, + ) + .changed() + { + tof_config.set_enable_phase_shuffle_temporal_filter(Some( + enable_phase_shuffle_temporal_filter, + )); + } + let mut enable_burst_mode = tof_config.get_enable_burst_mode().unwrap_or(false); + if ctx + .re_ui + .labeled_toggle_switch( + ui, + "Enable burst mode", + &mut enable_burst_mode, + ) + .changed() + { + tof_config.set_enable_burst_mode(Some(enable_burst_mode)); + } + }) }); } diff --git a/rerun_py/depthai_viewer/_backend/device.py b/rerun_py/depthai_viewer/_backend/device.py index daab9164d617..5dd3615e1fc7 100644 --- a/rerun_py/depthai_viewer/_backend/device.py +++ b/rerun_py/depthai_viewer/_backend/device.py @@ -6,14 +6,15 @@ from typing import Dict, List, Optional, Tuple import depthai as dai -import depthai_viewer as viewer import numpy as np from depthai_sdk import OakCamera from depthai_sdk.classes.packet_handlers import ComponentOutput from depthai_sdk.components import CameraComponent, NNComponent, StereoComponent -from depthai_sdk.components.tof_component import ToFComponent from depthai_sdk.components.camera_helper import getClosestIspScale from depthai_sdk.components.tof_component import Component, ToFComponent +from numpy.typing import NDArray + +import depthai_viewer as viewer from depthai_viewer._backend.device_configuration import ( ALL_NEURAL_NETWORKS, CameraConfiguration, @@ -45,7 +46,6 @@ ) from depthai_viewer._backend.store import Store from depthai_viewer.install_requirements import model_dir -from numpy.typing import NDArray class XlinkStatistics: diff --git a/rerun_py/depthai_viewer/_backend/device_configuration.py b/rerun_py/depthai_viewer/_backend/device_configuration.py index 4fc43ac4b255..44b5b55aea3d 100644 --- a/rerun_py/depthai_viewer/_backend/device_configuration.py +++ b/rerun_py/depthai_viewer/_backend/device_configuration.py @@ -239,6 +239,8 @@ class ToFConfig(BaseModel): # type: ignore[misc] enable_optical_correction: Optional[bool] = True enable_temperature_correction: Optional[bool] = False enable_wiggle_correction: Optional[bool] = True + enable_phase_shuffle_temporal_filter: Optional[bool] = True + enable_burst_mode: Optional[bool] = False class Config: arbitrary_types_allowed = True @@ -259,6 +261,8 @@ def dict(self, *args, **kwargs) -> Dict[str, Any]: # type: ignore[no-untyped-de "enable_temperature_correction": self.enable_temperature_correction, "enable_wiggle_correction": self.enable_wiggle_correction, "enable_phase_unwrapping": self.enable_phase_unwrapping, + "enable_phase_shuffle_temporal_filter": self.enable_phase_shuffle_temporal_filter, + "enable_burst_mode": self.enable_burst_mode, } def to_dai(self) -> dai.RawToFConfig: @@ -271,6 +275,8 @@ def to_dai(self) -> dai.RawToFConfig: cfg.enableTemperatureCorrection = self.enable_temperature_correction # type: ignore[attr-defined] cfg.enableWiggleCorrection = self.enable_wiggle_correction # type: ignore[attr-defined] cfg.enablePhaseUnwrapping = self.enable_phase_unwrapping # type: ignore[attr-defined] + cfg.enablePhaseShuffleTemporalFilter = self.enable_phase_shuffle_temporal_filter # type: ignore[attr-defined] + cfg.enableBurstMode = self.enable_burst_mode # type: ignore[attr-defined] return cfg diff --git a/rerun_py/depthai_viewer/_backend/main.py b/rerun_py/depthai_viewer/_backend/main.py index b4bbbd863fbc..6bb311a8d6ab 100644 --- a/rerun_py/depthai_viewer/_backend/main.py +++ b/rerun_py/depthai_viewer/_backend/main.py @@ -19,14 +19,17 @@ ) from depthai_viewer._backend.store import Store -sentry_sdk.init( # type: ignore[abstract] - dsn="https://37decdc44d584dca906e43ebd7fd1508@sentry.luxonis.com/16", - # Set traces_sample_rate to 1.0 to capture 100% - # of transactions for performance monitoring. - # We recommend adjusting this value in production. - traces_sample_rate=1.0, - release=f"depthai-viewer@{depthai_viewer_version()}", -) +try: + sentry_sdk.init( # type: ignore[abstract] + dsn="https://37decdc44d584dca906e43ebd7fd1508@sentry.luxonis.com/16", + # Set traces_sample_rate to 1.0 to capture 100% + # of transactions for performance monitoring. + # We recommend adjusting this value in production. + traces_sample_rate=1.0, + release=f"depthai-viewer@{depthai_viewer_version()}", + ) +except: + print("Failed to initialize sentry") class DepthaiViewerBack: diff --git a/rerun_py/depthai_viewer/_backend/packet_handler.py b/rerun_py/depthai_viewer/_backend/packet_handler.py index ea283c569a79..201f607c8fba 100644 --- a/rerun_py/depthai_viewer/_backend/packet_handler.py +++ b/rerun_py/depthai_viewer/_backend/packet_handler.py @@ -2,7 +2,6 @@ import cv2 import depthai as dai -import depthai_viewer as viewer import numpy as np from ahrs.filters import Mahony from depthai_sdk.classes.packets import ( # PointcloudPacket, @@ -23,11 +22,13 @@ StereoComponent, ) from depthai_sdk.components.tof_component import ToFComponent +from numpy.typing import NDArray +from pydantic import BaseModel + +import depthai_viewer as viewer from depthai_viewer._backend.store import Store from depthai_viewer._backend.topic import Topic from depthai_viewer.components.rect2d import RectFormat -from numpy.typing import NDArray -from pydantic import BaseModel class PacketHandlerContext(BaseModel): # type: ignore[misc] diff --git a/rerun_py/depthai_viewer/requirements.txt b/rerun_py/depthai_viewer/requirements.txt index 259ae947a792..5694eca2b6af 100644 --- a/rerun_py/depthai_viewer/requirements.txt +++ b/rerun_py/depthai_viewer/requirements.txt @@ -4,7 +4,7 @@ setuptools ahrs # depthai_sdk conflicts with depthai, so it's installed seperatelly in __main__.py --extra-index-url https://artifacts.luxonis.com/artifactory/luxonis-python-snapshot-local -depthai==2.25.0.0.dev0+f1cd4d974e041f1b3ea84480afcdc5a8e3975299 +depthai==2.25.0.0.dev0+5411a6b821087908e721eff5b74ac9d91a85de92 websockets pydantic==1.9 deprecated