From 05d608932be3496917b976a3d9cc5a8d5a3960cb Mon Sep 17 00:00:00 2001 From: "Johannes T." <119115663+Johannes-Thiel@users.noreply.github.com> Date: Fri, 6 Sep 2024 10:00:16 +0200 Subject: [PATCH 1/3] Fix for lizard issue 66 (#174) * fix bug in d1 axis * fix for the lizard issue * remove logs --- field_friend/hardware/axis_D1.py | 2 +- field_friend/hardware/safety.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/field_friend/hardware/axis_D1.py b/field_friend/hardware/axis_D1.py index 9332e768..aa61f62c 100644 --- a/field_friend/hardware/axis_D1.py +++ b/field_friend/hardware/axis_D1.py @@ -88,7 +88,7 @@ async def stop(self): async def move_to(self, position: float, speed: int | None = None) -> None: if self.is_referenced: - await self.robot_brain.send(f'{self.name}_motor.profile_position({self.compute_steps(position)});') + await self.robot_brain.send(f'{self.name}_motor.profile_position({self._compute_steps(position)});') if not self.is_referenced: self.log.error(f'AxisD1 {self.name} is not refernced') return diff --git a/field_friend/hardware/safety.py b/field_friend/hardware/safety.py index 2ddf4e56..eead4380 100644 --- a/field_friend/hardware/safety.py +++ b/field_friend/hardware/safety.py @@ -88,9 +88,9 @@ def __init__(self, robot_brain: rosys.hardware.RobotBrain, *, for name in estop.pins: lizard_code += f'when estop_{name}.level == 0 then stop(); end\n' if isinstance(bumper, rosys.hardware.BumperHardware): - lizard_code += 'when ' + \ - ' or '.join(f'{bumper.name}_{pin}.level == 1' for pin in bumper.pins) + \ - f' then {wheels.name}.off(); end\n' + for name in bumper.pins: + lizard_code += f'bumper_{name}.level = 0\n' + lizard_code += f'when bumper_{name}.level == 1 then stop(); end\n' # implement stop call for "ground check" reference sensors if isinstance(y_axis, ChainAxisHardware): From 556b2894a1571dc1624457fe69742bddb1f08390 Mon Sep 17 00:00:00 2001 From: "Johannes T." <119115663+Johannes-Thiel@users.noreply.github.com> Date: Fri, 6 Sep 2024 13:41:16 +0200 Subject: [PATCH 2/3] make a enable on startup param (#175) --- config/f15_config_f15/robotbrain.py | 3 ++- field_friend/hardware/field_friend_hardware.py | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/config/f15_config_f15/robotbrain.py b/config/f15_config_f15/robotbrain.py index 15e1d283..33b7e534 100644 --- a/config/f15_config_f15/robotbrain.py +++ b/config/f15_config_f15/robotbrain.py @@ -1,3 +1,4 @@ configuration = {'robot_brain': { - 'flash_params': ['orin', 'v05', 'nand'] + 'flash_params': ['orin', 'v05', 'nand'], + 'enable_esp_on_startup':False, }} \ No newline at end of file diff --git a/field_friend/hardware/field_friend_hardware.py b/field_friend/hardware/field_friend_hardware.py index b4fca00b..9849dde7 100644 --- a/field_friend/hardware/field_friend_hardware.py +++ b/field_friend/hardware/field_friend_hardware.py @@ -58,7 +58,10 @@ def __init__(self) -> None: raise NotImplementedError(f'Unknown FieldFriend implement: {implement}') communication = rosys.hardware.SerialCommunication() - robot_brain = rosys.hardware.RobotBrain(communication) + if 'enable_esp_on_startup' in config_robotbrain['robot_brain']: + robot_brain = rosys.hardware.RobotBrain(communication,enable_esp_on_startup=config_robotbrain['robot_brain']['enable_esp_on_startup']) + else: + robot_brain = rosys.hardware.RobotBrain(communication) robot_brain.lizard_firmware.flash_params += config_robotbrain['robot_brain']['flash_params'] bluetooth = rosys.hardware.BluetoothHardware(robot_brain, name=config_hardware['bluetooth']['name'], From e04b839792a7d432f1abb0fa2b497bb5ce9a0d2e Mon Sep 17 00:00:00 2001 From: LukasBaecker <65940705+LukasBaecker@users.noreply.github.com> Date: Fri, 6 Sep 2024 16:32:43 +0200 Subject: [PATCH 3/3] fixing Point3d error (#178) --- field_friend/interface/components/camera_card.py | 4 ++-- field_friend/interface/components/plant_object.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/field_friend/interface/components/camera_card.py b/field_friend/interface/components/camera_card.py index f77d5ad5..d593a962 100644 --- a/field_friend/interface/components/camera_card.py +++ b/field_friend/interface/components/camera_card.py @@ -219,8 +219,8 @@ def build_svg_for_implement(self) -> str: def build_svg_for_plant_provider(self) -> str: if self.camera is None or self.camera.calibration is None: return '' - position = rosys.geometry.Point(x=self.camera.calibration.extrinsics.translation[0], - y=self.camera.calibration.extrinsics.translation[1]) + position = rosys.geometry.Point3d(x=self.camera.calibration.extrinsics.translation[0], + y=self.camera.calibration.extrinsics.translation[1]) svg = '' for plant in self.plant_provider.get_relevant_weeds(position): position_3d = rosys.geometry.Point3d(x=plant.position.x, y=plant.position.y, z=0) diff --git a/field_friend/interface/components/plant_object.py b/field_friend/interface/components/plant_object.py index c5a8b827..3db2265a 100644 --- a/field_friend/interface/components/plant_object.py +++ b/field_friend/interface/components/plant_object.py @@ -18,7 +18,7 @@ def __init__(self, plant_provider: PlantProvider, weed_category_names: list[str] self.plant_provider.PLANTS_CHANGED.register_ui(self.update) def update(self) -> None: - origin = rosys.geometry.Point(x=0, y=0) + origin = rosys.geometry.Point3d(x=0, y=0, z=0) in_world = {p.id: p for p in self.plant_provider.get_relevant_weeds(origin, max_distance=1000) + self.plant_provider.get_relevant_crops(origin, max_distance=1000)}