-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement Zed X Mini Stereo Camera and setup F15 (#168)
This PR introduces the [igus D1 motor controller](https://www.igus.de/product/D1) and the [StereoLabs Zed X Mini stereo camera](https://www.stereolabs.com/en-de/store/products/zed-x-mini-stereo-camera) for our new prototype field friend F15. The code that's controlling the camera hardware is in [this repository](https://github.com/zauberzeug/zedxmini), but will probably replaced by the [ROS2 container](https://www.stereolabs.com/docs/ros2) developed by StereoLabs themselves in the near future, to save the effort on our end. Other PRs regarding the development of F15 are these: - #167 - #174 - #159 --------- Co-authored-by: Johannes-Thiel <jojo.thadfun@gmail.com> Co-authored-by: Lukas Baecker <baecker.lukas@outlook.de>
- Loading branch information
1 parent
d36eb6e
commit d1ed761
Showing
24 changed files
with
479 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,15 @@ | ||
configuration = {'parameters': { | ||
'width': 1280, | ||
'height': 720, | ||
'auto_exposure': True, | ||
'fps': 10, | ||
}, | ||
configuration = { | ||
'type': 'ZedxminiCamera', | ||
'parameters': { | ||
'width': 1280, | ||
'height': 720, | ||
'auto_exposure': True, | ||
'fps': 10, | ||
}, | ||
'crop': { | ||
'left': 60, | ||
'right': 200, | ||
'up': 20, | ||
'down': 0, | ||
} | ||
'left': 60, | ||
'right': 200, | ||
'up': 20, | ||
'down': 0, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
version: "3.9" | ||
services: | ||
zedxmini: | ||
restart: always | ||
privileged: true | ||
runtime: nvidia | ||
build: | ||
context: ../zedxmini | ||
dockerfile: ../zedxmini/Dockerfile | ||
volumes: | ||
- ../zedxmini:/app | ||
- /dev:/dev | ||
- /tmp:/tmp | ||
- /var/nvidia/nvcam/settings/:/var/nvidia/nvcam/settings | ||
- /etc/systemd/system/zed_x_daemon.service:/etc/systemd/system/zed_x_daemon.service | ||
- /usr/local/zed/resources:/usr/local/zed/resources | ||
ports: | ||
- "8003:8003" | ||
environment: | ||
- TZ=Europe/Amsterdam |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,9 @@ | |
}, | ||
{ | ||
"path": "../rosys" | ||
}, | ||
{ | ||
"path": "../zedxmini" | ||
} | ||
], | ||
"settings": {}, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
79 changes: 79 additions & 0 deletions
79
field_friend/automations/navigation/crossglide_demo_navigation.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
from typing import TYPE_CHECKING, Any | ||
|
||
import numpy as np | ||
import rosys | ||
|
||
from ...automations.implements.implement import Implement | ||
from .navigation import Navigation | ||
|
||
if TYPE_CHECKING: | ||
from system import System | ||
|
||
|
||
class WorkflowException(Exception): | ||
pass | ||
|
||
|
||
class CrossglideDemoNavigation(Navigation): | ||
|
||
def __init__(self, system: 'System', tool: Implement) -> None: | ||
super().__init__(system, tool) | ||
self.MAX_STRETCH_DISTANCE: float = 5.0 | ||
self.detector = system.detector | ||
self.name = 'Crossglide Demo' | ||
self.origin: rosys.geometry.Point | ||
self.target: rosys.geometry.Point | ||
|
||
async def prepare(self) -> bool: | ||
await super().prepare() | ||
self.log.info(f'Activating {self.implement.name}...') | ||
await self.implement.activate() | ||
return True | ||
|
||
async def start(self) -> None: | ||
try: | ||
await self.implement.stop_workflow() | ||
if not await self.implement.prepare(): | ||
self.log.error('Tool-Preparation failed') | ||
return | ||
if not await self.prepare(): | ||
self.log.error('Preparation failed') | ||
return | ||
if isinstance(self.driver.wheels, rosys.hardware.WheelsSimulation) and not rosys.is_test: | ||
self.create_simulation() | ||
self.log.info('Navigation started') | ||
while not self._should_finish(): | ||
self.implement.next_punch_y_position = np.random.uniform(-0.11, 0.1) | ||
await self.implement.start_workflow() | ||
except WorkflowException as e: | ||
self.kpi_provider.increment_weeding_kpi('automation_stopped') | ||
self.log.error(f'WorkflowException: {e}') | ||
finally: | ||
self.kpi_provider.increment_weeding_kpi('weeding_completed') | ||
await self.implement.finish() | ||
await self.finish() | ||
await self.driver.wheels.stop() | ||
|
||
async def finish(self) -> None: | ||
await super().finish() | ||
await self.implement.deactivate() | ||
|
||
async def _drive(self, distance: float) -> None: | ||
pass | ||
|
||
def _should_finish(self) -> bool: | ||
return False | ||
|
||
def create_simulation(self): | ||
pass | ||
# TODO: implement create_simulation | ||
|
||
def settings_ui(self) -> None: | ||
super().settings_ui() | ||
|
||
def backup(self) -> dict: | ||
return super().backup() | { | ||
} | ||
|
||
def restore(self, data: dict[str, Any]) -> None: | ||
super().restore(data) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.