Ben’s Updates – Week 3

This is a cross-post from this site.

Yup, shark wrangling is mostly just data analysis and, for now, signal filtering. I’m not the best physicist, but right now, William’s working on the PVC enclosure we need to deal with the briny depths, so I’m on math duty. The upshot of this is that I’m working on two separate things right now, one (seemingly) simple and one (seemingly) complex.

My first goal is to use the accelerometer readouts to estimate the pitch and roll of our tag. When the tag’s not moving, this is extremely simple; we use a bit of trig to to find the angle between the current gravity vector and our theoretical reference frame of [0, 0, -1] g’s (tag face-down). The problem is that A) this is really susceptible to system noise (like sea currents or, you know, a moving shark) and B) there are a lot of edge cases to consider that my feeble CS mind cannot easily comprehend, like Gimbal lock.

Alongside the accelerometer, we’ve got a gyroscope, and unlike our janky accelerometry trig, we can just integrate the gyroscope’s angular velocity readings to get angle. The only reason we need an accelerometer is to correct for gyroscope drift – since we’re integrating, noise is cumulative, and gyroscope readings can be unreliable in as little as 10 seconds. To correct this, we’re going to use a Kalman filter, which combines both readings in a manner that removes drift and other noise as well. It’s pretty cool, and while it seems horrifying at first, there are a lot of sites out there that offer a gentle (or simplified) introduction. If you still don’t want to use it, you can use a complementary filter – it’s one line of code and takes up no extra RAM if you’re working with an embedded system.

To help with both of these problems and because I was bored of friggin’ MATLAB scripts I wrote a Python script that produced simulated tag output! It’s actually fairly useful to see how and where my work is going horribly wrong. If anyone wants to have a tag simulator, I could spruce it up a little and send it your way.

Be seeing you.