October 30th 2022
To design the software stack to control and simulate the BlueRay, I am going to create a series of packages and plugins using ROS2, Gazebo, and Nav2.
To simulate the behavior of water, there are possibly two options. The first is the state-space model, in which bodies are simulated where fluids act as fields that exert the force of buoyancy onto them. Additionally, the fluid acts as a viscous substance, requiring passing bodies to adhere to the principles of lift and drag. The other approach is to simulate the liquid as a large collection of particles that act on each other and on the object. Obtaining an adequately precise simulation of the movement of underwater vehicles would require modeling the behavior of millions of particles. This task is computationally intensive for the system to run, as it would need to individually check each particle against each other and with the submerged bodies; for each collision, the computer would have to evaluate the transfer of momentum. These algorithms may thus produce unrealistic results due to insufficient parameter tuning and random variation between simulations. The choice, of which approach to use, typically boils down to what you're trying to do with them. If you've ever seen a big-budget action movie where a massive island or monster suddenly emerges from the ocean like Pacific Rim, they typically use the latter because it gives a more realistic splash and foam effect for the viewers. On the other hand, state space models are more consistent, simpler to model, and are used in all types of physics simulations from games to engineering.
As a result, to begin, I've decided to use Fossen's algorithms which as defined in his book Guidance and Control of Ocean Vehicles. The source code of other simulators such as UWSim, and UUV simulator include implementations of his algorithms and were able to produce accurate results. However, these projects are obsolete and no longer maintained to modern standards.
Another option in the choice simulator is the modern Stonefish engine which builds on the popular physics framework BulletPhysics and supports integration with ROS employing its own novel approach to liquid simulation. I will thus port both Stonefish and the implementation of UWSim and UUV simulator for Fossens' algorithms in my own simulator, AquaVeritas.
Then with models of an AUV constructed using basic shapes, I plan to incorporate AquaVeritas with the Nav2 framework which will make use of modern SLAM (Simultaneous Localisation and Mapping) and path-finding algorithms to simulate movement for the BlueRay. To accommodate this, I will build a custom ROS2 plugin similar to the DifferentialDrivePlugin, but for an AUV equipped with 6 thruster configurations.
In parallel, I will use AquaVeritas to train an AI model to control the thrusters to execute the same tasks of localization, mapping, and pathfinding as those performed by Nav2 to contrast performance. The AI will be trained using the PPO Reinforcement Learning Algorithm, and once I have a sufficiently advanced model for both, I will test them in the real world to evaluate: the fidelity of modern aquatic simulation (are algorithms/models developed in the simulation transferable to the real world?), the applicability of AI over current algorithms (is AI able to produce a more optimal or efficient algorithm for movement?), and the feasibility of training AI in underwater simulations (did the AI exploit some flaw in the simulation to allow it move unrealistically to increase its speed).
In the future, after these essential first steps, I would like to make this more accessible, providing rigging tools to allow people to plug in their models for simulations. This could include the creation of supporting GUIs and menus inside of Gazebo and the easy setup of thrusters with their own unique configurations. The add-on would generate the ROS2 plugin for the plugin and may even advise the user for a more efficient thruster setup with regard to degrees of freedom.
This was a long one, look forward to showing something exciting soon! :D
See you then.
Additional Resources/Articles: