Main Content

Collision Avoidance and Trajectory Tracking of a Marine Vessel

This example shows how a marine vessel follows a predefined trajectory while avoiding collision. This example shows comprehensive design of a marine vessel control system, including vessel dynamics modeling, trajectory following, advanced control algorithms, and scenario testing, and an intuitive interface. Use this system for applications such as autonomous navigation, maritime research, and offshore operations, where precise vessel control is essential for safety and efficiency.

The mathematical model in this example simulates the behavior of the wave disturbances that affect the marine vessel. The guidance, control, navigation, and collision avoidance algorithms are designed using Control System Toolbox™ and Stateflow®. Multiple scenarios simulate the situation of different marine vessels. Finally, the example demonstrates how the ego vehicle or the vessel under consideration creates its own path and follows the desired trajectory of the vessel. The term ego vehicle refers to the vehicle that contains the sensors that perceive the environment around the vehicle.

Marine Vessel Dynamics Design

Advanced dynamics are crucial to the stability and performance of a marine vessel, especially when it encounters varying payloads and environmental conditions. Vessel dynamics include factors like buoyancy, propulsion, and resistance, which must be carefully modeled and controlled.

To model the 6DOF dynamics of a marine vessel using Simulink®, consider how sea waves, hydrodynamics, and hydrostatics collectively influence the motion of the vessel. Treat these factors as additive disturbances. You can see the input to and output of the 6DOF model and the output of the model is shown in Input and Output Processing.

Load simulation data and open the autonomous surface vessel (ASV) model, 'ASVDemo.slx'.

openProject('MarineVessel/ASVDemoCuboid.prj');
open_system('ASVDemo.slx')

Dynamics Modeling

These dynamics encompass the movement of the vessel in six degrees of freedom: three linear (surge, sway, and heave) and three rotational (roll, pitch, and yaw).

Influencing Factors

Assume that the dynamics of the marine vessel are influenced by these factors:

  1. Sea Waves — The motion of the vessel is directly affected by the characteristics of the sea waves it encounters. These waves introduce time-varying forces and moments on the vessel.

  2. Hydrodynamics — Hydrodynamics is the study of fluid forces acting on the vessel as it moves through water. These forces, such as drag and lift, shapes the motion of the vessel.

  3. Hydrostatics Hydrostatic forces arise from the displacement of the vessel in water and affect its buoyancy. These forces are crucial for maintaining the equilibrium of the vessel.

Disturbances and Inputs

  • To accurately simulate the real-world behavior of the marine vessel, the combined effects of waves, hydrodynamics, and hydrostatics are treated as additive disturbances. These disturbances perturb the motion of the vessel and are essential for a realistic model.

  • The input to the 6DOF model represents the control inputs or external forces applied to the vessel. These inputs can include commands from the controller of the vessel, engine thrust, rudder angles, and other factors that influence the behavior of the vessel.

Input and Output Processing

  • The input to the 6DOF model is typically processed to ensure it meets the model's requirements and standards. This processing may involve filtering, scaling, or transformation to match the model's expectations.

  • The output of the model represents the motion of the vessel and is closely monitored for analysis and control purposes. It includes data on the position, velocity, acceleration, and orientation of the vessel in the six degrees of freedom.

  • Accurate processing of both input and output data is critical to ensure the model accurately represents the real-world behavior of the vessel and to enable effective control and analysis.

Controller

The controller provides guidance to the marine vessel through these five components.

Situational Awareness

  • The situational awareness component of the controller acquires sensor data from various onboard sensors, such as radar, sonar, GPS, and automatic identification system (AIS).

  • The collected sensor data is processed to create a real-time picture of the surroundings of the vessel. This data includes information about nearby vessels, navigational hazards, weather conditions, and the vessel position and status.

Planning

  • Stateflow™ diagrams describe the logic and decision-making processes that govern the behavior of the vessel in response to its environment. For example, the diagrams defines rules for when the ego vessel should make a left or right turn to avoid a potential collision with another vessel.

  • This planning system creates a safe and efficient route for the vessel.

Guidance

  • The guidance system uses control algorithms to calculate the desired yaw angle for the vessel. The objective is to steer the vessel to avoid collisions and adhere to the planned route.

  • The guidance system considers factors like the current speed of the vessel, the presence of nearby vessels, and the planned route to make these decisions.

Control

  • Speed control regulates the propulsion system of the vessel to achieve and maintain a desired speed, and heading control ensures that the vessel maintains the desired heading or course.

  • Mode transitions are integral to the control subsystem. These transitions are triggered based on commands from the ship's captain or the automation system and dictate how the vessel responds in different operational modes.

Navigation

  • The navigation component ensures that the vessel follows the prescribed route, adjusts its course to avoid collisions, and responds to changing environmental conditions.

Import and Create Scenarios

The scenario block in the model allows you to explore different scenarios for the vessels. These three predefined scenarios allow you to analyze different trajectories for the non-ego vessels.

Scenario 1

Load the first scenario and define the waypoints of the ego vessel.

load('Scenario_Cuboid_COLREGs_1_Crossing_Starboard_exported.mat');
waypoints_m = ... % [x y]
    [  0    0; ...
     150    0; ...
     200    0];

Validate the waypoints, and check if R_switch is smaller than the minimum distance between the waypoints.

if R_switch_m > min( sqrt( diff(waypoints_m(:,1)).^2 + diff(waypoints_m(:,2)).^2 ) )
    error("The distances between the waypoints must be larger than R_switch");
end 

Define the other simulation parameters and run the model.

StopTime = 130;
xlimits = [-150 110]; % For visualization of Scenario Scope block, East
ylimits = [-10 180];  % For visualization of Scenario Scope block, North

Scenario 2

Load the second scenario and define the waypoints of the ego vessel.

load('Scenario_Cuboid_COLREGs_2_Crossing_Starboard_Multiship_exported.mat');
waypoints_m = ... % [x y]
    [  0      0; ...
      60      0; ...
     150   -200;];

Validate the waypoints, and check if R_switch is smaller than the minimum distance between the waypoints.

if R_switch_m > min( sqrt( diff(waypoints_m(:,1)).^2 + diff(waypoints_m(:,2)).^2 ) )
    error("The distances between the waypoints must be larger than R_switch");
end 

Define other simulation parameters and run the model.

StopTime = 130;
xlimits = [-220 20]; % For visualization of Scenario Scope block, East
ylimits = [-60 180]; % For visualization of Scenario Scope block, North

Scenario 3

Load the third scenario and define the waypoints of the ego vessel.

load('Scenario_Cuboid_COLREGs_3_Crossing_Multiship_exported.mat');
waypoints_m = ... % [x y]
    [  0    0; ...
     150    0; ...
     200    0];

Validate the waypoints, and check if R_switch is smaller than the minimum distance between the waypoints.

if R_switch_m > min( sqrt( diff(waypoints_m(:,1)).^2 + diff(waypoints_m(:,2)).^2 ) )
    error("The distances between the waypoints must be larger than R_switch");
end

Define other simulation parameters and run the model.

StopTime = 130;
xlimits = [-130 200]; % For visualization of Scenario Scope block, East
ylimits = [-40 180];  % For visualization of Scenario Scope block, North

Design ASV Scenarios with Scenario Designer

You can design additional ASV scenarios using the Scenario Designer.

  1. Run this command to open the Scenario Designer.

uavScenarioDesigner

2. Click Open Session. Select one of the predefined scenarios.

3. Import the scenario to the workspace and save it within the application.

4. Navigate to the ASV Scenario Configuration block within Scenario.

5. Click the scenario you originally selected to further explore its configuration.

6. Run the simulation.

LondonCollidetraj.gif

Human and Machine Interface

The human-machine interface (HMI) block serves as the pivotal point of interaction between the captain of the vessel, and its control system. This block has these utilities:

Commanding Responsibilities:

The primary responsibility of the HMI block is to receive and process commands from the ship captain or designated operator. These commands typically pertain to these critical ship operations.

  • Start/Stop — The HMI block allows the captain to initiate or halt the vessel operations, such as starting the engines or bringing the vessel to a stop.

  • Heading Control — The captain can use the HMI block to specify the desired heading or direction in which the vessel should navigate.

  • Speed Control — Control over the speed is a crucial aspect of ship operations. The HMI block enables the captain to set and adjust the vessel speed as needed.

  • Thrust Control — For vessels with multiple propulsion systems or engines, the HMI block may also provide control over thrust levels for each propulsion unit.

  • Waypoint Navigation— The HMI block allows the captain to input waypoints or navigation points that define the intended route of the vessel.

Intuitive Interface:

The HMI block is designed with an intuitive interface to ensure that operators can easily input commands and make adjustments. The interface can include graphical elements, such as buttons, sliders, or touchscreens, to facilitate interaction. The design helps to minimize potential for errors when conveying commands to the vessel control system.

Communication with Control System:

Once the captain inputs commands through the HMI block, the block communicates these commands to the vessel's control system. For example, when you set a new heading, the HMI block triggers the control system to adjust the rudder or steering mechanism accordingly.

Safety Considerations

The HMI block implements safety features such as confirmation prompts and password authentication for critical commands, ensuring that only authorized personnel can perform certain actions.

Related Topics