Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Produce more accurate odometer fixes by averaging multiple GNSS poses while standing #130

Merged
merged 23 commits into from
Jul 30, 2024

Conversation

rodja
Copy link
Member

@rodja rodja commented Jul 21, 2024

As an alternative to a Kalman Filter, this PR leverages the fact that we are standing still while the implement is working:
We can collect multiple GNSS measurements and average them for a odometer pose update just before we start driving again. The new code also ensures that the navigation pauses it's advancements shortly to gather a some gps measurements every 10 seconds for scenarios where the implement does not request stopping on their own. And the AutomationWatcher was updated to generate GNSS pose updates if no automation is running and robot is standing.

ToDos

@rodja rodja added the enhancement New feature or request label Jul 21, 2024
@rodja rodja added this to the 0.2.0 milestone Jul 21, 2024
@rodja rodja requested a review from pascalzauberzeug July 21, 2024 06:36
This was referenced Jul 21, 2024
Copy link
Contributor

@pascalzauberzeug pascalzauberzeug left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good, looking forward to testing it

@rodja
Copy link
Member Author

rodja commented Jul 24, 2024

Today, when testing with a real robot I discovered that we run into an endless loop if we do not have a RTK fix. This can happen indoors, when no internet connection is available, when SAPOS is not correctly configured or a thousand other causes. How should we handle this?

@pascalzauberzeug
Copy link
Contributor

@rodja do you mean the while-loop in update_robot_pose?

@rodja
Copy link
Member Author

rodja commented Jul 24, 2024

Yes

@pascalzauberzeug
Copy link
Contributor

The await self.gnss.update_robot_pose() call should have a timeout and either we just continue to drive without an updated pose and warn the user about it or stop the automation.
I think the first option is better for our current use cases

@rodja
Copy link
Member Author

rodja commented Jul 24, 2024

I agree. But before this PR, the default behaviour was simply to keep driving with odometry. Let's discuss this tomorrow in our all-hands meeting.

@rodja
Copy link
Member Author

rodja commented Jul 26, 2024

As discussed we keep the old behaviour for now which does not require GNSS to be active. This allows us to drive by visual cues only.
By setting system.gnss.ensure_gnss = True this behaviour can later be changed by navigation strategies. The slippage-tests need it already. @pascalzauberzeug I think the code is ready for another real world test.

@pascalzauberzeug
Copy link
Contributor

The worked today on U4/RB28, but one time there was the following error where the automation was stopped and couldn't be started again without restarting the software.

rosys_1       | 2024-07-29 18:39:00.551 [INFO] rosys/rosys.py:69: automation stopped because an exception occurred in an automation
rosys_1       | 2024-07-29 18:39:00.552 [INFO] rosys/rosys.py:69: automation failed
rosys_1       | 2024-07-29 18:39:00.575 [ERROR] nicegui/app/app.py:119:
rosys_1       | Traceback (most recent call last):
rosys_1       |   File "/app/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 50, in start
rosys_1       |     await self.gnss.update_robot_pose()
rosys_1       |   File "/app/field_friend/localization/gnss.py", line 119, in update_robot_pose
rosys_1       |     assert not self.is_paused
rosys_1       | AssertionError

@rodja rodja linked an issue Jul 30, 2024 that may be closed by this pull request
@rodja
Copy link
Member Author

rodja commented Jul 30, 2024

The tests with U4 worked very well after we fixed the work_x parameter. There also was an issue when pressing the stop button because of missing super() calls. This is now fixed. @pascalzauberzeug could you review the last changes? I think it's ready to merge!

@pascalzauberzeug
Copy link
Contributor

@rodja the field navigation tests fail after 24d0da5.
this assert failsassert system.field_navigation.automation_watcher.field_watch_active in test_approaching_first_row and assert not system.automator.is_running in test_approaching_first_row_when_outside_of_field.

I narrowed it down to the await self.implement.activate() in FollowCropsNavigation.prepare()

@pascalzauberzeug
Copy link
Contributor

pascalzauberzeug commented Jul 30, 2024

@rodja

await rosys.sleep(3) # NOTE: we wait for the camera to adjust

The test doesn't wait for this sleep. We could forward for x seconds or move await super().activate() to the end of the function and then forward until the implement is active
await forward(until=lambda: system.current_implement.is_active)

@pascalzauberzeug
Copy link
Contributor

Works again, will merge now!

@pascalzauberzeug pascalzauberzeug merged commit 87c3805 into main Jul 30, 2024
1 check passed
@pascalzauberzeug pascalzauberzeug deleted the averaged-gnss branch July 30, 2024 12:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tornado x-offset Driving Timeout
2 participants