[From the last episode: We saw how accelerometersA sensor that measures acceleration and deceleration. and gyroscopesA sensor that detects when it changes direction. can work with GPSGlobal Positioning System. A satellite system that sends signals to earth. GPS receivers can get those and figure out where on the earth you are. This is specifically a US-based system, an example of the more generic term “GNSS.” to improve figuring out where you are.]
OK, so we’ve seen how we can have accelerometers and gyros work together, and how they can also work with GPS. In each of these cases, we used a style of sensor fusionThe process of combining information from multiple sensors (real or virtual) in order either to give more confidence in a result or to come up with something completely new. that decides which sensor to use at any given moment. We weren’t really combining their data to get something new.
So let’s move into that direction now, using magnetometersA sensor that detects magnetic fields -- from the earth or from anywhere else..
Who’s More Inaccurate?
You may recall that we have two ways to get orientationThe direction someone or something is facing. This may be different from the direction of motion.. Gyroscopes are one way; magnetometers are another. But both of these have some limitations.
- We saw that gyroscopes – at least of the precision and price that we might personally have access to – tend to drift over time. To be sure, all sensorsA device that can measure something about its environment. Examples are movement, light, color, moisture, pressure, and many more. have a limit to their precision, but gyros seem to be more of an issue.
- We saw that magnetometers can be swayed by magnetic anomalies. They’re also slower than gyroscopes.
Well, since they both do more or less the same thing using different means, then why not combine them? Here there’s no classic equations that can tell you how to combine them, however. The idea is to cross-check the gyroscope using the magnetometer. But you also need to figure out if there’s an anomaly nearby so that you can correct the magnetometer – and the gyro may help you do that. So the gyro is also cross-checking the magnetometer.
This is the kind of area where companies can compete on quality. Who can get the best algorithmA way of calculating something, typically as a step-by-step recipe. A familiar one to all of us is how we do long division on paper: that's an algorithm. Algorithms abound in the IoT. for determining that a magnetic anomaly may be nearby? Do you combine the gyro and mag data, or do you only decide which to use directly? No algorithm is perfect; how good is this guy’s or that guy’s? Whoever can get you from point A to point B without GPS is going to be able to advertise that as a feature. (Ok, they won’t be advertising that to you, since you’re not buying the sensors directly, but they’ll be selling hard to folks making phones and other electronic systemsThis is a very generic term for any collection of components that, all together, can do something. Systems can be built from subsystems. Examples are your cell phone; your computer; the radio in your car; anything that seems like a "whole.".) They’re also going to want to keep the details of their algorithm secret – or patent the algorithm if possible.
Check the Map
There’s one other possible “sensor” that can help us correct errors: a map. Digital maps are widely available these days, and they can help provide a reality check. It’s called map matching.
Let’s say, for instance, that your nav system can’t find GPS (for whatever reason) and errors have accumulated enough to put your location off by, oh, let’s say 30 feet (or 10 meters… ish). If that error is side-to-side, then that probably places you off the road in the ditch on one side or in the median strip – or even the opposing lanes – on the other side.
If your navigation system consults a map as part of its algorithm, then it can notice that this isn’t right – the road constrains you. Now, it’s possible that you did, in fact, you did have an unplanned excursion off the pavement. So if a system blindly consults the map, it will decide, “No, not possible. Must still be on the road, so I’ll correct the location.” Which would be wrong. So the system has to be smarter. For instance, if you did run off the road, you’re not likely to be moving anymore. So the algorithm could take that into account. The accelerometer, for instance, would indicate rapid deceleration, and the system could use that information to decide that you’re indeed off the road.
This is another example of using a virtual sensorA source of data that, strictly speaking, isn’t a sensor, but that can be used as if it were a sensor. – the map. But it’s also an example of how it can be tricky to draw conclusions from the sensor data – you may have to cross-check several things before making a final call.
A Mag Isn’t a Compass?
Let’s look at another example. We mentioned before that, even though compasses use the earth’s magnetic field, a magnetometer on its own isn’t a compassIn its electronic version, a magnetometer that has its reading compensated by a tilt meter (done by an accelerometer).. That’s because a magnetometer will give an accurate reading of the earth’s magnetic field only if perfectly level. Which our phones pretty much never are. (And if they were, we wouldn’t know it.)
But here’s the thing: your accelerometer knows where down is. How? It feels the acceleration of gravity. So you may not know when your phone is perfectly level, but your accelerometer does. But it would be annoying simply to have the accelerometer telling you how close to level you are – it would be like trying to line up the bubble on a carpenter’s level while your hands are shaky.
No, it turns out that there’s a mathematical relationship between how much your phone is tilting and the true magnetic measurement. So you can point your magnetometer at any angle and the accelerometer can act as a “tilt meter” to figure out how much you’re tilted. That tilt can then be combined with the mag measurement to give the true orientation – not just generally, but with better precision.
So here we’re combining the data of the accelerometer and the magnetometer in some mathematical way to give a new result: what the equivalent magnetometer reading would be if we were holding it perfectly level.
We’re not just picking between the two sensors like we did last week – we’re combining the data from the two. But, unlike the earlier navigation example, where there’s some secret formula combining gyro and mag data, this is a physical algorithm that, pretty much, anyone could do. So different sensor fusion designers would compete here not on the basis of who has a better algorithm, but on other things, like maybe how fast they run or, even more importantly, how quickly they drain the battery while doing their work.
Next week we’ll have our final look at sensor fusion and see how we can take navigation out of 2D only and make it better for 3D as well. For that we’ll need a new real sensor and another virtualIn our context, refers to what are usually software models of some physical thing. The model behaves like the real thing except, in some cases, in performance. sensor.
Leave a Reply