zauberzeug / field_friend

A Development Platform for Autonomous Weeding.
https://feldfreund.de
MIT License
11 stars 3 forks source link

Driving Timeout #126

Closed pascalzauberzeug closed 1 month ago

pascalzauberzeug commented 1 month ago

When running a weeding automation the robot sometimes stops and the navigation raises a 'Driving Timeout' error. I got a log for this but sadly it misses the current position and yaw, but U5 had this problem yesterday and we can try to reproduce it this afternoon.

rosys_1       | 2024-07-17 16:10:25.731 [INFO] field_friend/automations/navigation/straight_line_navigation.py:44: Driving 0.02 m to Point(-0.812, -4.259) with yaw -1.78.
rosys_1       | 2024-07-17 16:10:25.936 [INFO] field_friend/automations/implements/tornado.py:68: Target crop is not reachable
rosys_1       | 2024-07-17 16:10:25.937 [INFO] field_friend/automations/navigation/straight_line_navigation.py:44: Driving 0.02 m to Point(-0.818, -4.282) with yaw -1.78.
rosys_1       | 2024-07-17 16:10:26.092 [INFO] field_friend/automations/implements/tornado.py:68: Target crop is not reachable
rosys_1       | 2024-07-17 16:10:26.093 [INFO] field_friend/automations/navigation/straight_line_navigation.py:44: Driving 0.02 m to Point(-0.823, -4.303) with yaw -1.79.
rosys_1       | 2024-07-17 16:10:26.248 [INFO] field_friend/automations/implements/tornado.py:68: Target crop is not reachable
rosys_1       | 2024-07-17 16:10:26.251 [INFO] field_friend/automations/navigation/straight_line_navigation.py:44: Driving 0.02 m to Point(-0.828, -4.323) with yaw -1.79.
rosys_1       | 2024-07-17 16:10:26.425 [INFO] field_friend/automations/implements/tornado.py:68: Target crop is not reachable
rosys_1       | 2024-07-17 16:10:26.426 [INFO] field_friend/automations/navigation/straight_line_navigation.py:44: Driving 0.02 m to Point(-0.833, -4.343) with yaw -1.79.
rosys_1       | 2024-07-17 16:10:26.574 [INFO] field_friend/automations/implements/tornado.py:68: Target crop is not reachable
rosys_1       | 2024-07-17 16:10:26.575 [INFO] field_friend/automations/navigation/straight_line_navigation.py:44: Driving 0.02 m to Point(-0.838, -4.363) with yaw -1.79.
rosys_1       | 2024-07-17 16:10:26.773 [INFO] field_friend/automations/navigation/straight_line_navigation.py:44: Driving 0.02 m to Point(-0.843, -4.385) with yaw -1.79.
rosys_1       | 2024-07-17 16:10:26.920 [INFO] field_friend/automations/navigation/straight_line_navigation.py:44: Driving 0.02 m to Point(-0.848, -4.405) with yaw -1.79.
rosys_1       | 2024-07-17 16:10:27.107 [INFO] field_friend/automations/navigation/straight_line_navigation.py:44: Driving 0.02 m to Point(-0.853, -4.425) with yaw -1.79.
rosys_1       | 2024-07-17 16:10:27.267 [INFO] field_friend/automations/navigation/straight_line_navigation.py:44: Driving 0.02 m to Point(-0.858, -4.447) with yaw -1.79.
rosys_1       | 2024-07-17 16:10:27.421 [INFO] field_friend/automations/navigation/straight_line_navigation.py:44: Driving 0.02 m to Point(-0.864, -4.468) with yaw -1.79.
rosys_1       | 2024-07-17 16:10:27.566 [INFO] field_friend/automations/navigation/straight_line_navigation.py:44: Driving 0.02 m to Point(-0.869, -4.487) with yaw -1.80.
rosys_1       | 2024-07-17 16:10:27.743 [INFO] field_friend/automations/navigation/straight_line_navigation.py:44: Driving 0.02 m to Point(-0.874, -4.508) with yaw -1.79.
rosys_1       | 2024-07-17 16:10:27.921 [INFO] field_friend/automations/navigation/straight_line_navigation.py:44: Driving 0.02 m to Point(-0.879, -4.529) with yaw -1.80.
rosys_1       | 2024-07-17 16:10:28.055 [INFO] field_friend/automations/navigation/straight_line_navigation.py:44: Driving 0.02 m to Point(-0.883, -4.549) with yaw -1.80.
rosys_1       | 2024-07-17 16:10:28.240 [INFO] field_friend/automations/navigation/straight_line_navigation.py:44: Driving 0.02 m to Point(-0.889, -4.569) with yaw -1.80.
rosys_1       | 2024-07-17 16:10:28.387 [INFO] field_friend/automations/navigation/straight_line_navigation.py:44: Driving 0.02 m to Point(-0.893, -4.589) with yaw -1.80.
rosys_1       | 2024-07-17 16:10:28.547 [INFO] field_friend/automations/navigation/straight_line_navigation.py:44: Driving 0.02 m to Point(-0.898, -4.610) with yaw -1.80.
rosys_1       | 2024-07-17 16:10:28.759 [INFO] field_friend/automations/navigation/straight_line_navigation.py:44: Driving 0.02 m to Point(-0.904, -4.631) with yaw -1.80.
rosys_1       | 2024-07-17 16:10:28.883 [INFO] field_friend/automations/navigation/straight_line_navigation.py:44: Driving 0.02 m to Point(-0.909, -4.653) with yaw -1.80.
rosys_1       | 2024-07-17 16:10:29.092 [INFO] field_friend/automations/navigation/straight_line_navigation.py:44: Driving 0.02 m to Point(-0.914, -4.674) with yaw -1.80.
rosys_1       | 2024-07-17 16:10:29.249 [INFO] field_friend/automations/navigation/straight_line_navigation.py:44: Driving 0.02 m to Point(-0.919, -4.694) with yaw -1.80.
rosys_1       | 2024-07-17 16:10:29.421 [INFO] field_friend/automations/navigation/straight_line_navigation.py:44: Driving 0.02 m to Point(-0.924, -4.715) with yaw -1.80.
rosys_1       | 2024-07-17 16:10:29.618 [INFO] field_friend/automations/navigation/straight_line_navigation.py:44: Driving 0.02 m to Point(-0.929, -4.735) with yaw -1.80.
rosys_1       | 2024-07-17 16:10:31.620 [INFO] field_friend/automations/plant_locator.py:130: pausing plant detection
rosys_1       | 2024-07-17 16:10:31.620 [ERROR] rosys/automation/automation.py:68: automation failed
rosys_1       | Traceback (most recent call last):
rosys_1       |   File "/app/rosys/automation/automation.py", line 56, in __await__
rosys_1       |     signal = send(message)
rosys_1       |              ^^^^^^^^^^^^^
rosys_1       |   File "/app/field_friend/automations/navigation/navigation.py", line 52, in start
rosys_1       |     await self._drive(self.DEFAULT_DRIVE_DISTANCE)
rosys_1       |   File "/app/field_friend/automations/navigation/straight_line_navigation.py", line 45, in _drive
rosys_1       |     await self._drive_to_yaw(distance, start_position.direction(local_target))
rosys_1       |   File "/app/field_friend/automations/navigation/navigation.py", line 92, in _drive_to_yaw
rosys_1       |     raise TimeoutError('Driving Timeout')
rosys_1       | TimeoutError: Driving Timeout
rosys_1       | 2024-07-17 16:10:31.624 [INFO] rosys/rosys.py:69: automation stopped because an exception occurred in an automation
rosys_1       | 2024-07-17 16:10:31.624 [INFO] rosys/rosys.py:69: automation failed
rosys_1       | 2024-07-17 16:10:31.652 [ERROR] nicegui/app/app.py:118: Driving Timeout
rosys_1       | Traceback (most recent call last):
rosys_1       |   File "/home/zauberzeug/.local/lib/python3.11/site-packages/nicegui/background_tasks.py", line 52, in _handle_task_result
rosys_1       |     task.result()
rosys_1       |   File "/app/rosys/automation/automation.py", line 56, in __await__
rosys_1       |     signal = send(message)
rosys_1       |              ^^^^^^^^^^^^^
rosys_1       |   File "/app/field_friend/automations/navigation/navigation.py", line 52, in start
rosys_1       |     await self._drive(self.DEFAULT_DRIVE_DISTANCE)
rosys_1       |   File "/app/field_friend/automations/navigation/straight_line_navigation.py", line 45, in _drive
rosys_1       |     await self._drive_to_yaw(distance, start_position.direction(local_target))
rosys_1       |   File "/app/field_friend/automations/navigation/navigation.py", line 92, in _drive_to_yaw
rosys_1       |     raise TimeoutError('Driving Timeout')
rosys_1       | TimeoutError: Driving Timeout
rodja commented 1 month ago

At what distances does the error occure? Only small ones (< 1-2 cm)? Because that is the accuracy of our RTK...

LukasBaecker commented 1 month ago

At what distances does the error occure? Only small ones (< 1-2 cm)? Because that is the accuracy of our RTK...

It occurred immediately after starting the automation, when the roboter tried to drive the first time, then the automation stopped.

LukasBaecker commented 1 month ago

We tried to change the deadline from additional 2 to 5 (line 84 in navigation.py)

deadline = rosys.time() + 5

This seemed to work, but we then set the value back to 2 and the robot again seemed to drive as it should. The error still occured but I logged the error instead of raising it to keep the automation running. So, no big insights as it seems.

pascalzauberzeug commented 1 month ago

@rodja I saved some logs for this and the distances are indeed in the millimeter range.

rosys_1       | 2024-07-19 15:34:57.254 [ERROR] field_friend/automations/navigation/navigation.py:93: Driving Timeout at startpoint: Point(110.250, 88.245) with yaw: 6.283185307179586 and target point: Point(110.256, 88.259)
rosys_1       | 2024-07-19 15:34:59.263 [ERROR] field_friend/automations/navigation/navigation.py:93: Driving Timeout at startpoint: Point(110.256, 88.259) with yaw: 6.283185307179586 and target point: Point(110.260, 88.275)
rosys_1       | 2024-07-19 15:35:01.274 [ERROR] field_friend/automations/navigation/navigation.py:93: Driving Timeout at startpoint: Point(110.260, 88.275) with yaw: 6.283185307179586 and target point: Point(110.263, 88.291)
rosys_1       | 2024-07-19 15:35:03.278 [ERROR] field_friend/automations/navigation/navigation.py:93: Driving Timeout at startpoint: Point(110.263, 88.291) with yaw: 6.283185307179586 and target point: Point(110.264, 88.306)

for example Point(110.250, 88.245) to Point(110.256, 88.259)

rodja commented 1 month ago

I hope that https://github.com/zauberzeug/field_friend/pull/130 will fix this issue. It only performs GNSS updates between when standing still. That means that we drive 100 % by odometry data.

LukasBaecker commented 1 month ago

We figured out that the Driving Timeout occurs when the odometry heading is above 180 deg or under -180 deg.

rodja commented 1 month ago

This should be fixed with #130. I guess it is already tested on real robots today. Can we close this @LukasBaecker?

LukasBaecker commented 1 month ago

@rodja I would like to add a test for this case to make sure that the robot acts as expected when the heading is >180 or <-180.