Below is an example developed by Dr. Sean Kragelund for his Introduction to Unmanned Systems course. The example illustrates using Simulink to interface with ROS to implement feedback control of an unmanned surface vessel (USV).
To run the example, which is based on a Gazebo simulation, you will need the kingfisher_gazebo ROS package. Instructions for installing the simulation are at Gazebo Simulation of Kingfisher/Heron USV
Introduction
A good place to start would be our heading controller lab. This is the only one that I've verified on the actual Kingfisher robot. This uses PD control to drive the USV heading to a commanded heading, provided relative to NED coordinates. Please see the attached Simulink model. It subscribes to the /imu/data and /geonav_odom ROS topics, and publishes to the /cmd_drive topic to send thrust commands to the USV.
This version includes a PID controller for body-referenced forward velocity. It also exposes slider gains to tune the P and D gains used for heading control. And just for fun, it has a knob for setting the commanded heading and a slider gain for setting the commanded velocity. Users can run an infinite simulation and drive the boat around in Gazebo using these two interfaces.
To run the attached model:
- at Linux command prompt, type roslaunch kingfisher_gazebo elestero.launch and wait for Gazebo to start up and display the Kingfisher in the El Estero world
- in MATLAB, type rosinit
- in Simulink, run the simulation