+1 (315) 557-6473 

How to Solve MATLAB Assignment on WAM-V Controller Design Using Simulink

July 09, 2025
Morgan Wilson
Morgan Wilson
United Kingdom
Matlab
Morgan Wilson holds a Master’s degree in Control Systems from Flinders University, Australia, and has over 9 years of experience in MATLAB and Simulink-based marine robotics projects.

In this blog, we will explore how to design and deploy a controller for an autonomous boat known as a Wave Adaptive Modular Vessel, or WAM-V, using Simulink. We will also cover how to interface Simulink with a simulation environment based on ROS2 and Gazebo, which is widely used for testing maritime robotics algorithms. If you are looking for help with a Simulink assignment, especially those involving control system design or robotics simulation, this guide will give you a hands-on approach to solving such tasks.

The WAM-V is a type of surface vehicle known for its excellent stability and maneuverability. Because of these features, WAM-Vs have become popular platforms for research and practical applications, including maritime robotics competitions. One such competition uses WAM-Vs and challenges participants to develop autonomous navigation and control algorithms in realistic ocean-like conditions. These competitions are difficult because factors such as wind, waves, and lighting conditions are highly unpredictable. This is where simulation environments become extremely helpful.

One powerful simulation environment replicates the conditions of such maritime competitions using Gazebo and ROS2. This virtual setup allows teams to develop, test, and deploy their control algorithms before trying them on real hardware. Not only does it save time and cost, but it also provides a safe platform to experiment with various approaches without the risks of real-world testing.

How to Solve MATLAB Assignment on WAM-V Controller Design Using Simulink

In this blog, we focus on creating a Pure Pursuit controller for the WAM-V model in Simulink. We explain the step-by-step process of connecting to the simulator, designing the controller, tuning parameters, and finally deploying the controller back to the simulation environment for testing.

Connecting Simulink to the Simulator Environment

Before diving into controller design, the first step is to establish communication between Simulink and the Gazebo-based simulator running the virtual WAM-V. The simulator publishes sensor data such as GPS and IMU information through ROS2 topics, and it also subscribes to control commands like thrust inputs for the vehicle's propellers.

To connect Simulink to the simulator:

  • Install the Gazebo-based simulation environment on your PC or virtual machine.
  • Open MATLAB on the same or a different machine connected on the same network.
  • Use ROS2 communication protocols within Simulink to subscribe to sensor data topics and publish control commands.
  • Confirm connectivity by listing available ROS topics and ensuring data is being exchanged properly.

By setting up this connection, Simulink models can access real-time data streams from the virtual boat and send commands back to control its motion.

Overview of the Simulink Model

The Simulink controller model for the WAM-V can be divided into four main parts:

  1. Subscriber (Sensing) – This block receives sensor data such as GPS coordinates and IMU readings.
  2. Navigation – It processes the current position and determines the path or waypoints the boat must follow.
  3. Control – Here, control algorithms like the Pure Pursuit controller calculate required velocity and angular commands.
  4. Publisher (Action) – This block sends calculated thrust commands to the vehicle’s actuators.

In this particular example, the waypoints for the path are hardcoded within the model for simplicity. In real applications, these waypoints would come from advanced path planning algorithms that dynamically adjust based on the environment or mission objectives.

Processing Sensor Data with ROS Subscriber and Publisher Blocks

The subscriber receives GPS and IMU messages published by the simulator. GPS data provides latitude, longitude, and altitude, which are converted into a local coordinate system called East-North-Up (ENU) for easier calculations. ENU is commonly used in robotics navigation because it represents positions in meters relative to a reference point.

The IMU data contains the orientation of the vehicle in quaternions, a mathematical representation that avoids singularities and gimbal lock. To use these values for navigation, the quaternions are converted to Euler angles, specifically focusing on the yaw angle, which represents heading or rotation about the vertical axis.

These pose estimates (position and heading) become inputs for the control algorithm to decide how the boat should move next.

On the publishing side, the model sends thrust commands to control the propellers. The typical configuration includes two propellers on the rear left and rear right sides of the vessel. The controller calculates thrust values based on desired linear and angular velocities. If your vessel uses a different propeller setup, the thrust calculations need to be adjusted accordingly, usually through inverse kinematics.

Pure Pursuit Controller for Navigation

The core of the control strategy is the Pure Pursuit algorithm, a path tracking method originally developed for ground robots. It calculates the steering angle and forward velocity necessary to guide the vehicle towards a series of waypoints.

The inputs to the Pure Pursuit block are:

  • Current position and heading of the boat
  • Target waypoint location

The controller outputs commands to move the boat from its current position to the goal position.

Key parameters of the Pure Pursuit controller include:

  • Desired linear velocity: This controls how fast the boat moves forward.
  • Maximum angular velocity: This limits how quickly the boat can turn.
  • Look-ahead distance: The distance ahead of the boat along the path at which the target waypoint is selected.

Choosing the right look-ahead distance is important for smooth navigation. A small look-ahead distance causes the boat to oscillate as it tries to correct its path too frequently. A larger look-ahead distance results in smoother turns but may cause the boat to cut corners.

For this model, the linear velocity is set to 0.3 meters per second, the maximum angular velocity to 0.4 radians per second, and the look-ahead distance to 5 meters. Additionally, a stopping threshold is implemented, so when the boat is within 1 meter of the goal waypoint, it stops by setting thrust to zero.

Calculating Thrust Commands

Once the controller computes the desired linear and angular velocities, these must be converted into thrust commands for the propellers.

With two fixed propellers on the rear left and right, the vehicle can be modeled similarly to a differential drive robot. To turn, one propeller provides positive thrust while the other provides negative thrust, creating a moment about the vertical axis.

The relationship between thrust and velocity was determined through experiments and is approximated as a linear proportionality. This simplifies the calculation of thrust values from velocity commands.

When the boat reaches the stopping threshold near the goal, both thrust outputs are set to zero to halt the vessel.

Analyzing Controller Performance

Simulink offers tools such as the Data Inspector to log and visualize signals during simulation. This helps evaluate how well the controller performs in following the waypoints.

For instance, the boat’s position over time can be plotted to see how closely it tracks the planned path. By experimenting with different look-ahead distances, the effect on path smoothness and oscillations becomes apparent.

A smaller look-ahead distance (e.g., 2.5 meters) may cause the boat to oscillate significantly, whereas a larger value (e.g., 5 meters) results in a smoother trajectory.

Fine-tuning these parameters is an iterative process, and Simulink’s visualization tools make it easier to analyze and optimize controller behavior.

Deploying the Controller as a ROS2 Node

Once the controller is designed and tested in Simulink, it can be automatically converted into executable code and deployed as a ROS2 node running in the simulation environment.

Steps to deploy include:

  • Configuring target hardware in Simulink to specify ROS2 as the communication protocol.
  • Entering network settings like IP address and credentials to connect to the simulation host.
  • Testing the connection between Simulink and the simulator.
  • Building and running the generated executable to upload the controller node.

This workflow allows you to move seamlessly from algorithm development to deployment without manually rewriting code, saving time and reducing errors.

Final Thoughts

Designing a controller for a Wave Adaptive Modular Vessel in Simulink demonstrates how powerful simulation and model-based design can be for autonomous marine vehicles. By subscribing to sensor data, implementing a navigation controller, converting velocity commands to actuator thrusts, and publishing control signals back to the simulator, you can rapidly develop and test complex control systems. Simulink’s tools for signal logging and data visualization facilitate iterative tuning, enabling you to optimize the controller’s performance efficiently.

Finally, the ability to generate and deploy ROS2 nodes directly from Simulink streamlines the transition from simulation to real-world applications or more advanced simulation setups. Though this example focused on a Pure Pursuit controller, the workflow is flexible and supports other control strategies such as PID or Model Predictive Control. You can swap the controller block in the model to try different algorithms without changing the rest of the system.

For students and researchers interested in marine robotics, practicing with these tools offers a strong foundation in autonomous vehicle control. Simulation environments provide safe and realistic conditions to develop skills before moving on to hardware experiments. If you are looking help with MATLAB assignment involving Simulink, ROS, or control system design, this example can serve as a useful reference for your projects. It demonstrates practical integration of robotics simulation and control system development, which are valuable skills in many engineering domains.


Comments
No comments yet be the first one to post a comment!
Post a comment