Zippy is the foamboard boat thrown together to gain experience on Ardupilot, whose current version is based around the EKF3( Enhanced Kalman Filter V3) , a large and complicated mathematical object, that performs sensor fusion on the various sensors connected to it, and outputs data describing the attitude, speed and world position of the boat.
I had previously used Ardupilot when the DCM (Direction Cosine Matrix) was the preferred algorithm used to perform the same function, but the EKF3 is designed to output a more precise result given the same data. However it is a much more complex beast than the DCM as I discovered.
Over the last few weeks I had been getting issues with randomly not being able to switch from "Manual" mode into "Auto" mode in order to start a "mission". Sometimes, on attempting to switch auto mode, I would get the error message "Mode change failed" and would be kept in manual mode. After some random period of time however, I would get the message "EKF anomaly cleared" at which point I would be able to switch into auto mode and run the mission.
Only recently have I had time to investigate this issue. It took a while, however there were 2 sensor related problems. The first was the compass on board the OpenPilot Revolution flight controller which was very noisy (diagnosed using APM Planner's graph function), even without the motor switched on, but very bad with motor switched on. I solved this by adding an external compass , which involved creating a custom version of the Chibios firmware to get at the external I2C port ( which therefore also necessitated resiting the GPS uart). I have to say doing the custom build was quite simple and only involved modifying the hardware description file. On uploading It to the flight controller, it worked first time, finding both the external compass and the UART.
Calibrating the external compass however was frustrating. I initially tried to do it manually, but just couldn't get it moving correctly as I turned the boat around. However I eventually managed it by just getting Ardupilot Mission Planner working in Linux ( involving installing Mono) and just letting the auto calibration do its thing.
After getting the compass calibrated, I also started searching for the "Mode change failed" message in the source code. After some grepping, this eventually led me to the Flags output which appears in APM Planner as one of the myriad variables in "Status" tab ( APM planner is my only available GCS when running on 32bit as I do at the lakeside/field) as a raw number. When the flags change from 169 to 831 then this indicates that the EKF3 is happy with the global position or IOW had given in and settled for what it was being served!, so this was the solution to the mystery of the last few weeks. I also made changes to the barometer since EKF3 was also showing a large "vertical position variance", first modifying the Ardupilot parameters so that the EKF3 ignored barometer as a height reference and used the GPS and second , adding a piece of sponge foam as a low pass filter for the barometer input.
Anyway the lesson learned is that after starting up it is necessary to watch the status flags in the GCS and wait for them to set correctly and only then can the boat be considered ready to go.
I hope these changes have performed a tune of the EKF3 which I hope to test out very soon.