Skip to content

Commit

Permalink
Field Navigation (#180)
Browse files Browse the repository at this point in the history
This PR aims to reenable the row driving of the robot. This is relatet
to the new field creation and uses the fields created by the ab line
field creation.

ToDo:

- [x] wait for #188
- [x] wait for zauberzeug/rosys#204
- [x] fix the row change for small row distances (probably without the
spline tool)
- [x] tidy up row change
- [x] Fix row change for real robot with bad odometry
- [x] Row 3 of Wiese_Testfeld is driven over two times
- [x] Fix start_field_watch
- [x] write tests
- [x] Fix field outlines
- [x] Remove hardcoded fields
- [x] Remove old rows_on_field_navigation and AB-Line Navigation
- [x] Remove dev info on main page
- [x] Move ESP gpio code to zauberzeug/rosys#196

Known Issues:
- Always starts at the first row
- Can not continue a row after restart

---------

Co-authored-by: Lukas Baecker <baecker.lukas@outlook.de>
Co-authored-by: Pascal Schade <pascal@zauberzeug.com>
  • Loading branch information
3 people authored Oct 14, 2024
1 parent ef427b8 commit b081ccb
Show file tree
Hide file tree
Showing 18 changed files with 462 additions and 786 deletions.
2 changes: 0 additions & 2 deletions field_friend/automations/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
from .field_provider import FieldProvider
from .implements.implement import Implement
from .kpi_provider import KpiProvider
from .navigation.coverage_navigation import CoverageNavigation
from .path_provider import Path, PathProvider
from .path_recorder import PathRecorder
from .plant import Plant
Expand All @@ -22,7 +21,6 @@
'FieldObstacle',
'FieldProvider',
'Implement',
'CoverageNavigation',
'Path',
'PathProvider',
'PathRecorder',
Expand Down
6 changes: 4 additions & 2 deletions field_friend/automations/automation_watcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
from shapely.geometry import Point as ShapelyPoint
from shapely.geometry import Polygon as ShapelyPolygon

from field_friend.localization import GeoPoint

if TYPE_CHECKING:
from system import System

Expand Down Expand Up @@ -105,8 +107,8 @@ def try_resume(self) -> None:
self.log.info('resetting resume_delay')
self.resume_delay = DEFAULT_RESUME_DELAY

def start_field_watch(self, field_boundaries: list[rosys.geometry.Point]) -> None:
self.field_polygon = ShapelyPolygon([(point.x, point.y) for point in field_boundaries])
def start_field_watch(self, field_boundaries: list[GeoPoint]) -> None:
self.field_polygon = ShapelyPolygon([point.cartesian().tuple for point in field_boundaries])
self.field_watch_active = True

def stop_field_watch(self) -> None:
Expand Down
2 changes: 1 addition & 1 deletion field_friend/automations/field.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class Field(GeoPointCollection):

@property
def outline(self) -> list[rosys.geometry.Point]:
return self.cartesian()
return self.points

@property
def outline_as_tuples(self) -> list[tuple[float, float]]:
Expand Down
4 changes: 1 addition & 3 deletions field_friend/automations/field_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
from geographiclib.geodesic import Geodesic
from rosys.geometry import Point

from .. import localization
from ..localization import GeoPoint, Gnss
from . import Field, FieldObstacle, Row

Expand All @@ -18,12 +17,11 @@ def __init__(self, gnss: Gnss) -> None:
self.log = logging.getLogger('field_friend.field_provider')
self.gnss = gnss
self.fields: list[Field] = []
self.needs_backup: bool = False

self.FIELDS_CHANGED = rosys.event.Event()
"""The dict of fields has changed."""

self.needs_backup: bool = False

def get_field(self, id_: str | None) -> Field | None:
for field in self.fields:
if field.id == id_:
Expand Down
11 changes: 3 additions & 8 deletions field_friend/automations/navigation/__init__.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@

from .a_b_line_navigation import ABLineNavigation
from .coverage_navigation import CoverageNavigation
from .crossglide_demo_navigation import CrossglideDemoNavigation
from .field_navigation import FieldNavigation
from .follow_crops_navigation import FollowCropsNavigation
from .navigation import Navigation, WorkflowException
from .row_on_field_navigation import RowsOnFieldNavigation
from .straight_line_navigation import StraightLineNavigation
from .crossglide_demo_navigation import CrossglideDemoNavigation

__all__ = [
'Navigation',
'WorkflowException',
'RowsOnFieldNavigation',
'StraightLineNavigation',
'FollowCropsNavigation',
'CoverageNavigation',
'ABLineNavigation',
'FieldNavigation',
'CrossglideDemoNavigation',
]
142 changes: 0 additions & 142 deletions field_friend/automations/navigation/a_b_line_navigation.py

This file was deleted.

Loading

0 comments on commit b081ccb

Please sign in to comment.