Autonomous Boat




​
​
Reason for Project
​
I've always had an interest in marine applications, but while in school I also began to take an interest in robotics. To combine these two fields, I spent a couple years as part of an underwater robotics team at my university that aimed to compete in the RoboSub competition. However, the year that my team was planning to attend was the same year the pandemic hit, meaning the competition got cancelled and I never got to see my project through to the end. Since then, I've wanted to make a similar project of my own.
​
In previous robotics projects, my role was primarily on the mechanical side so I wanted to take this opportunity to learn more about how to write software for a robotics application. For this reason, I needed to pick a project that was going to allow me to keep the mechanical and electrical design and build as simple as possible. In addition, designing, building and testing an underwater robot can quickly become complex, so instead I chose to make a surface vehicle.
​
My goal for this project was to make a boat that could autonomously navigate short range GPS waypoint missions at slow speeds on small bodies of water. Ideally my objective would be to perform long range missions while collecting various environmental data (such as performing bathymetric surveys), however I didn't want to take on too much at once. Open-source software for autonomous and RC vehicles already exists (ex. ArduPilot, PX4) which could easily accomplish this task, however using that software would remove any experience I'd hope to gain from writing the code myself.
​​
Design and Build
​
For the hull of the boat I used a body board which is extremely buoyant, stable and light weight. This greatly reduced the likelihood of the boat sinking, and since the boat would be travelling at slow speeds over relatively short distances, hydrodynamics was not a high priority. On top of the board sits an enclosure and a communication tower. The enclosure is a plastic storage container and inside there are three 12V batteries along with a GPS, IMU, SD card, two ESCs and an STM32F4 microcontroller which runs the boat. The tower holds a magnetometer, LEDs, telemetry radio and RC receiver and is designed to both keep these devices away from the other electronics and make the LEDs visible. Mounted underneath and on either side of the board are two 350KV underwater thrusters equipped with prop guards and 3D printed propellers. Together these thrusters provide differential thrust which eliminates additional moving parts incurred from using a steering mechanism. I tried to include enough hardware in the system to make the boat capable and give lots of room to develop the vehicle software.
​
Navigation is achieved through the collection of GPS and IMU data that determines the boats position and orientation. A Madgwick filter and the local magnetic declination are used to translate accelerometer, gyroscope and magnetometer data into an orientation in the NED frame. This orientation is then used to find the acceleration in the NED frame and continuously predict the boats change in position. A Kalman filter is employed which combines this predicted position with the measured GPS position to provide the best possible estimate of the boat's location on Earth. This location is compared to the desired location to determine an error in both the heading and distance from the target. The error is used to generate a propulsion output that steers the boat in the direction it needs to go. Once the boat is found to be close enough to its target location, it moves onto the next waypoint in the mission.
​
For remote operation, the boat uses a telemetry radio in conjunction with the MAVLink protocol to communicate with a ground control station (GCS). The GCS I used is called Mission Planner which enables mission planning and monitoring, parameter tuning, and mode switching. Mission Planner is very capable but was built specifically for ArduPilot so in order to unlock features of the GCS I had to develop certain aspects of my code to mimic those of ArduPilot such as MAVLink messages used, vehicle states/modes and parameter formatting. A failsafe-capable RC interface is also integrated into the boat allowing manual control via an RC transmitter in non-autonomous modes.
​
After several iterations of writing the code, this project eventually transitioned from being an autonomous boat project to more of a custom autopilot project. As I was working on this I discovered that I may have an interest in making different types of unmanned vehicles such as UAVs or ground rovers. I also discovered that a lot of the features I was creating for my boat were not boat specific such as position and orientation estimates as well as telemetry information exchanged with the GCS. As a result, I ended up splitting my code into two repositories, one being generic autopilot software, the other being specific to my autonomous boat that utilizes the autopilot software. The autopilot incorporates FreeRTOS with event-driven architecture which is used to control the timing of events, communicate with hardware, interpret incoming data, and perform vehicle calculations. It also contains a hardware-abstraction layer where vehicle-specific data can be exchanged which allowed me to apply it to the boat I built.
​
Missions
​​
To test the boat, I often take it to local bodies of water and run simple waypoint missions. Since I've incorporated the MAVLink protocol into the autopilot software I'm able to use Mission Planner as my ground control station to carry out waypoint missions with the boat. Mission Planner allows me to plan routes, upload missions to the vehicle, update the target waypoint and observe position and orientation in real time. It also gives me access to the vehicle parameters which has allowed me to tune my Madgwick and Kalman filters on the fly while running missions. The mission size is only limited by the amount of memory available to store the waypoints, however due to the limited capability of the boat, I often restrict the missions to smaller bodies of water that require fewer waypoints. Running missions has given me lots of opportunity to test my software and find the physical limits of the boat.
​​
Next Steps
​
Prior to this project I didn't have much experience with making boats, so to get everything working I tried to keep the design as simple as I could. The boat's performance ended up exceeding my expectation, however a couple major limitations have become clear:
​​
-
The boat is too light and the hull is not the right shape to handle a modest wind. The use of a body board and only carrying a few batteries onboard didn't allow the boat to stand its ground when there was too much wind present despite increasing throttle input.
-
Lake/pond weed and leaves would occasionally get stuck in or around the thrusters. Once this gets stuck, it greatly reduces efficiency and functionality of the boat and it must be removed manually.
​
Despite these limitations, I found ways to operate the boat that minimized their impact. Going forward, I want to improve my design by focusing on reliability and more intelligent software. This build has provided me with a great platform which will allow me to:
​​
-
Continue to improve the software architecture, increase the number of operating modes, refine the control system and expand the communication capabilities with the ground control station.
-
Test new hardware features such as preventing debris from getting caught on the props, different steering mechanisms and sonar.
-
Test performance characteristics in greater detail such as battery range, speed, mission time, etc.
​
Eventually there will come a point where this design has reached its limit. When this time comes, I hope to create a new version of this project that incorporates everything I've learned. This new version would be a complete overhaul of the system to provide it with more capability. Some improvements could include a purpose-built boat hull, more batteries, solar panels and a charge controller, new design and layout of all the electronics, sonar, a custom ground station and more.