This week was spent on trying to rotate our data to be properly oriented with respect to the shark. This means that if the sensor is attached such that there is an angle and gravity is being read on all three channels of the accelerometer, we rotate the data so all of the acceleration due to gravity is in the z axis. To do this takes a couple of steps. The first is to find the acceleration from gravity(or more accurately the normal force) in each of the three axis. To do this we simply do the opposite of what we did last week to remove gravity, we pass the data through a low pass filter so only the acceleration due to gravity remains. Alternatively we can pass the data through the high pass filter and then look at the difference between the filtered data and the unfiltered data. Once the acceleration of gravity in each direction is found a gravity vector can be found by using geometry. We then want to rotate the rest of our data such that this gravity vector becomes the z axis. We did this by deriving a matrix or transformation. Rotating the data in this way can be thought of as two distinct transformations. I decided to do my transformation once in the xy plane and then the xz plane. i wanted to do this as two separate transformations in 2 dimensional planes because it’s easier to determine matrices of transformation in two dimensions. Once the matrices for each transformation were derived I then multiplied them together to get a transformation matrix for three dimensions. Then finally to check my work I made sure that all three of the new axis were perpendicular to each other by taking the dot product of them and confirming that it was equal to zero.
These matrices took a long time for me to come up with. Most of the time was spent drawing the same couple figures on a sheet of paper and trying really hard to visualise the moving the axis of a three dimensional cartesian coordinate plane. I found this to be surprising conceptually difficult but I eventually figured it out maybe. In fact as of the time of writing I don’t really know if my matrix of transformation is correct. It certainly changes the coordinated but I’m not sure that I found the angles I need correctly and that the coordinate system is in face oriented in the way I want. I am thinking about good ways to test this and am going to continue working on this change of coordinates in the coming week.
Finally I am also looking into something that will make the change of coordinates a lot easier, and that is adding a gyroscope to the system. This will add a lot power consumption but will take the guesswork out of finding the orientation of the device. The current strategy of find gravity and angles by using filters is very inaccurate and error prone, this is especially true if there is any rotation in the system. The gyroscope will allow us to look at the movement of the animal with 6 degrees of freedom and lead to much more accurate data.