diff --git a/field_friend/interface/components/development.py b/field_friend/interface/components/development.py index a2587adb..4e99a180 100644 --- a/field_friend/interface/components/development.py +++ b/field_friend/interface/components/development.py @@ -2,6 +2,7 @@ import rosys from nicegui import ui +from rosys.hardware import EspPins from .hardware_control import hardware_control from .io_overview import io_overview @@ -32,3 +33,11 @@ def development(system: 'System') -> None: status_dev_page(system.field_friend, system) with ui.row().style('width: calc(100vw - 2rem); flex-wrap: nowrap;'): io_overview(system) + if isinstance(system.field_friend, rosys.hardware.RobotHardware): + with ui.row(): + with ui.card().style('min-width: 200px;'): + esp_pins_core = EspPins(name='core', robot_brain=system.field_friend.robot_brain) + esp_pins_core.developer_ui() + with ui.card().style('min-width: 200px;'): + esp_pins_p0 = EspPins(name='p0', robot_brain=system.field_friend.robot_brain) + esp_pins_p0.developer_ui() diff --git a/field_friend/interface/components/field_creator.py b/field_friend/interface/components/field_creator.py index 1352c9b3..2ce6cc1a 100644 --- a/field_friend/interface/components/field_creator.py +++ b/field_friend/interface/components/field_creator.py @@ -123,5 +123,4 @@ def _apply(self) -> None: def update_front_cam(self) -> None: if self.front_cam is None: return - self.front_cam.streaming = True self.row_sight.set_source(self.front_cam.get_latest_image_url()) diff --git a/field_friend/interface/components/monitoring.py b/field_friend/interface/components/monitoring.py index 48345ed8..1ca6ad70 100644 --- a/field_friend/interface/components/monitoring.py +++ b/field_friend/interface/components/monitoring.py @@ -138,8 +138,6 @@ async def update_monitor_content(self): person_count = 0 animal_count = 0 for camera in self.mjpg_camera_provider.cameras.values(): - if not camera.streaming: - camera.streaming = True image = camera.latest_captured_image if not image: continue diff --git a/field_friend/vision/camera_configurator.py b/field_friend/vision/camera_configurator.py index b16b7fbe..adda7342 100644 --- a/field_friend/vision/camera_configurator.py +++ b/field_friend/vision/camera_configurator.py @@ -49,9 +49,6 @@ async def update_camera_config(self): self.log.info(f'{camera.parameters[name]} != {value}') await camera.set_parameters({name: value}) parameters_changed = True - if not camera.streaming: - camera.streaming = True - parameters_changed = True if not camera.calibration.extrinsics._frame_id: camera.calibration.extrinsics.in_frame(self.odometer.prediction_frame) if 'crop' in self.config: diff --git a/field_friend/vision/zedxmini_camera/zedxmini_camera.py b/field_friend/vision/zedxmini_camera/zedxmini_camera.py index b1f7f23c..8f817e54 100644 --- a/field_friend/vision/zedxmini_camera/zedxmini_camera.py +++ b/field_friend/vision/zedxmini_camera/zedxmini_camera.py @@ -32,6 +32,7 @@ def __init__(self, ip: str | None = None, port: int | None = None, focal_length: self.log = logging.getLogger(self.name) self.log.setLevel(logging.DEBUG) self.camera_information: dict[str, Any] = {} + rosys.on_repeat(self._capture_image, interval=0.1) async def connect(self) -> None: await super().connect() @@ -71,7 +72,7 @@ async def setup_camera_information(self) -> bool: self.focal_length = camera_information['calibration']['left_cam']['fy'] return True - async def capture_image(self) -> None: + async def _capture_image(self) -> None: if not self.connected: return url = f'http://{self.ip}:{self.port}/image' diff --git a/field_friend/vision/zedxmini_camera/zedxmini_camera_provider.py b/field_friend/vision/zedxmini_camera/zedxmini_camera_provider.py index 76bd5c96..78d9671f 100644 --- a/field_friend/vision/zedxmini_camera/zedxmini_camera_provider.py +++ b/field_friend/vision/zedxmini_camera/zedxmini_camera_provider.py @@ -33,7 +33,7 @@ async def update_device_list(self) -> None: camera_information = await ZedxminiCamera.get_camera_information('localhost', 8003) if camera_information is None: return - self.add_camera(ZedxminiCamera(id=str(camera_information['serial_number']), polling_interval=0.1)) + self.add_camera(ZedxminiCamera(id=str(camera_information['serial_number']))) camera = list(self._cameras.values())[0] if camera.is_connected: return diff --git a/requirements.txt b/requirements.txt index a6def0cd..a8620c20 100644 --- a/requirements.txt +++ b/requirements.txt @@ -6,5 +6,5 @@ geopy shapely fiona geopandas -rosys == v0.17.1 +rosys == v0.18.2 uvicorn == 0.28.1 \ No newline at end of file