Five-State Extended Kalman Filter for Estimation of Speed over Ground (SOG), Course over Ground (COG) and Course Rate of Unmanned Surface Vehicles (USVs): Experimental Results

Small USVs are usually equipped with a low-cost navigation sensor suite consisting of a global navigation satellite system (GNSS) receiver and a magnetic compass. Unfortunately, the magnetic compass is highly susceptible to electromagnetic disturbances. Hence, it should not be used in safety-critical autopilot systems. A gyrocompass, however, is highly reliable, but it is too expensive for most USV systems. It is tempting to compute the heading angle by using two GNSS antennas on the same receiver. Unfortunately, for small USV systems, the distance between the antennas is very small, requiring that an RTK GNSS receiver is used. The drawback of the RTK solution is that it suffers from dropouts due to ionospheric disturbances, multipath, interference, etc. For safety-critical applications, a more robust approach is to estimate the course angle to avoid using the heading angle during path following. The main result of this article is a five-state extended Kalman filter (EKF) aided by GNSS latitude-longitude measurements for estimation of the course over ground (COG), speed over ground (SOG), and course rate. These are the primary signals needed to implement a course autopilot system onboard a USV. The proposed algorithm is computationally efficient and easy to implement since only four EKF covariance parameters must be specified. The parameters need to be calibrated for different GNSS receivers and vehicle types, but they are not sensitive to the working conditions. Another advantage of the EKF is that the autopilot does not need to use the COG and SOG measurements from the GNSS receiver, which have varying quality and reliability. It is also straightforward to add complementary sensors such as a Doppler Velocity Log (DVL) to the EKF to improve the performance further. Finally, the performance of the five-state EKF is demonstrated by experimental testing of two commercial USV systems.


Introduction
Commercial unmanned surface vehicle (USV) systems are used in many operations such as harbor inspection, surveillance, mapping, data acquisition, oceanography, etc. (see Figures 1 and 2). This creates a need for low-cost sensor systems to operate a USV safely with satisfactory performance. The autopilot system is a critical component that is used for turning and path following. Both heading and course autopilots can be used for this purpose. Course autopilots are the preferred solution during path following. However, for stationkeeping it is necessary to control the heading angle. The reason for this is that the course angle is not defined at zero speed.
Ships are usually equipped with a gyrocompass, which is a nonmagnetic compass able to find true North using a fast-spinning gyroscope (Fossen [1]). The gyrocompass gives a highly accurate measurement of the heading (yaw) angle, but it is too expensive to be used in small USV systems. Hence, it is tempting to use a low-cost magnetic compass for navigation and maneuvering. This is not straightforward since a magnetic compass is susceptible to magnetic disturbances produced by electromagnetic devices such as propellers and thrusters. In addition, the magnetic field of the Earth is not perfectly aligned but skewed along the Earth's rotational axis. The skew or bias is called declination, and it must be compensated for when navigating.
An alternative measurement to the compass could be to use two GNSS antennas on the same receiver with a known offset vector to compute the heading angle. The accuracy is further improved by using real-time kinematic (RTK) GNSS positioning (Farrell [2]). This is the preferred solution for small USVs since the offset vector can be small. It is well known that the RTK GNSS receivers are sensitive to ionospheric disturbances, multipath, loss of signals, the number of available satellites, etc., so the reliability can, in many cases, be unsatisfactory.
The scope of this article is to derive a robust state estimator for SOG, COG, and course rate such that these signals can be used to design a USV course autopilot for path following. The state estimator should only use the North-East positions, alternatively the latitude and longitude, of a GNSS receiver. If the course angle is available as a direct measurement or an estimate, it is straightforward to design a proportional-integral-derivative (PID) controller for course control; see Fossen [1].  The dynamics of a USV moving along a path or a trajectory can be modeled by using 2D target-tracking models (Li and Jilkov [4]). The simplest models for a target-tracking maneuver are the white-noise constant velocity (CV) and constant acceleration (CA) models (Bar-Shalom et al. [5]). These models are based on the assumption that the target speed or acceleration are independent processes driven by Gaussian white noise. The Otter and Mariner USVs shown in Figures 1 and 2, respectively, are not able to produce aggressive linear accelerations. Hence, the CV model is well suited to describe the vehicle's speed U during path-following control, since U is nearly constant even though the USV experiences small linear accelerations. Analysis of automatic identification system (AIS) data confirms this (Siegert et al. [6]). However, both USVs have propellers that can turn the vehicles quite fast. This suggests that the course angle χ should be modeled by a CA model. Consequently, the target-tracking models are chosen as a combination of the CV and CA models according toU where w 1 and w 2 are Gaussian white-noise processes. The models (1)-(3) will be used as a basis for the EKF presented in Section 3.
The main result of this article is a five-state EKF (Appendix A) aided by GNSS positions or latitude-longitude measurements, which is intended for course and path-following control. The EKF can also be used to process AIS measurements (Fossen and Fossen [7]) with the purpose of ship motion prediction. The algorithm is computationally efficient and easy to implement. The main advantage of the EKF is that vendors do not need to use COG and SOG measurements from GNSS receivers, which have varying quality. In addition, the algorithm produces an accurate estimate of the course rate, which is an important signal when implementing PID course autopilot systems.
The remainder of this article is organized as follows: Section 2 presents the kinematic equations of a surface vehicle, while Section 3 contains the EKF for COG, SOG, and course rate estimation. Section 4 describes a method for USV course autopilot design. Section 5 includes a simulation study of a small USV under course autopilot control, while Sections 6 and 7 present the experimental results using two commercial USV systems. The discussion and concluding remarks are drawn in Sections 8 and 9.

Kinematics
The relationship between the angular variables course, heading, and crab angle is important for maneuvering of a USV in the horizontal plane. The terms course and heading are used interchangeably in much of the literature on marine systems, and this leads to confusion. Let the BODY and North-East-Down (NED) reference frames in Figure 3 be denoted by {b} = (x b , y b , z b ) and {n} = (x n , y n , z n ), respectively.

Definition 1. (Yaw or heading angle ψ)
The angle ψ from the x n axis (true North) to the x b axis of the USV, positive rotation about the z n axis by the right-hand screw convention.
The heading angle is usually measured by using a magnetic compass, gyrocompass or two GNSS receivers; see Gade [8] for a discussion of methods. The heading angle is well defined for zero speed such that it is possible to design a heading autopilot to maintain constant heading during stationkeeping and transit. However, during transit it is common to use a course autopilot for path following.

Definition 2. (Course angle χ )
The angle χ from the x n axis (true North) to the velocity vector of the USV, positive rotation about the z n axis by the right-hand screw convention.
Note that the course angle is only defined for positive speed. The North-East positions (x n , y n ) of a USV can be described by (Fossen [1]), where (u, v) are the surge and sway velocities, respectively. These equations can be expressed in amplitude-phase form bẏ where the course angle is defined as Furthermore, the amplitude U and phase variable β c are Note that U is the speed in the horizontal plane, and β c is the crab angle.

EKF for SOG, COG and Course Rate
The primary objective of the EKF is to compute accurate estimates of the SOG, COG, and course rate of the USV when moving along a path. The dynamic model of the EKF ensures that old GNSS position measurements are used to compute the estimates. Since the path is not parametrized and the heading angle is unknown, the only information during path following is the measured GNSS position, alternatively the latitude-longitude pair.

Five-State EKF: North-East Position Measurements
The North-East positions (x n , y n ) of the USV are given by (6) and (7), while the speed and the course angle are modeled by the CV and CA models (1)-(3). The resulting state-space model expressed in North-East coordinates iṡ Subjected to (2) where w 1 and w 2 are Gaussian white-noise process noise. Two small constants α 1 ≥ 0 and α 2 ≥ 0 have been added to the model to ensure that U and ω χ converge to zero during stationkeeping. Equations (13) and (14) are referred to as Singer models [9] in the target-tracking community (Li and Jilkov [4]).
The GNSS measurement equations associated with (11)-(14) are where ε 1 and ε 2 are Gaussian white-noise measurement noise. For the speed Equation (13), simulation studies revealed that the CV model with the Singer modification α 1 = 0.01 was most accurate for USVs since the speed is nearly-constant most of the time, i.e., small linear accelerations. Turning was accurately described by using the CA model with α 2 = 0.1. This gave satisfactory course rate estimates. The discrete-time representation of (11)- (14) is obtained by Euler's method where h is used to denote the sampling time. The discrete-time measurement equations are Consequently, the discrete-time state-space model becomes where The Jacobians are The resulting EKF algorithm (see Brown and Hwang [10]) is summarized in Table 1 where Five-State EKF: Latitude and Longitude Measurements GNSS receivers output latitude, µ, longitude, l, and elevation, h, using the World Geodetic System (WGS-84) ellipsoid as reference system [11]. For vehicles operating on the sea surface, we chose the height above the reference geoid as h = 0. The coordinate origin is conveniently fixed at a point on Earth's surface, specified by its latitude and longitude pair (µ 0 , l 0 ). The Earth radius of curvature in the prime vertical, R N , and the radius of curvature in the meridian, R M , are (Farrell [2]), where r e = 6,378,137 m is the semi-minor axis (equatorial radius), and e = 0.0818 is the Earth eccentricity (WGS-84). Consequently, the latitude and longitude dynamics arė where v N and v E are the North-East velocities of the vehicle. The discrete-time EKF model for longitude and latitude are obtained by Euler's method Subjected to (19) Subjected to (20) Subjected to (21) The state-space representation is Subjected to (24) Subjected to (25) where The Jacobians are where and Subjected to (31)

USV Course Autopilot Design
The course angle dynamics can be approximated by a first-order model (Nomoto [12]) Subjected to (2) where T is the time constant in yaw, and K is implicitly defined by the ratio Here, I z is the moment of inertia, −Nṙ is the hydrodynamic added moment of inertia, τ N is the yaw moment, and d ω is a time-varying disturbance due to unmodeled dynamics and environmental disturbances. In practice, d ω will be a nearly constant drift term, which can be compensated by an integral controller. The Nomoto gain and time constants K and T, respectively, can be determined by a maneuvering test. e.g., a turning circle or a zigzag test (Fossen [1]). The course autopilot was chosen as a PID controller with reference feedforward where τ N is the commanded yaw moment, K p is the proportional gain, T d is the derivative time constant, and T i is the integral time constant. The course angular velocity tracking error is denoted byω The reference feedforward signal is chosen as where ω χ d andω χ d are the desired angular velocity and acceleration, respectively. The resulting closed-loop system is The PID controller gains can be determined by pole placement with ω n and ζ as design parameters. This gives The integrator time constant is chosen such that 1/T i = ω n /10. In other words, This guarantees that the tracking errorsχ andω χ converge exponentially to zero under the 118 assumption thatḋ ω = 0. Global exponential stability cannot be proven since the course angle 119 error is defined on [−π, π) and not R as shown by Bhat and Bernstein [15]. The reference feedforward signal was chosen as where ω χ d andω χ d are the desired angular velocity and acceleration, respectively. The resulting closed-loop system is The PID controller gains can be determined by pole placement with ω n and ζ as design parameters. This gives The integrator time constant was chosen such that 1/T i = ω n /10. In other words, This guarantees that the tracking errorsχ andω χ converge exponentially to zero under the assumption thatḋ ω = 0. Global exponential stability cannot be proven since the course angle error is defined on [−π, π) and not R as shown by Bhat and Bernstein [14].

Simulation Study of the Otter USV
In the simulation study, a mathematical model of the Maritime Robotics Otter USV, length L = 2.0 m, was used. The model is included in the Matlab MSS toolbox (Fossen and Perez [13]) as a function xdot = otter(x,n,mp,rp,V_c,beta_c) which returns the time derivative, xdot, of the state vector x = [u,v,w,p,q,r,x,y,z,phi,theta,psi]' The inputs are the left and right propeller shaft speeds n = [n1,n2]', the mass of the payload, m_p, the location of the payload, r_p = [x_p,y_p,z_p]', ocean current speed, V_c, and ocean current direction, beta_c. The toolbox also has a Simulink block for numerical integration of the m-file function.

Estimation of SOG, COG and Course Rate during Course Autopilot Control
In the simulation study, the five-state EKF in Section 3.1 was used to estimate the course angle and course rate, which are the feedback signals needed to implement the course autopilot (46). The filter sampling frequency was chosen as 50 Hz, while the GNSS position measurements were received at 5 Hz.
The MSS Otter USV model is controlled by two propellers with shaft speeds n 1 and n 2 in rad/s. The propellers produce a surge force τ X and a yaw moment τ N according to where l 1 = −0.395 m, l 2 = 0.395 m and k = 0.0111 kgm is the propeller gain. The operator specifies the desired force τ X in the surge direction, while the course autopilot (46) computes the desired yaw moment τ N . The control allocation problem is solved by applying the inverse mapping The Nomoto time and gain constants of the Otter USV were estimated to T = 1.0 s (56) The course autopilot system was implemented as Subjected to (46) where the controller gains are determined by (49)-(51) by specifying ζ = 1.0 and ω n = 1.5 rad/s. This yields Figure 4 shows the North-East positions during autopilot control. The propeller commands are shown in Figure 5 where the control allocation algorithm (53)-(55) was applied. Figure 6 clearly demonstrates that the EKF was able to estimate the unmeasured states U, χ, and ω χ quite accurately. The zoomed windows show the 5 Hz slow update rate of the filter (GNSS measurements frequency) compared to the 50 Hz sampling frequency of the predictor.

Experiments with the Mariner USV
In the first experiment, the Mariner USV was used. The geographical location is shown in Figure 7. The blue line indicates the traveled path in the Trondheim fjord, Norway. The experiments were performed in sea state 2 corresponding to wave amplitudes below 0.5 m. Latitude and longitude were measured using a u-blox NEO-M8Q GNSS receiver at 5 Hz [15], while the SOG and COG measurements were complementary measurements used to benchmark the EKF. The accuracy of the NEO-MQ8 in the horizontal plane was 2.5 m when using GPS/Glonass.
It should be noted that the GNSS values for SOG and COG were not validated. Hence, they do not represent groundtruth. Because of this, Figure 8 only shows the difference between the two algorithms. The GNSS receiver determines the distance between two fixes, and by using the time taken to travel this distance it can deduce its speed. The COG and SOG can therefore seem erratic under certain conditions. For example, when the USV was moving slowly through rough seas, the antenna moved from side to side as well as in the direction of the vehicle. In contrast, the EKF estimates were not affected by this.
The Kalman filter covariance matrices were chosen as Q d = diag{1 × 10 7 , 1 × 10 3 } and R d = 1 × 10 −8 diag{1, 1}. Figure 8 shows the performance of the five-state EKF. The EKF succeeded in estimating both the SOG and COG with good accuracy.

Experiments with the Otter USV
In the second experiment, the Otter USV was used. The USV's location is shown in Figure 9. The blue line indicates the traveled path, which is in the proximity of the Maritime Robotics main office in the Trondheim harbor, Norway. The experiments were performed in sea state 1 corresponding to wave amplitudes below 0.1 m. The Otter USV is a much smaller vehicle than the Mariner USV and it typically operates at very low speed (0-2 m/s). This is challenging for the state estimator since the course angle is not defined at zero speed. However, the EKF was stable even at zero speed thanks to the non-zero Singer constants α 1 and α 2 in the model. Latitude and longitude were measured using a u-blox NEO-M8Q GNSS receiver at 5 Hz [15], while the SOG and COG measurements were complementary measurements used to benchmark the EKF. The filter covariance matrices were chosen as Q d = 5 × 10 5 diag{1, 1} and R d = 1 × 10 −8 diag{1, 1}.
The experiment with the Otter USV was repeated, but, the second time, the vehicle was taken out of the harbor to operate in the middle of the Trondheim fjord. However, similar performance was achieved as seen from the plots in Figures 10 and 11. From this it can be concluded that the EKF works very well at forward speed while it reaches an arbitrary course angle at zero speed. This is expected since the course angle is not defined at zero speed.

Discussion
The experiments with the Otter and Mariner USV systems confirm that the COG, SOG, and course rate can be estimated from latitude and longitude measurements with great accuracy when the speed is above a certain threshold value (typically 0.5 m/s). The experiments also confirm that the speed estimates are less accurate close to zero speed. At zero speed the course angle is not defined. Hence, the course angle estimate will converge to an arbitrary angle in the interval [−π, π). However, the EKF is exponentially stable at zero speed thanks to the Singer constants in the filter.

Conclusions
The main result of the article is a five-state extended Kalman filter (EKF) aided by GNSS latitude-longitude measurements for efficient estimation of course over ground (COG), speed over ground (SOG), and course rate. This is of particular interest for unmanned surface vehicle (USV) systems equipped with low-cost navigation sensor suites. For such systems, a gyrocompass is too expensive compared to the cost of the vehicle. A magnetic compass is unreliable due to electromagnetic interference caused by propellers and thrusters. A dual-antenna GNSS system on the same receiver (RTK GNSS) is an alternative, but the operational reliability (number of dropouts) depends on the density of the reference-station network, number of available satellites, multipath, ionospheric disturbances, etc. Furthermore, it has been demonstrated that the five-state EKF can estimate the SOG, COG, and course rate of a USV quite accurately using a single low-cost u-blox GNSS receiver. It has also been shown that the state estimates can be used to implement course and path-following control systems onboard the USV. The performance of the five-state EKF has been experimentally verified by using navigational data from two commercial USV systems, the Otter and the Mariner USVs by Maritime Robotics, which were operated west of Trondheim, Norway. The results from the experiments demonstrated that the EKF could estimate all states from low-cost latitude-longitude measurements. f = [ ( 1/Rm ) * x_hat(3) * cos(x_hat (4)) ( 1/(Rn * cos(x_hat(1))) ) * x_hat(3) * sin(x_hat(4)) -alpha_1 * x_hat (3) x_hat(5) -alpha_2 * x_hat(5) ]; Ad = I5 + h_samp * ...