Skip to content

Commit

Permalink
Update to Rosys version 0.18.2 (#202)
Browse files Browse the repository at this point in the history
  • Loading branch information
pascalzauberzeug authored Oct 21, 2024
1 parent fe2f8d2 commit a5ac67c
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 9 deletions.
9 changes: 9 additions & 0 deletions field_friend/interface/components/development.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()
1 change: 0 additions & 1 deletion field_friend/interface/components/field_creator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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())
2 changes: 0 additions & 2 deletions field_friend/interface/components/monitoring.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 0 additions & 3 deletions field_friend/vision/camera_configurator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
3 changes: 2 additions & 1 deletion field_friend/vision/zedxmini_camera/zedxmini_camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ geopy
shapely
fiona
geopandas
rosys == v0.17.1
rosys == v0.18.2
uvicorn == 0.28.1

0 comments on commit a5ac67c

Please sign in to comment.