Short-term ASV Collision Avoidance with Static and Moving Obstacles

This article considers collision avoidance (COLAV) for both static and moving obstacles using the branching-course model predictive control (BC-MPC) algorithm, which is designed for use by autonomous surface vehicles (ASVs). The BC-MPC algorithm originally only considered COLAV of moving obstacles, so in order to make the algorithm also be able to avoid static obstacles, we introduce an extra term in the objective function based on an occupancy grid. In addition, other improvements are made to the algorithm resulting in trajectories with less wobbling. The modified algorithm is verified through full-scale experiments in the Trondheimsfjord in Norway with both virtual static obstacles and a physical moving obstacle. A radar-based tracking system is used to detect and track the moving obstacle, which enables the algorithm to avoid obstacles without depending on vessel-to-vessel communication. The experiments show that the algorithm is able to simultaneously avoid both static and moving obstacles, while providing clear and readily observable maneuvers. The BC-MPC algorithm is compliant with rules 8, 13 and 17 of the the International Regulations for Preventing Collisions at Sea (COLREGs), and favors maneuvers following rules 14 and 15.


Introduction
All parts of society are currently being automated at a rapid pace. One example is the development of autonomous cars, as exemplified by the development efforts made by e.g. Tesla, Google and Uber. Such a trend is also ongoing in the maritime domain, where autonomous technology presents opportunities for increased cost efficiency, in addition to reducing the environmental impact of goods and passenger transport. One example of this is the Yara Birkeland project in Norway, where an electrically-powered autonomous cargo ship will replace 40000 diesel-powered truckloads of fertilizer each year by 2022 (Paris, 2017). Furthermore, it is reported that in excess of 75% of maritime accidents are caused by human errors (Chauvin, 2011;Levander, 2017), which also reveals a potential for increased safety by introducing autonomous technology at sea. Employing ASVs in areas where other vessels are present does, however, require a robust COLAV system in order to avoid collisions and operate safely.
There exists several algorithms for ASV COLAV, e.g. the velocity obstacle (VO) algorithm (Kuwata et al., 2014), the A* algorithm (Schuster et al., 2014) and algorithms based on model predictive control (MPC) and optimization (Benjamin et al., 2006;Švec et al., 2013;Abdelaal and Hahn, 2016;Hagen et al., 2018). These algorithms are, however, designed with the idea of "one size fits all", where the same algorithm is used to solve both situations requiring proactive and reactive behaviors. A challenge Figure 1: A hybrid architecture with three layers. The support functions provide relevant information for the COLAV algorithms, including prediction of obstacle trajectories, static obstacles from electronic nautical charts (ENC) and situational awareness in the form of COLREGs situations.
with this approach is that the algorithm must be able to solve problems of a wide range sufficiently well, which makes the algorithm difficult to design and tune. A different approach is to utilize a hybrid architecture (Loe, 2008;Casalino et al., 2009), where the complementary strengths of different algorithms can be combined in a layered architecture. An example of a hybrid architecture is shown in Figure 1, where the COLAV system is divided into three layers, namely a high-level, mid-level and a short-term COLAV algorithm. The high-level planner performs longterm planning by finding a path or trajectory from an initial position to a goal position while being able to avoid static obstacles, satisfy time constraints and minimize energy consumption. The mid-level algorithm attempts to follow the planned path or trajectory from the high-level planner, while making local modifications in order to avoid moving obstacles. This algorithm should be designed to comply with the maneuvering rules of the COLREGs, which dictates how vessels should behave in situations where there exists a risk of collision with other vessels (Cockcroft and Lameijer, 2004). The short-term COLAV algorithm inputs the modified trajectory from the mid-level algorithm, and should have low computational requirements ensuring that the COLAV system can react to sudden changes in the environment. This algorithm should also serve as a final safety barrier in situations where e.g. the mid-level algorithm fails to find a solution (Eriksen and Breivik, 2017b). In addition, the short-term algorithm should have a shorter planning horizon than the mid-level algorithm, making it inherently capable of handling situations where the COLREGs may require ignoring the maneuvering aspects of rules 14 and 15 when moving obstacles do not comply with the COLREGs. The algorithm should, however, maneuver in accordance with rules 14 and 15 when the situation allows it.
The authors have performed a significant amount of work on the hybrid architecture in Figure 1, concerning e.g. model-based vessel controllers Breivik, 2017a, 2018), short-term COLAV (Eriksen et al., , 2019b, mid-level COLAV (Eriksen and Breivik, 2017b) and a high-level planner interfaced to the mid-level algorithm (Bitar et al., 2019). In an upcoming article (Eriksen et al., 2019a), we populate the hybrid architecture with algorithms including the BC-MPC algorithm discussed in this article, and demonstrate COLAV compliant with COLREGs rules 8 and 13-17 in simulations. Work has also been performed on obstacle trajectory prediction (Hexeberg et al., 2017;Dalsnes et al., 2018). For the shortterm COLAV layer, we initially focused on the dynamic window (DW) algorithm, using a radar-based tracking system for detecting and tracking obstacles (Wilthil et al., 2017). The reason for using exteroceptive sensors such as radars for detecting obstacles is that they do not depend on vessel-to-vessel communication or collaboration with other vessels, hence enabling avoidance of vessels which do not have or use automatic identification system (AIS) transponders. Another questionable aspect of AIS is that other vessels may provide incorrect information (Harati-Mokhtari et al., 2007), which can be difficult to detect and handle. However, there is a fair amount of noise on obstacle estimates originating from systems using exteroceptive sensors, which the DW algorithm was shown not to handle sufficiently well in full-scale experiments . We therefore developed the BC-MPC algorithm for short-term COLAV (Eriksen et al., 2019b), which is based on MPC and designed to be robust to obstacle estimate noise. This algorithm is shown to have good performance in full-scale experiments, but originally only accounts for moving obstacles.
In this article, we further develop the BC-MPC algorithm to also handle avoidance of static obstacles in addition to moving obstacles, as well as producing trajectories with less wobbling. The modified algorithm is verified in full-scale experiments in Trondheimsfjorden, Norway, showing good performance. The experiments are performed with virtual static obstacles, while a moving obstacle is detected and tracked using a radar, not depending on vessel-to-vessel communication.
The rest of this article is organized as follows: Section 2 presents the BC-MPC algorithm and the modifications we do to it, Section 3 presents the experimental setup and results, while Section 4 concludes the article and points to possibilities for further work.

The BC-MPC algorithm
The BC-MPC algorithm (Eriksen et al., 2019b) is a COLAV algorithm designed using sample-based MPC, intended for short-term COLAV for ASVs. Sample-based MPC algorithms are based on computing an objective function over a finite discrete search space and selecting the optimized solution, rather than utilizing search algorithms as in gradient-based algorithms. A benefit of sample-based algorithms is that they do not have problems with solving highly nonlinear and non-convex problems, which in general is difficult for gradient-based algorithms. This makes sample-based algorithms well suited for use in the short-term layer in Figure 1. Furthermore, the BC-MPC algorithm is designed to be robust with respect to noisy obstacle estimates, which is a significant source of disturbance when using exteroceptive sensors such as radars for detecting and tracking obstacles.
With respect to the COLREGs, the BC-MPC algorithm complies with rules 8, 13 and 17, and favors maneuvers following rules 14 and 15. In cases where the algorithm chooses to ignore the maneuvering aspects of rules 14 and 15, which can be required when rule 17 revokes a stand-on obligation, the maneuvers have an extended clearance to obstacles.
At each iteration, the algorithm computes a search space consisting of a finite number of possible trajectories, which each contains a sequence of maneuvers. Given this search space, an objective function is computed on the trajectories, and the optimized trajectory is selected and used as the reference to the vessel controllers which control the speed over ground (SOG) and course. The algorithm is based on MPC, hence only the first part of the optimized trajectory is used before a new solution is computed and implemented.
This section presents an overview of the BC-MPC algorithm. Interested readers are referred to Eriksen et al. (2019b) for more details on the algorithm. In addition, this section presents modifications enabling the algorithm to perform static obstacle avoidance and produce trajectories with less wobbling than the original algorithm.

Trajectory generation
At each iteration, a new finite search space of possible trajectories is generated. Every trajectory contains a number of sub-trajectories, each containing one maneuver. This naturally forms a tree structure, with the nodes representing vessel configurations and edges representing maneuvers. The initial condition is used as the root node, and the depth of the tree is equal to the number of maneuvers in each trajectory.
The trajectory generation is performed by a repeatable maneuver-generation procedure, which when given a vessel configuration computes a set of sub-trajectories each containing one maneuver. Piecewise linear acceleration profiles in speed and course serve as a template for the maneuvers. An example of 5 motion primitives based on the acceleration profiles in speed and course is shown in Figure 2. The acceleration profiles are dependent on the step time length (the maneuver time length) T > 0, the ramp time T ramp ∈ (0, min( T U 2 , T χ 4 )] and the speed and course maneuver lengths, T U , T χ ∈ (0, T], respectively. Given a current vessel velocity, the maximum and minimum speed and course accelerations U max , U min , r max and r min are computed using a vessel model. To improve the convergence properties of the algorithm, we employ a guidance function which can modify some of the trajectories in the search space. This is done by moving the closest acceleration sample in speed and course to a desired acceleration generated by the guidance function, if this is inside the feasible acceleration region. Tχ − Tramp Tχ − 2Tramp (b) Course acceleration motion primitives. Figure 2: Acceleration motion primitives, where T is the step time, T r amp denotes the ramp time, while T U and T χ are the SOG and course maneuver time lengths, respectively. The symbols U max , U min , r max and r min denote the acceleration limits of the vessel at the initial vessel state.
Desired speed and course trajectories U d (t) and χ d (t) are generated by analytically integrating the acceleration motion primitives. Numerical examples of 5 speed and 5 course trajectories are shown in figures 3 and 4. It should be noted that these trajectories are intended as reference trajectories for the vessel controllers, hence they are initiated in an open-loop fashion with the current desired speed and course in order to ensure continuous references for the vessel controllers. The desired speed and course trajectories are joined together in a union set of desired velocity trajectories: resulting in a total of N U · N χ desired velocity trajectories where N U ∈ Z + and N χ ∈ Z + are the number of speed and course motion primitives. To include feedback in the trajectory generation, we use an error model of the vessel to generate feedback-corrected speed and course trajectoriesŪ d (t) andχ d (t), which similarly as in (1) is combined in a setŪ d . The feedback-corrected speed and course trajectories are used to generate feedback-corrected predicted pose trajectories: whereη(t;Ū(t),χ(t)) denotes a kinematic simulation procedure to obtain the vessel pose. A full trajectory search space is created by first generating a set of sub-trajectories by using the maneuvergeneration procedure initialized with the initial vehicle pose. At this stage, the prediction tree has a depth of one with the initial vessel pose as the root node and a set of leaf nodes each reached by one maneuver. Following this, we append the trajectories with another maneuver by repeating the maneuver-generation procedure, initialized on each of the leaf nodes, which increases the depth of the trajectory prediction tree with one level. This is repeated until the trajectory prediction tree has the desired depth, i.e. each trajectory has the desired number of maneuvers. This concept is illustrated in Figure 5. The acceleration profile parameters and number of speed and course motion primitives can be level-dependent, which allows for shaping the maneuvers differently and avoiding exponential growth with the number of levels. To reduce the complexity in tuning the algorithm, we use the same ramp time T ramp and speed and course maneuver lengths A set of feedback-corrected predicted pose trajectories for a trajectory generation with B = 3 levels is shown in Figure 6. The ramp time is T ramp = 1 s, and the speed and course maneuver lengths are T U = T χ = 5 s. The step time lengths are T = [20, 30, 30] s, and the number of speed and course maneuvers are N U = [1, 1, 1] and N χ = [5, 3, 3].

Selecting the optimized trajectory
Given a search space of vessel trajectories and a desired trajectory p d (t) ∈ R 2 , we solve an optimization problem to find the optimized desired velocity trajectory u * Level 0 Level 1 Level 2 Figure 5: Illustration of a trajectory prediction tree with two levels. The red node is the root node containing the initial vessel configuration. Other colors group nodes and edges associated with each maneuver-generation procedure, which generate three maneuvers each time (given by combinations of N U and N χ satisfying N U · N χ = 3). The tree contains a total of nine trajectories, each consisting of two sub-trajectories.
The objective function is given as: where w al , w av,m , w av,s , w t,U , w t, χ > 0 are tuning parameters.
The align(·) function assigns a value to following the desired trajectory p d (t). The avoid m (·) function assigns a cost to traveling close to moving obstacles, which depends on the distance to an obstacle for each point on the predicted trajectories. The maneuvering rules in the COLREGs, rules 13-15, require the vessel to maneuver to starboard in head-on situations, and recommend to pass behind an obstacle if the obstacle approaches from the starboard side. To motivate the algorithm to follow these rules, while being free to ignore the specific maneuvering aspects if required in situations where the other vessel violates the COLREGs, we use the obstacle regions in Figure 7 when calculating this cost. The regions can be interpreted as follows: the margin region is allowable to enter, the safety region is not desirable to enter, while the collision region should not be entered. Notice that the algorithm will require a larger clearance in situations where the maneuvering rules in the COLREGs are ignored, e.g. if maneuvering to port in a head-on situation. See Eriksen In this article, we introduce the avoid s (·), tran U (·) and tran χ (·) terms. The avoid s (·) term assigns a cost to avoiding static obstacles, while tran U (·) and tran χ (·) are transitional cost terms increasing the robustness to noise. These terms will be discussed in detail in the following two sections.

Static obstacle avoidance
Static obstacles are modeled using an occupancy grid, which allows for easy representation of obstacles with arbitrary shapes like e.g. land and islands. In addition, static obstacles are padded with a decaying gradient to introduce some smoothness to the static obstacle avoidance function. Given an occupancy grid O( p) ∈ [0, 100] where O( p) = 100 and O( p) = 0 represents an occupied and empty cell, respectively, we define the static obstacle term as: where t 0 denotes the initial time andη(t) = p(t) ψ (t) .

Speed and course transitional costs
In order to improve the robustness to noise on obstacle estimates, transitional cost is included in the objective function, which penalizes changing the planned trajectory from iteration to iteration. In Eriksen et al. (2019b), a single transitional cost term is used, which introduces a cost if one selects a different speed and/or course than the one closest to the one selected in the previous iteration. Note that the trajectory prediction is based on sampling the possible acceleration of the vessel in the current iteration, which implies that the exact trajectory selected in the previous iteration may not exist in the current search space.
Here, it is proposed to split the transitional cost term into separate speed and course terms. This motivates the algorithm to not alter the course if the speed is changed and vice versa, which would not be the case when using a single transitional cost term. The transitional cost terms are defined as: denote the current desired velocity trajectory tracked by the vessel controllers, and T 1 is the step time of the first trajectory maneuver. The variables e U,min and e χ,min denote the minimum difference between the current desired velocity trajectory and the candidates:

Experimental results
The modified BC-MPC algorithm was tested in full-scale experiments in the Trondheimsfjord in Norway on the 27 th of September 2018. This section describes the experimental setup and presets results from the experiments.

Experimental setup
The experimental setup was similar to the setup reported in Eriksen et al. (2019b), using the Telemetron ASV from Maritime Robotics as the ownship and the Ocean Space Drone 1 (OSD1) from Kongsberg Seatex as the moving obstacle. In addition, virtual static obstacles, expanded with a padding radius, were used to emulate static obstacles. The padding radius was selected as 150 m in most of the experiments. Notice that this padding radius only relates to static obstacles and that safety margins for moving obstacles are enforced by the obstacle regions in Figure 7. The Telemetron ASV, shown in Figure 8, is a 26-foot highspeed ASV capable of speeds up to 18 m/s and equipped for both manned and unmanned operations. The OSD1, shown in Figure 9, is a modified offshore lifeboat with a  length of 12 m, and was steered at a constant speed of 5 knots during the experiments. The OSD1 played the role of a moving obstacle in the experiments, and was detected and tracked using a radar-based tracking system, which is discussed in detail in Wilthil et al. (2017) and Wilthil (2019). Both the BC-MPC algorithm and the radar tracking system was implemented using the Robot Operating System (ROS), and was run on a processing platform with an Intel® i7 3.4 GHz CPU running Ubuntu 16.04 Linux onboard the Telemetron ASV. See Table 1 for specifications on the Telemetron ASV and the sensor system. The BC-MPC algorithm was run at a rate of 0.2 Hz with the parameters in Table 2. At sea, vessels typically maneuver with large margins, making it safe to run the BC-MPC algorithm at this rate. Furthermore, the sample time of the radar is 2.5 s, which together with the dynamics of the tracking system algorithms results in the closed-loop time delay being dominated by the obstacle detection and tracking system. With the given tuning parameters, the BC-MPC algorithm has a runtime of approximately 0.4 s (including interfacing the radar tracking system), allowing for a higher rate if sensors providing faster updates are available. The tuning parameters are quite similar to the ones used in the original algorithm, with the exception of the first step time length, which is selected as 20 s instead of 5 s in Eriksen et al. (2019b). With this tuning, the algorithm plans for making one maneuver of 5 s at the current time and keeping a constant course until 20 s have passed, rather than planning to do a new maneuver after only 5 s. This represents a more "maritime" way to maneuver compared to performing rapid consecutive maneuvers, and the transitional cost terms will motivate the algorithm to keep a constant course rather than selecting a new planned maneuver. Notice, however, that the algorithm is still free to choose a new maneuver every 5 s, but the transitional cost terms will favor keeping constant speed and course. To avoid that the vessel controller limited the performance of the COLAV system, we used a model-based speed and course controller shown to have high performance for high-speed ASVs .
During the experiments, we tested four different scenarios: 1. A static-only scenario with two static obstacles.
2. A head-on situation with the OSD1 and four static obstacles.
3. A crossing situation with the OSD1 and one static obstacle.
4. An overtaking situation with the OSD1 and one static obstacle.
The desired speed of the Telemetron ASV was 5 m/s in all the scenarios, except the overtaking scenario where the desired speed was 8 m/s.

Scenario 1
Scenario 1 is shown in Figure 10. Here, two static obsta- cles block the desired trajectory, requiring the BC-MPC algorithm to circumvent the obstacles. This scenario may seem a bit unrealistic, since the high-level planner and midlevel COLAV algorithm should plan paths which avoid static obstacles. However, the BC-MPC algorithm must be able to avoid static obstacles in order to stay safe in situations where we deviate from the desired trajectory, e.g. when avoiding moving obstacles or in situations where the mid-level algorithm is unable to produce a solution. The ownship converges to the desired trajectory before avoiding the first static obstacle by maneuvering to starboard. It would probably have been better to maneuver to port, since this would avoid having to pass through the narrow channel between the first and the second obstacle. The BC-MPC algorithm does, however, have a limited planning horizon of 80 s with the current tuning parameters, which makes it unaware of the narrow channel when making the decision of maneuvering to starboard. Subsequently, the ownship converges towards the desired trajectory and passes the second obstacle by having a small distance to the desired trajectory, which resides slightly inside the padding region of the static obstacle. After passing the second obstacle, the ownship converges to the desired trajectory, before avoiding the first obstacle once again.

Scenario 2
Scenario 2 is a head-on situation where the desired trajectory goes through a narrow channel composed by two static obstacles, and the channel entry is blocked by the OSD1. In this scenario, the padding distance was selected as 50 m in order to create the narrow channel between the obstacles. As shown in Figure 11, the ownship avoids the OSD1 by maneuvering to starboard and hence complying with the COLREGs. Following this turn, the first static obstacle is passed on the east side. The ownship returns to the desired trajectory and travels through the channel composed by the two last static obstacles.

Scenario 3
Scenario 3, shown in Figure 12, is a crossing situation where the OSD1 approaches from the ownship's starboard side, requiring the ownship to give way to avoid collision according to the COLREGs. In addition, there is a static obstacle on the starboard side of the ownship, blocking the ownship from maneuvering to starboard early. In compliance with the COLREGs, the ownship performs a starboard maneuver in order to pass behind the OSD1, while passing close to the boundary of the static obstacle. When the OSD1 has been passed, the ownship slowly converges towards the desired trajectory. The reason for the slow convergence is that the cost that the transitional cost terms introduces is just too large for the algorithm to change to a trajectory with a faster convergence. This is sometimes observed, but does not compromise safety and is a subject of tuning the transitional cost weights w t,U and w t, χ .

Scenario 4
Scenario 4 is an overtaking situation where the ownship approaches the OSD1 from behind. To allow the vessel being overtaken to maneuver to starboard if it finds itself in a separate collision situation, the BC-MPC algorithm is designed to favor a port turn in overtaking situations. However, as shown in Figure 13, a static obstacle is blocking the port side of the obstacle, which makes the ownship pass the obstacle on its starboard side. As mentioned, the BC-MPC algorithm is designed to pass with a larger clearance if passing on the port side rather than the starboard side, which can be seen by comparing this scenario with Experiment 3 in (Eriksen et al., 2019b).

Experiment summary
The BC-MPC algorithm is able to avoid collisions in all the scenarios, while converging to the desired trajectory when it is not obstructed by obstacles. The resulting ownship trajectories are clear and generally show the intension of the BC-MPC algorithm. The ownship trajectories are, however, a bit wobbly when the algorithm traverses alongside static obstacles. The reason for this is that the trajectory search space consists of a finite number of trajectories, of which none may traverse exactly parallel to the static obstacle. This results in that the algorithm sometimes choose to "zig-zag" along static obstacles, as seen in Sce- In the usual case where the mid-level algorithm would recompute a collision-free trajectory circumventing the obstacles, the BC-MPC algorithm would however be able to traverse smoothly along the obstacles by following the desired trajectory. Also, due to algae growth on the hull, the vessel dynamics had changed quite a bit since the model-based vessel controller was tuned, which also contributed to wobbling in the form of course overshoots. As seen in Table 3, the ownship travels inside the padding region of the static obstacles. This is to be expected, since the objective function is only sensitive to the static obstacles when the trajectory resides inside of the padding region. Hence, the padding region and static avoidance weight w av,s should be selected such that a sufficient safety margin is achieved. A formulation with multiple regions with different gradients, as for moving obstacles, could make it easier to tune the algorithm to obtain a desired safety margin to static obstacles. The required distance to the moving obstacle is a bit more complex to discuss, since the obstacle regions sizes depend on the relative bearing. The ownship does, however, stay outside of the safety region in the head-on and crossing scenarios (scenarios 2 and 3), while we slightly enter the safety region in the overtaking scenario (Scenario 4).

Conclusion and further work
In this article, we have presented two modifications to the BC-MPC algorithm for ASV COLAV. The first modification allows the algorithm to avoid static obstacles in the form of an occupancy grid. The second modification concerns improved transitional cost terms by introducing transitional cost in speed and course separately, motivating the algorithm to not change the course if the speed is changed and vice versa. In addition, the algorithm tuning has been changed in order to obtain more "maritime" maneuvers and better utilize the transitional cost terms. The modified BC-MPC algorithm is tested in full-scale experiments in the Trondheimsfjord in Norway. A moving obstacle is detected and tracked using a radar-based system, while virtual static obstacles are added in the COLAV system. Four different scenarios were tested in experiments, all of which provided good results.
In Eriksen et al. (2019a), the authors have used the BC-MPC algorithm described in this article in a hybrid architecture, demonstrating COLAV compliant with COL-REGs rules 8 and 13-17 in simulations. In the future, we would like to perform an extensive simulation study of the BC-MPC algorithm, in order to analyze the algorithm's performance in greater detail.