A Nonlinear Model Predictive Controller for Remotely Operated Underwater Vehicles With Disturbance Rejection

Remotely Operated underwater Vehicles (ROVs) are growing in importance in the ocean environment for observation and manipulation tasks, particularly when used to maintain offshore energy and offshore renewable energy assets. Many such tasks require the dynamic positioning of ROV in challenging sea conditions with multiple disturbances resulting from the effects of waves, currents and turbulence. This work presents a novel, nonlinear, model predictive dynamic positioning controller that accounts for such complex stochastic disturbances. These external disturbances are modelled as 6-degree of freedom forces and moments within the nonlinear ROV dynamic and propulsion model. A nonlinear model predictive dynamic positioning strategy based on the nonlinear model predictive control (NMPC) is proposed for the disturbance rejection in this work. A numerical water tank model is used to test the performance of the strategy using hardware in-the-loop simulation. The results of the simulation have been compared against baseline proportional-integral-derivative (PID) and linear quadratic regulator (LQR) controllers tested under wave and current conditions in the FloWave basin. A quantitative comparison of the controllers is presented. The resulting controller is shown to maintain a small root mean squared error (RMSE) in position when subjected to multiple directional disturbance, with minimal control effort. This study contributes an important insight on future theoretical design of model predictive disturbance rejection controllers and illustrates their practical implementation on real hardware.


I. INTRODUCTION
Remotely Operated Vehicles (ROVs) are type of unmanned underwater vehicles connected to the surface through a tethered cable. ROVs can perform a wide range of tasks that are important in underwater environment such as inspecting offshore platform [1], collecting sentiment samples from deep ocean [2], and underwater interventions [3]. Many of those tasks need the ROV to keep stationary and stable in the water during the operation. Dynamic positioning (DP) strategies are The associate editor coordinating the review of this manuscript and approving it for publication was Nasim Ullah . often employed to control the position of the ROV against the disturbance.
The proportional-integral-derivative (PID) controller proposed by [4] is a model-free feedback DP strategy. The PID controller driven by the error between the current and desired position is simple to implement but the quality of the control deteriorate when dealing with highly nonlinear systems or disturbance. However, the dynamics of the ROV is nonlinear at higher speed and often subject to the disturbance due to the ocean current, wind, and wave. The nonlinear model-free strategy sliding mode control (SMC) [5]- [7] treat the disturbance as uncertainty and switching between the mode for the error compensation. As a variable structure controller, it has the advantage over PID in nonlinear system control under disturbance [8], [9] but suffers the chattering issue that control signal has to oscillate at high frequency when switching between the modes. This will increase the energy consumption and cause excessive wear of the propellers that is not favourable in the ocean environment.
The attempt on the economic DP strategy start from the optimal control theory and the early work on linear quadratic regulator (LQR) have been applied to the ROV control problem [10]. Both quality and cost of the control are optimised in a single cost function with a linearised ROV dynamic model. Non-linearity and disturbance issues are not addressed by the native open-loop LQR controller. The modern development of model predictive controller (MPC) attracts the attention from researchers [11] that both non-linearity and disturbance can be included in the internal prediction model. But due to the high computational cost and the difficulty in implementation, current work only use a simplified model such as the linearised state space model [12], reduced order model [13] and linearised model with nonlinear residual [14]. The major challenge in economic DP is that the ROV dynamics is highly nonlinear and propulsion characteristic has to be included in the model. It is already difficult to solve the optimal control problem in real-time, not to mention the disturbance is considered in this work.
Recent advances in high performance embedded computing and solver such as the High-performance interior-pointmethod (HPIPM) [15] shed a new light on efficient nonlinear model predictive DP. Fast modular controller frameworks [16] build on top of those solvers allow the real-time embedded nonlinear optimal control.
In this paper, we present the design and validation of the state-of-art nonlinear predictive DP controller for ROVs under complex disturbances. This controller included the nonlinear ROV dynamics and propulsion in the prediction model. Multiple degree of freedom (DOF) disturbance is considered while dynamically positioning the ROV. The results show that the proposed controller achieved a smaller positioning error with lower control cost compared to baseline controllers. This work contributed to the design of disturbance rejection NMPC for a wide range of underwater missions.

A. NONLINEAR ROV DYNAMIC MODEL
The dynamics of the ROV is described by the differential equation on the position and velocity of the vehicle. Reference position η η η is the pose of the vehicle η η η = [x, y, z, φ, θ, ψ] T relative to the fixed global reference system where x, y, z are the location shown in Figure 1, and φ, θ, ψ are orientation that follows the right hand rule. Similarly, the velocity ν ν ν = [u, v, w, p, q, r] T consists of linear and angular velocity is relative to the body of ROV where u, v, w is the rate of translations and p, q, r is the rate of rotations. We consider a six degree of freedom nonlinear ROV dynamics model in this study where M is mass matrix, C is Coriolis matrix, D is damping matrix and g is the gravitation force vector. τ τ τ is force and moment from propellers and τ d is the disturbance. The term Mν ν ν accounts for the force and moment due to the acceleration of ROV (rigid body mass) and the water (added mass) around the vehicle M = M RB + M A . The rigid body mass matrix where m is the mass of the ROV, x g , y g , z g are position of centre of gravity. I i is the moment of inertia with respect to i axis and I ij is the product of with respect to i, j plane that measures the imbalance of mass distribution. The added mass matrix include the force and moment due to the acceleration of fluid around the ROV. As the force and moment in Eq 1 is described in a rotational body fixed reference frame, the inertial Coriolis force will act on the ROV depends on the rate of rotation. VOLUME 8, 2020 Coriolis force matrix also consists of rigid body and added mass term C(ν ν ν) = C RB (ν ν ν) + C A (ν ν ν), and the added mass Coriolis force matrix for the fluid volume where Xu, Yv, Zẇ, Kṗ, Mq, Nṙ are added Coriolis force coefficients. ROV also experiences fluid resistance in the water as the hydrodynamic damping D. Linear skin friction generated by the laminar flow effects is considered for the ROV model.
where X u , Y v , Z w , K p , M q , N r are linear hydrodynamic damping coefficients. High freqency damping including the turbulence on the boundary layer and the vortex shedding damping are modelled by the nonlinear model.

D nl
= diag(X u|u| |u|, Y v|v| |v|, Z w|w| |w|, K p|p| |p|, M q|q| |q|, N r|r| |r|) where X u|u| , Y v|v| , Y v|v| , K p|p| , M q|q| , N r|r| are nonlinear hydrodynamic damping coefficients. Restoring force is the net buoyancy where W = mg is the weight of the ROV, B is buoyancy. In most case, the robot is positively buoyant W < B so that the vehicle could surface up if propulsion is lost.
where c(·) = cos(·), s· = sin(·) and x b , y b , z b are position of the buoyancy centre. We also considered the propeller characteristics for a more realistic ROV dynamics model. The BlueROV 2 is controllable in four degrees of freedoms -surge, sway, heave and yaw -by the combination of six propellers. Normalised controller inputs u i ∈ [−1, 1] are received by the ROV's lower level controller and the control inputs vector u u u = [u 1 , u 2 , u 3 , u 4 ] T are corresponding to the surge, sway, heave and yaw of the vehicle. Control inputs are then allocated to each propellers through the allocation matrix. For the BlueROV2, the control allocations a a a = [a 1 , a 2 , a 3 , a 4 , a 5 , a 6 ] T is where a a a i is the allocated control for propeller i and the layout of six propellers is shown in Figure 2. The datasheet on propeller thrust force on the allocated control signal was provided by the manufacturer. For each propeller, thrust t i by propeller i is approximated from the allocated control signal a a a i , and thrust vector t t t = [t 1 , t 2 , t 3 , t 4 , t 5 , t 6 ] T represents propulsion force produced by all propeller. This thrust model also embedded the constraint on the control signal that maximum thrust is limited by exponentially decreasing. Given the thrust force of each propeller, the total force and moment applied to the ROV is τ τ τ = Kt t t (11) where K ∈ R 6×6 is the propulsion matrix which is determined by the layout of all propellers. The material in the Appendix described how to derive the propulsion matrix from the ROV's geometry.
The nonlinear ROV dynamics model include the propulsion system under disturbance is This model captures the nonlinear dynamics of the ROV with a generalised disturbance. Since there is no explicit assumption on the disturbance τ τ τ d , the ROV could reject any types of disturbance (or a combination of them e.g. ocean current, wind and wave) as long as controller derived from the model is stable. The ROV dynamics is implemented as a parameterised symbolic model that allows a fast and accurate computation through Automatic Differential (AD) on its first and second derivatives.

B. ROV KINEMATIC MODEL
The kinematic model describes the motion of ROV as a relation between the velocity in body frame and position in the earth fixed frame.η where J (η) ∈ R 6×6 consists of transformation to the body velocity in the inertial reference frame.
the matrix may experience singularity when the pitch angle is θ = π/2. However, the ROV rarely operate in that pitch angle and it also has a weight distribution that centre of gravity is lower than the centre of buoyancy, the vehicle is self-balanced around the neutral pitch angle θ = 0.

C. NONLINEAR STATE SPACE MODEL
From the ROV dynamics and kinematics model, the state of the system is selected as the position and velocity of the vehicle. Due to the non-linearity in both dynamics and kinematics of the ROV, a nonlinear state space model is used to represented model the the dynamic positioning controller. For the state x ∈ R 12 , the first order derivative is a function of the state, the control input and the disturbance.
A linearised dynamics positioning strategy often approximate the model around the operation point and represent the disturbance a noise,ẋ where ω ω ω is process noise and In practice, the model is linearised around several common operation points to overcome the issue when controlling a nonlinear system with approximated dynamics. However, the linearisation process is non-trivial and requires expert decisions to select operational points. Besides, there is no way to include disturbance prediction in the model.
In contrast to the dynamic positioning strategy using a linear model, this approach does consider the prediction of disturbance and the non-linearity in the vehicle dynamics.

II. NONLINEAR MODEL PREDICTIVE DYNAMIC POSITIONING A. CONTROLLER ARCHITECTURE
The architecture of the nonlinear disturbance rejection model predictive controller is shown in Fig. 3. For the dynamic position task, the nonlinear MPC is a position controller accepts the referenced pose η ref as input. In this control architecture,the inputs are referenced trajectory η ref , current state η, ν and the measured disturbance τ d . The output of the controller is u, the normalised control actions in surge, sway, heave and yaw. When the reference trajectory is a single set-point, the controller is in station keeping mode. The trajectory can also follow a moving object in the ocean while rejecting the disturbance. Trajectory can be updated online for keep stationary near a new set-point or follow a different path.
When the disturbance acting on the ROV dynamics, a prediction of those disturbances is also feed into the nonlinear controller. A control trajectory is planned through nonlinear optimisation given the information on the referenced position, measured disturbance and current state of the system. The control signal u is normalised thruster commands in the body-fixed reference frame. Lower level controller running real-time operating system transforms those commands into low-level control signal such as pulse width modulation (PWM) wave to thrusters and eventually become the propulsion forces and moments τ . The unmeasured disturbance is usually difficult [17] to deal with only predictive model. This controller handle the unmeasured disturbance by closed loop feedback when a new state of the ROV is observed.

B. CONTROLLER PREDICTION MODEL
Nonlinear MPC optimises the control trajectory using an internal prediction model from the nonlinear system dynamics. The nonlinear state space model described in Equation 18 is an ODE in the form of the current state, input and disturbance.ẋ For nonlinear system dynamics, there is no general closed-form expression for the discrete-time dynamics. From the continuous time nonlinear ROV dynamics, the state x t+1 need to be obtained from numerical integration. On a small discrete time interval t, the next state can be found using explicit Runge-Kutta (RK) method.
Higher order RK methods have a significant better numerical accuracy at a similar computation cost. We employed the explicit fourth order RK method (RK4) as our controller prediction model.
The nonlinear property in the ROV dynamics is captured when predicting the model at every time step. Besides, the prediction is based on the actual state and control x t , u t instead of operation point x o , u o . This gives a natural advantage of nonlinear MPC over other control strategy based on a linear approximated model. In addition, the controller prediction model inherent the propeller characteristics and the disturbance from the ROV dynamics ODE. Hence, the discrete model f d has the power to predict the nonlinear ROV dynamics in the presence of 6-DOF disturbance.

C. CONTROL OBJECTIVES AND COST FUNCTION
The nonlinear MPC can be formulated as an optimisation problem over the state trajectory where Q ∈ R 12×12 and R ∈ R 4×4 are the weight matrices on the state and control, m ∈ R 6 is the weight on the terminal state x T , α is smooth factor for the numerical optimisation stability and denote element-wise multiplication between two vectors. The constraint optimal control problem is designed for the nonlinear ROV dynamic positioning in the presence of disturbance. There are multiple control objectives that the nonlinear MPC would like to achieve at the same time.
First of the all, the cost function is aimed to reduce the steady state error to keep the ROV as close and stable as possible to the reference position. Intermediate cost penalise the difference between current state and reference state by the term the ROV for begin far away from the reference position. We found the final cost in the form of absolute smooth norm result is faster to optimise compared to the quadratic final cost for set point dynamic positioning. This is due to the gradient on the quadratic final cost descent slower on quadratic final cost making it hard to converge when the ROV closer to the reference position.
Secondly, the optimal controller is designed to reduce the total effort of the control. Intermediate cost on the control Last but not the least, there are three constraints for the optimal controller. The first two equality constraints let the optimised trajectory x τ , u τ follows the nonlinear dynamics of the ROV from the initial state x init . Since the disturbance is included in the controller prediction model f d (x t , u t , τ d , t), the optimal control will reject them by design. The inequality constraints on the normalised control vectors limits the maximum thrust to optimise a feasible control signal.
Nonlinear MPC model in Equation (23) is optimised on every time step and only the first control signal in u * τ is applied to the ROV. New control trajectory of the system will be optimised on a receding horizon manner. For example, the prediction horizon shift from [0, T ] to [t, t + T ] after the first control signal is sent to the ROV. During the shift, the new observation on the state and disturbance is also made to update the optimisation model. We can gradually shrink the prediction horizon T to T t as the control time t approaching to T for a faster response.
As a summary, the dynamic position task is formulated as a nonlinear MPC optimisation problem under the presence of disturbance. The controller is designed for a stable station keeping near the reference position with an optimised control effort.

D. SOFTWARE AND HARDWARE IMPLEMENTATION
Despite the advantage of nonlinear MPC in dynamic positioning with disturbance rejection, the computation load is heavy when the system must continuously compensate the nonlinear dynamics in real time. To achieve real-time control, the software and hardware of the system have to be carefully designed and optimised. The control software is written by a combination of Python / C++ code and ROS middleware is used for communication. The nonlinear MPC model f (x, u, τ d , t) is prototyped symbolically with SymPy package and exported as C++ code. A numerical integration routine is applied to the exported nonlinear MPC model for the discrete controller prediction model f d (x t , u t , τ d , t). The core optimisation algorithm is then implemented in C++ with control-toolbox [18] for better performance. Multiple shooting algorithms provided by the toolbox use HPIPM as solver. The solver was then built for the ARMv8 architecture of the onboard computer.
The hardware configuration of our experiment platform BlueROV2 is shown in Figure 4. The original Raspberry Pi single-board computer that comes with the BlueROV2 is replaced by the Jetson Nano single board computer. The nonlinear MPC algorithm is running on the Jetson Nano onboard computer. Main control algorithms are running on Jetson Nano and the onboard computer communicate to the mission control computer through an Ethernet tether cable. The onboard computer also estimates the state of the ROV from multiple sensors for the controller. Mission control computer does not directly send any low-level control command to the ROV, but it only updates the measured position from the motion tracking system and forwards the reference position to the vehicle. In the case of an emergency, the joystick could override the autonomous controller and allow the human operator to navigate the vehicle manually.
We also implemented a numerical water tank (shown in Figure 5) to simulate the ROV dynamics. The numerical ocean tank provides a convenient software simulation environment to develop the controller without the hardware. After the control is designed in the numerical ocean tank, the nonlinear MPC can be deployed to the real hardware without much effort.

III. EXPERIMENTAL SETUP A. SYSTEM IDENTIFICATION
System identification is conducted to acquire the parameters for the nonlinear MPC model by experiment. The experiment setup is shown in Figure 6, with the ROV fixed in an open steel frame by eight strings. The setup takes the advantage of FloWave Ocean Energy Research Facility at the University of Edinburgh which is capable of generating directional ocean current up to 1 m/s. Compared with driving the ROV at a constant speed, forced water flow in the tank allows the steady state measurement in a much longer period.
Strain gauges are connected to the end of the string to measure the force when the water flow through the ROV. A reflective ball is also attached to the string for the motion tracking system to record the 3D position of one end point. Position of the other end is found through motion tracking on the ROV body. In this way, the direction of the string can be calculated to find the total force and moment measured by eight strain gauges. Experiment procedure [19] and data [20] for the parameter identification was open sourced. On each degree of freedom i, the generalised dynamic motion model is given by where v is the velocity, m i is mass matrix term, and d i and d i|i| are linear and nonlinear hydrodynamic damping, τ i is total force/moment in the degree. Least squares minimisation is used to estimate those parameters from force samples collected in every direction and for various flow speeds.

B. BASELINE CONTROLLERS
Two baseline dynamic positioning controllers are implemented and their performance is evaluated in the FloWave Ocean Energy Research Facility. The first baseline controller is the proportional-integration limited (PILIM) controller proposed in [21]. The control diagram of the PILIM controller is shown in Figure 7.
where K Pη is the proportional gain, J −1 (η) transforms position error from inertia reference frame to body fixed frame.
The inner velocity loop is a proportional-integration controller with reference velocity generated by the outer loop. The controller output where K Pν and K I ν are proportional and integration gain on the error of body referenced velocity. The outputs of the controller are limited to [-1, 1] to ensure the control signal does not saturate any of the thrusters. Another baseline controller is the linear-quadratic regulator (LQR) based on a linearised ROV dynamics model. The linear state space model is found through the numerical derivative near the operation point with the optimal control sequence F is found by the solution on Discrete-time Algebraic Riccati Equation (DARE) of Q and P. The optimal is limited to [-1, 1] by saturation for a realistic control signal.
In the baseline controllers experiment, the state of the ROV is observed by the external Qualisys motion tracking system. Three reflective balls are attached to the left and right side of the ROV to allow real-time motion tracking. Mission control computer bridge the Qualisys tracking system in the ROS network and pass the real-time pose estimation to the ROV as a PoseStamped message. Mission control computer also forwards the setpoint as a reference state to the ROV. Similar to our nonlinear MPC implementation, both controllers are running on the Jetson Nano onboard computer.

C. HARDWARE IN-THE-LOOP SIMULATION
A hardware in-the-loop (HIL) simulation was designed to evaluate the performance of all controllers under the presence of disturbance. In the HIL experiment, the configuration is exactly the same as the hardware experiment shown in Figure 4 except that the dynamic is simulated in the numerical ocean tank. Control algorithms are also running at the on-board computer for a consistent real-time computation capability comparison. The ROV dynamics model for the numerical ocean tank is tuned against the result from the baseline controller experiments.
In the numerical tank, the 6-DOF external forces and moments can be generated to simulate the external disturbance. The ability to generate both single and multiple directional disturbance helps us to assess the performance of nonlinear MPC in a complex environment. The advantage of the HIL implementation is that it allows rapid controller prototyping and design through multiple tests under a wide range of conditions, which would be expensive and time consuming if done in a physical water tank. Once a satisfactory performance is achieved through numerical simulations, physical experiments can be used to further validate the designed controller.

A. DYNAMIC POSITIONING WITHOUT DISTURBANCES
We first present the dynamic positioning results without disturbance. In this case, the depth of the ROV has to be maintained at 1 meter where the ROV is fully submerged.
The position, velocity and the normalised control of three controllers are shown in Figure 9. The time starts with the first given reference state x ref . Two optimal controllers, LQR and MPC controller, have a similar response in the first 2 seconds. However, the linear optimal controller has a steady state error because of the linearised model approximation. This is a common drawback in using linearised model to control nonlinear dynamics. A way to mitigate the steady state error is to use the integral term in the controller as a compensation to the error. The baseline PID controller has an integration term in the velocity loop to deal with this issue. As the error aggregates, the velocity controller gradually response to the integral term and finally reach 1 meter depth with less than 1 % steady state error.
Compared to the nonlinear MPC, dynamic positioning with linear system and integration term in the controller is slower because it needs time to accumulate the error. LQR controller has a similar response to the nonlinear MPC in the first 3 seconds. The steady state error in LQR after that, however, pose a challenge to the operation when an accurate positioning is needed. Nonlinear MPC has the advantage of quicker response time and higher dynamics positioning accuracy (less steady state error) among three controllers.
All controllers reach their steady state after 15 s and they find the normalised control that counterbalances the positive buoyancy at that time. Since the positive buoyancy is cancelled by the downward propulsion force, the speed of the vehicle stays at zero archiving a dynamically stable state. Nonlinear MPC is the first controller to reach such state and LQR comes after. PID controller is the slowest as the ROV has to correct the steady state through enough aggregated position error. In terms of control quality, both nonlinear MPC and PID achieved a less than 1 % steady state error.

B. DYNAMIC POSITIONING WITH DISTURBANCE IN A SINGLE DIRECTION
The second result on the dynamic positioning shows the performance of all controllers under the presence of disturbance in a single direction. Figure 10 illustrates how three controllers response to the disturbance after the ROV reached the dynamic stable state.
From 20s to 22s, a downward external disturbance with a peak of 1 N is applied to the ROV. This is a relatively large disturbance as the counter buoyancy force produced by the propellers is only about 5 N. The sudden rise on the external disturbance is close to 20 % of its current control force that requires a rapid response from the controller.
As it can be seen in Figure 10, the PID response to the disturbance is slower than the LQR and MPC. The error on the depth is propagated to the controller through the position loop which makes it slow to compensate when it is small. Unless the error in the position is large enough, the referenced velocity of the ROV is small. Normalised control issued by the PID controller would be slow when the ROV experience the sudden disturbance. LQR is a position and velocity controller response to both error faster than the PID controller. This can be also be observed in the maximum transit state position error in the depth. PID controller has a maximum position error at 0.04 m from it steady state and LQR controller is only 0.02 m. However, the steady state error caused by the linear approximation of LQR persists. PID controller has less RMSE on the depth with a better steady state performance.
Nonlinear MPC considers the disturbance in the model and the normalised control is adjusted as soon as the external force is applied to the ROV. It takes the advantage of velocity and position controller. Both depth and velocity of ROV have maintained as long as they changed. Thanks to the predictive power of the model, nonlinear MPC achieved a good performance in response time, error in position and cost on control.  Table 1 summarises the root mean squared error (RMSE) on the position and root mean squared (RMS) value on the normalised control between 15s and 30s. Nonlinear MPC rejects the external disturbance with the smallest RMSE on depth at a controlled cost lower than all baseline controllers. This result is promising to the ROV depth control when subject to the external disturbance.

C. DYNAMIC POSITIONING WITH DISTURBANCE IN TWO DIRECTIONS
The experiment results on two direction disturbances are shown in Figure 11. In this experiment, the external disturbance on both x and z direction is applied to the ROV at the same time. The disturbance is peaked at 1 N on the x direction and the 1.5 N on the z direction. The set-point is at the origin x = y = z = 0 where the ROV is still fully submerged at the centre of the tank (the origin is 1 meter to the surface of water).
In this case, the external disturbance on depth is 30 % of the steady state buoyancy. On x direction, the external disturbance is more challenging as there was no control at all. The PID controller deals with the error in the position and velocity on each direction separately. On the x direction, the disturbance causes the ROV to move forward as far as 0.15 meter. The error in the position is corrected by the proportional controller through velocity reference to the inner loop. As the velocity caused by the disturbance rises, the velocity controller increases the normalised control to reduce the error. Similarly, the PID controller compensates the disturbance on z direction only when there is sufficient error in the position and velocity of the ROV.
LQR controller has a faster response time compared to the PID controller as both position and velocity error are considered at the same time. Moreover, the LQR controller deal the dynamic positioning problem in all degrees of freedom that the error in x and z are considered at the same time. Although there is a steady state error in depth, LQR outperforms PID in smaller RMSE on x direction. The maximum position error of the LQR controller is also smaller than the PID controller.
For the nonlinear MPC, the disturbance in both directions are included in the prediction model. Normalised control in x direction is more aggressive than the PID and LQR controller. A fast response to the disturbance in these directions keep the ROV stationary in the water. The dynamic positioning in x direction is hard for the PID and LQR under the disturbance due to two reasons. Firstly, the non-linearity of the system exist in both propulsion and ROV dynamics. For example, the nonlinear propulsion model shows the dead-zone when the normalised control is small. It is difficult for the controller to capture the such dynamics from linearised model or mitigate by error aggregation. Secondly, the disturbance is not included in the structure of PID and LQR controller. Both controller only react to the disturbance after it cause the error in the referenced position and velocity. Nonlinear MPC has the advantage over those controllers that both non-linearity and disturbance are embedded in the model. Similar depth holding performance is repeated by the nonlinear MPC under two directional disturbances. The controller maintains a fixed depth and velocity when the external disturbance is applied to the ROV.
The predictive power of nonlinear MPC helped ROV to reduce the RMSE on x and z and RMS control. Although the control is more aggressive in the beginning, the disturbance  rejection is faster than the PID and LQR controller so the overall control cost is lower. The nonlinear MPC achieved the smallest RMSE in two directions with the lowest control cost. In practice, this means the nonlinear MPC could increase accuracy and save energy while dynamically positioning in ocean environment subject to multiple directional disturbance.

D. DYNAMIC POSITIONING WITH DISTURBANCE IN THREE DIRECTIONS
The final experiment on the dynamic positioning performance of nonlinear MPC extends the disturbance to all three dimensions. Figure 12 shows the result of three controllers when subject to the external disturbance in x, y and z direction. This is particularly challenging for the ROV as the normalised control in x and y direction are coupled. In order to move forward or side-way, the directional thrust force needs to allocated to propellers 1 to 4 to let them work together.
Nonlinear MPC has the natural advantage that the controller allocation is considered in the nonlinear state space model. This motivates the nonlinear MPC to optimise a shared normalised control to deal with a disturbance in x and y direction. LQR that linearised from the nonlinear state space model also benefit from this. They both outperform the PID controller in the x and y direction but MPC with nonlinear prediction response faster and more accurate. Good depth hold performance is confirmed again in Table 3. Comparing to the baseline controllers, nonlinear MPC produces the best performance in dynamic positioning under single and multiple direction disturbance. Nonlinear MPC achieved a sub centimetre RMSE in all directions when subject to 3DOF disturbance. Nonlinear MPC with multiple direction disturbance rejections would allow the ROV to keep stable in a more complex ocean environment. The ROV could account for the combination of ocean current, wind and wave disturbance and optimised control enable energy-efficient and accurate dynamic positioning in a challenging environment.
On the Jetson Nano (1.4 GHz quad ARM cores) on-board computer, the nonlinear MPC algorithm running on 4 threads reaches 35Hz which is faster than the control frequency 20Hz. This allows a real-time nonlinear dynamic positioning and disturbance rejection control without external computation resources. The performance of the nonlinear MPC would depend on the correct prediction on the external disturbance. Our future work would focus on the prediction of multiple direction disturbance in the ocean environment. The development of disturbance prediction method would ultimately improve the performance of nonlinear MPC.

V. CONCLUSION
In this article, a nonlinear model predictive dynamic positioning strategy was developed for the ROV in the challenging ocean environment. The controller is based on the 6 DoF nonlinear ROV dynamic and propulsion models. The external disturbance is included as forces and moments in the nonlinear state space model. The ROV dynamic positioning task is formed as an optimal control problem and solved by numerical optimisation in a receding time horizon manner.
From the tank test and the HIL simulation result, it is clear that nonlinear MPC could reject a complex disturbance better and station keeping around the set-point with minimal control effort compared with PID and LQR baseline controllers. The real-time performance confirmed in the HIL simulation suggests a greater development possibility for disturbance prediction in the future. The design of the nonlinear controller and the result of the study is important for the future development stable ROV in the observation and manipulation tasks.

A. PROPULSION MATRIX
Let l xi as the distance between the centre of propeller i to the centre of the gravity in x direction (where positive value is at the front of the vehicle) and t xi as force projection to x direction. Taking the propeller 1 as an example, the forces and moments produced are t 1 cos α −t 1 sin α 0 t 1 sin α · l z1 t 1 cos α · l z1 t 1 (− sin α · l x1 − cos α · l y1 ) where α is the orientation of the propeller. Using the value α = π/4 and l x1 = 0.156 , l y1 = 0.111 , l z1 = 0.072 for propeller 1, the first column in K can be obtained.  Table 4.