Tuesday, January 26, 2021

AMOS Servers and Correction Data

Over the past couple of weeks some good improvements were made to the internal communications software running on AMOS. When using the network / Internet communications mode, the previous method of communications relied upon running a server with a fixed IP address to act as a communications broker between AMOS and the host computer or phone that was being used to control the boat and view data. The server used some software that I had written called "BoatServer" and it just ran on an available Windows computer here at In Nature Robotics HQ (i.e. my basement). It required setting up the WiFi router to forward network traffic on a particular port to that computer, and also required both the host device and AMOS knowing what IP address our Internet service provider had assigned to the house. From time to time this address would change, perhaps once every few weeks. The solution was reliable most of the time, except when it wasn't. And when it wasn't, it would sometimes mean that either AMOS or the host device was unable to talk to the BoatServer software until the BoatServer software was forcibly closed and restarted. 

For a while I had been considering going back to the original simple network communications approach that I had started with a couple of years ago: running a TCP server directly on AMOS. This always worked quite well over the home WiFi network, but did not work at all when using the hotspot device on AMOS to get a cellular 4G connection to the Internet. Incoming server connections were not supported over the 4G connection. At least not directly. One possible solution was to make use of the remote.it service that I had used previously for controlling the boat over a PuTTY connection. Unfortunately though, this service seemed to have grown a bit in complexity since I used it last 2 years ago, and I was unable to follow their instructions for installing it on the Raspbian operating system that AMOS uses. So I tried switching to ngrok (https://ngrok.com/) instead, which thankfully worked great and was quite simple to install, allowing me to setup fixed IP addresses and ports for a PuTTY connection and a general TCP network / data connection for communicating between AMOS and the host device software. 

This new reliable mode of network communication was used to include RTK correction data from an RTK base antenna (once again setup on the playhouse roof). An FTDI USB-serial converter was used to receive the RTK correction data at the PC and transmit it to AMOS over the regular data / command link. At AMOS, the RTK data was extracted from the incoming commands and data and sent over a second USB-serial converter to the GPS receiver board, where it was used to apply corrections to AMOS's GPS position. The software running on AMOS was also slightly modified to output a GPS status number which was just 0, 1, or 2 depending on whether no GPS data was available, regular GPS data was available, or RTK-corrected GPS data was available. This was tested out in cold, windy weather this past weekend with pretty good results:


The above screenshot came from the map which was directly uploaded from BoatCaptain to ArcGIS. I'll try to embed the map below:

If the above map does not work, then this link will go directly to the ArcGIS web map: https://arcg.is/eLWaX0
I tried to position the boat next to known geographical landmarks: our fence, the corner of the driveway, the mailbox, a telephone pole, etc. At first, AMOS was consistently appearing about 2.5 m northwest of these real-world landmarks, until I realized that the base station position being used (it self-surveyed for about half an hour to find its own base position) was also off by about 2.5 m to the northwest. The GPS software had an option to key in your own latitude, longitude, and elevation. I was unsure of the elevation, so just used the self-surveyed result, but fine-tuning the latitude and longitude to the correct point on the playhouse roof resulted in very accurate AMOS positions, I believe to within 10's of cm of the actual location.
There have been some recent developments occurring in the workshop of Steven Fox. Check out these construction photos of the latest AMOS hull:

Saturday, January 9, 2021

Improved Magnetometer Calibration

Much of this new year has been spent working on improving the calibration of AMOS's magnetometers. The calibration jig discussed in the last blog entry has been completed and tested out, and seemed to work pretty well! Next up was an apparatus for performing a simple temperature calibration of the magnetometer sensors. To keep the temperature calibrator as simple as possible, it was decided to just put a small heater and fan into a small box with the device under test, and have everything hooked up to the Raspberry Pi on AMOS. Fortunately I had nearly all of the required parts already on hand: a spare heater cartridge from the 3D printer, an old heatsink and 12 V fan from a decades-ago junked desktop PC (never throw anything out, you might need it someday!!! 😜), an electronics enclosure box that had previously been embedded in the failed foam hull (see https://readerforgmail.blogspot.com/2020/11/breaking-mold.html), a DC-DC converter, and a 4-port relay (with just one fried port from the previous paddle experiments: https://readerforgmail.blogspot.com/2020/08/paddle-test-take-2.html).  I did need to buy a 24 V supply though to power the heater. 

Here's a pic of the interior of the temperature calibration box once it was all put together:


A simple bracket was 3D-printed to hold the PC fan and heat sink securely in place. Calibrating with this box requires chilling it for a while down to some minimum temperature, and then turning it on and letting the Pi collect data from the device under test (i.e. the magnetometer sensors). Fortunately the weather is pretty cold at this time of year, so I just did the temperature calibration outside:


The heater was powerful enough to heat up the interior from about -2 deg C up to about 37 deg C. Good enough I think to get some pretty decent linear calibrations on the magnetometer sensors:



The code on AMOS has been updated to include linear temperature calibrations for the magnetometers, so hopefully tomorrow I'll try it out in the house and then in the backyard to make sure that it's working.