Interface and Application Programming
This week's assignment was to write an application that interfaces with an input and/or output device. I am revisiting this after finishing my final project. I now demonstrate visualizing data from my FabBot (final project). This application will come in handy when calibrating the Kalman filter I use to help determine the robot's orientation. The Kalman filter is applied to eliminate noise from the accelerometer as well as drift from the gyro.
I wrote a script in MATLAB that takes data streaming over serial port and plots the angle of the robot. Calculations for the robot's orientation using raw data as well as filtered data are plotted. You can noticeably see a difference between the two, with the Kalman filter offering better results.
You can take a look at the code at my GitHub Repository. MATLAB has useful functions for talking to serial devices - as long as you communicate at the same baud rate and read streaming data correctly, MATLAB works beautifully for applications such as this. The only caveat is that if you have a bug, MATLAB has a difficult time closing the serial port, and you will need to restart your computer to reset the serial port.