A Kalman filter is a mathematically rigorous way to accomplish this functionality.
DISCLAIMER: I have never successfully implemented one of these myself. What follows is a vague digest of a wikipedia page, uninformed by first-hand knowledge.
Think of it as a probability question.
Rather than relying on a set of sensors to say exactly where you are at all times, split the problem up. Maintain a separate “estimate” of your current position. Use sensor readings and robot events to periodically update that estimate with observations provided by the sensors. For example:
At the start of the match, you know with near absolute certainty where you are. The autonomousInit() call event can reset your position estimate to that known location.
After that, every loop, you can use your gyros and encoder measurements to change that estimation of where you are. However, as you identified, these sensors have noise. So a reading of “1 ft forward” probably means you’re about a foot forward, but maybe slightly more or less, or slightly off to the side. This means you still have an estimate of where you’re at, but with less certainty.
However, when you pick up a gamepiece or identify a vision target, the location information imparted by that event again gives you that high certainty. The event should have such high certainty that it is trusted more than your history of sensor readings.
The Kalman filter mashes these ideas of “observations” and “trustworthiness” into standard probability theory notions and lays out the math to manipulate it. I see the challenge to using it as two parts:
- Understanding the math of the filter to know how to properly use it
- Converting disparate reference frames (ie, encoder ticks, gyro rotation units, vision target pixel x/y/size), into a single reference frame (ie - drivetrain x/y/pose angle).
In general, accurate absolute position is super useful. It allows you to have the robot get itself to an arbitrary point on the field despite disturbances (ie robots running into you), and know when you get there. This could allow a robot to automatically go to certain parts of the field, and automatically perform actions when there.
To paint a particular blue dot:
I imagine a driveteam with only a large tablet to control the robot. When they want to pick up a gamepiece from a location and deliver it, they tap the loading station, and then the placement point, and just watch the robot do it perfectly, as fast as mechanically possible. The driveteam’s job is not to drive the robot, but rather command it based on the ongoing match dynamics. Think playing real-time chess, but every move causes robots to go flying across the field.
If you ask 900, they’ll say they want a fully autonomous robot. I imagine with this mindset they may even achieve a layer on top of my blue dot, where the robot itself reads the field state and decides which objectives which lead to the highest score possible. Totally putting words in their mouth though, I have no idea if this is in their 5, 10, or 15 year plan.
All of this is dependent upon first knowing with high accuracy where you are on the field. Once you know that, a lot of possibilities start to open up.