Skip to content

Commit

Permalink
fix removal of classes in system
Browse files Browse the repository at this point in the history
  • Loading branch information
pascalzauberzeug committed Sep 23, 2024
1 parent 1b3f191 commit ce5fec6
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion field_friend/automations/implements/weeding_implement.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def __init__(self, name: str, system: 'System', persistence_key: str = 'weeding
rosys.persistence.PersistentModule.__init__(self,
persistence_key=f'field_friend.automations.implements.{persistence_key}')

self.relevant_weeds = system.small_weed_category_names + system.big_weed_category_names
self.relevant_weeds = system.plant_locator.weed_category_names
self.log = logging.getLogger('field_friend.weeding')
self.system = system
self.kpi_provider = system.kpi_provider
Expand Down
2 changes: 1 addition & 1 deletion field_friend/automations/implements/weeding_screw.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class WeedingScrew(WeedingImplement):

def __init__(self, system: 'System') -> None:
super().__init__('Weed Screw', system, 'weeding_screw')
self.relevant_weeds = system.small_weed_category_names + system.big_weed_category_names
self.relevant_weeds = system.plant_locator.weed_category_names
self.log.info(f'Using relevant weeds: {self.relevant_weeds}')
self.weed_screw_depth: float = 0.13
self.max_crop_distance: float = 0.08
Expand Down
12 changes: 7 additions & 5 deletions field_friend/interface/components/plant_object.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
import logging
from typing import TYPE_CHECKING

import rosys
from nicegui.elements.scene_objects import Group, Sphere

from ...automations import PlantProvider
if TYPE_CHECKING:
from system import System


class plant_objects(Group):

def __init__(self, plant_provider: PlantProvider, weed_category_names: list[str]) -> None:
def __init__(self, system: 'System') -> None:
super().__init__()

self.plant_provider = plant_provider
self.weed_category_names = weed_category_names
self.plant_provider = system.plant_provider
self.plant_locator = system.plant_locator
self.log = logging.getLogger('field_friend.plant_objects')
self.update()
self.plant_provider.PLANTS_CHANGED.register_ui(self.update)
Expand All @@ -29,7 +31,7 @@ def update(self) -> None:
obj.delete()
for id, plant in in_world.items():
if id not in rendered:
if plant.type in self.weed_category_names:
if plant.type in self.plant_locator.weed_category_names:
Sphere(0.02).with_name(f'plant_{plant.type}:{id}') \
.material('#ef1208') \
.move(plant.position.x, plant.position.y, 0.02)
Expand Down
3 changes: 1 addition & 2 deletions field_friend/interface/components/robot_scene.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ def toggle_lock():
with ui.scene(200, 200, on_click=self.handle_click, grid=False).classes('w-full') as self.scene:
field_friend_object(self.system.odometer, self.system.camera_provider, self.system.field_friend)
rosys.driving.driver_object(self.system.driver)
plant_objects(self.system.plant_provider,
self.system.big_weed_category_names + self.system.small_weed_category_names)
plant_objects(self.system)
visualizer_object(self.system)
field_object(self.system.field_provider, self.system.field_navigation.field)
self.scene.move_camera(-0.5, -1, 2)
Expand Down

0 comments on commit ce5fec6

Please sign in to comment.