This repository contains three distinct simulation and control frameworks designed for simulating and controlling the three 6 DOF models, C/S Arctic Drillship, R/V Gunnerus and C/S Voyager, under wave disturbances. Developed for Kristian Magnus Roen's master's thesis in Marine Cybernetics (2025), the repository includes:
A high-performance, differentiable pipeline based on JAX and adapted from the mcsimpy simulator. It provides significantly enhanced computational speed and memory efficiency, making it ideal for large-scale or repeated simulations and extensive machine learning applications like reinforcement learning. This core also features an adapted marine-focused version of the meta-trained adaptive controller from Richards et al. (2021) and adding model-uncertainty and training only the diagonal gains.
Features a highly modular Gym environment called mcGym, complete with live visualization capabilities with pygame, built around the standard mcsimpy simulator. mcGym follows an API structure similar to OpenAI's Gym, offering standardized tasks and the flexibility to define custom scenarios, including dynamic or static obstacles influenced by wave motions. Ideal for visual testing of custom controllers and benchmark testing.
A PyTorch-powered variant of the mcsimpy simulator designed explicitly for machine learning integration. Leveraging PyTorch’s extensive ML modules, this core excels in deep learning and RL and sophisticated ML-driven controller implementations, fully harnessing mcGym's capabilities.
Below are example runs showcasing the capabilities of our different mcGym cores:
Here the numpy_core mcGym runs a static scenario: the vessel must navigate from its start point to a fixed goal while avoiding a stationary circular obstacle. The controller plans a path around the obstacle and holds final heading within the specified tolerance.
In this dynamic scenario (also using numpy_core), both the goal and obstacles move over time: the goal “wiggles” sinusoidally, and two circular obstacles follow independent trajectories. The controller continuously replans to track the moving goal however, it hits one of the obstacles, and the loop is then terminated.
This GIF uses the torch_core version of mcGym together with a custom ModelController(nn.Module)—a pure PyTorch controller that implements a PD law augmented by full model compensation. Because it’s built on torch.nn, you can seamlessly swap in learned networks, fine-tune gains via backpropagation, or integrate any other PyTorch module.
You will need:
- Python 3.7+
- Package Dependencies
-
Base:
pip install numpy matplotlib tqdm pickle pygame json scipy
-
Torch Core:
pip install torch torchvision
-
JAX Core:
pip install -U "jax[cuda12]" -
mclsimpy (Simulator for Numpy core):
pip install git+https://github.com/NTNU-MCS/mcsimpy.git@master
-
Pull requests and issues are welcome!
Distributed under the MIT License.
See the repository root for details.








