Wednesday, July 4, 2018

Coding & Testing

Some code was added to AMOS this week for logging general sensor data. At present, it is only logging the interior temperature of the boat and the water temperature (measured by the DS18B20 sensor added last week). The logging interval is controlled by editing a text configuration file.

Our family visited my parents in Shediac this weekend, which afforded a couple of opportunities for testing out AMOS in the ocean. The first test was disappointing, as it seemed as though AMOS had regressed; it was swerving back and forth, and had difficulty maintaining a straight line. Occasionally it would even turn in a complete circle before continuing on. I followed along in the kayak for about half an hour before I finally realized what must have happened: the software that had been added for measuring water temperature required ~ 0.75 seconds to acquire a single sample, and was happening in the same thread that collected data samples from the electronic compass. The compass output was at 10 Hz, but of course this got reduced to ~ 1 Hz with the new temperature stuff added in. Since the navigation routine now also ran at 10 Hz, and required up-to-date compass data (also at 10 Hz) in order to function correctly, it was no longer possible for AMOS to maintain a straight course.

So I changed the water temperature logging interval to once every minute, and a second test proved that it was much better:


My mother and sister also joined me in their kayaks for this test. Everything seemed to be working perfectly, but on the return trip west, we noticed that AMOS would repeatedly veer off in a southwesterly direction before correcting itself back northward on its return trip. After getting back, I noticed that one of the fastening nuts on the right propeller platform had come off, and the  right platform and propeller were both dangling from the U-bolt and swinging freely. So likely that had something to do with the meandering return trip. I'll need to remember to check those nuts for tightness prior to field testing... transporting the boat in our old van with its sketchy suspension system is probably not good for mechanical fastenings.

I also suspected that perhaps compass inaccuracy was to blame for the zig-zag course on the return trip. On Monday, I took the boat back to Woolastook and ran it through the following rectangular course:


There didn't seem to be any issues with maintaining a westerly course this time, so I guess the previous problem was just due to the nut coming off. The only deviation in this last course happened near the northeast corner as the boat was moving eastward. There was a very strong wind at the time, so I'm guessing it must have momentarily blown AMOS off-course.

No comments:

Post a Comment