ABSTRACT

In this chapter we will develop code for the same attitude determination problem from gyroscope and accelerometer signals as in the previous chapter, but, in this case, the Kalman Filter implementation will perform in real time, and not on previously recorded signals. In contrast to the three-tier structure of our previous MATLAB programs, the real-time code, written in C, does not require the highest-level function (such as att2sim) since there is no need to create vectors of signal samples that will be read during the execution of the program. While the implementation of the Kalman Filter estimation will be executed in real time, the resulting estimates are not displayed or written to the console when they are generated, to avoid the additional use of time that those functions would take. Instead, the posterior estimate of orientation, xA , originally obtained as a quaternion, is converted to Euler Angles and stored in a text file, along with the Euler Angles from the “measurements” (accelerometer readings). Then, both sets of Euler Angles can be visualized after the execution of the real-time Kalman Filter implementation.