Introduction

The Heron USV software has been undergoing a number of notable updates recently. One of the changes is a new simulator which utilizes Gazebo software. The control scheme and sensor processing on the simulated heron is performed in the same way on the actual Heron, meaning that any program run on the Heron can also be run on the simulator and vice versa.

So how does this work? The simulator relies on the UUV Simulator software package to compute the Heron’s water physics. This software package includes a variety of features including damping and buoyancy force computation, water currents, and numerous sensors often used in aquatic robotics. The simulated Heron comes with a GPS, front-facing laser, and an IMU by default and can support many other sensors, including sonars and cameras. Larger sensors, like a 2D LiDAR or a camera, are added to the robot model, including the sensor in the visualizations and physics calculations.

The simulator comes equipped with a set of pre-made terrains on which to test the Heron, including a lake, island, ocean, and harbour. Custom terrains are also supported, only requiring a 3D file representing the seabed and the coastline.

The Heron can be controlled using the RViz visualization software, the same way that other Clearpath robots are controlled. To allow for fleets of Herons, the simulator supports the simultaneous control and visualization of multiple vessels. Each specific Heron separately maintains its sensor and location processing (as in the real world) but they are sufficiently connected to be visualized together.

How to Use the Simulator

In this tutorial we’ll go through the steps needed to be able to see your Heron in Gazebo and move it around using rviz.

Installation

First, ensure you have a working installation of ROS and Gazebo 7. If you have ROS Kinetic, Gazebo 7 should already be installed. However if you have ROS Indigo, you may need to run the following command:

sudo apt-get install ros-indigo-gazebo7*

Next, install the following packages needed for the simulation: uuv_simulator, heron, and heron_controller. This can be done by going to the src folder in your catkin workspace, and cloning the packages from github. Ensure that the branch you are cloning from github matches the ROS distribution you have on your computer, such as kinetic or indigo:

cd ~/catkin_ws/src
git clone https://github.com/uuvsimulator/uuv_simulator
git clone https://github.com/heron/heron
git clone https://github.com/heron/heron_controller

While still in the src folder, install the heron_simulator package by running:

git clone https://github.com/heron/heron_simulator
cd ..
rosdep install --from-paths src --ignore-src --rosdistro=kinetic -yr

The following packages can be installed using the sudo apt-get command: heron_desktop, imu_tools.

sudo apt-get install ros-kinetic-heron-desktop
sudo apt-get install ros-kinetic-imu-tools

Finally, run the commands to build your workspace, and you’re ready to go:

cd ..
catkin_make

;

Launching Gazebo

Gazebo is used to simulate your Heron in the world, and includes approximations of its physics such as its buoyancy and inertia. To simulate Heron in Gazebo, run:

roslaunch heron_gazebo heron_world.launch

You should see a Gazebo window open displaying a Heron in the ocean, similar to this:

Using Rviz


Rviz is used to show your robot’s perception of the world. You can use it to manipulate your Heron both in Gazebo and in real life. To launch your robot in rviz, use:

roslaunch heron_viz view_robot.launch

An rviz window containing your heron should appear, as shown:

The arrows around the Heron are interactive markers, and can be used to move the Heron around. If these aren’t visible when you open rviz, click on the “Interact” option on the top left of the window. To move the Heron, click and drag the marker in the direction of the arrow. To change directions, click and rotate the blue circle around the Heron. Watch your Heron in Gazebo as you move it in rviz, it should be moving in Gazebo as well!

Next Steps


Check out the README.md file located in the heron_simulator package for more details on what else you can do with the Heron in Gazebo and rviz. You can learn how to launch Heron in Gazebo with different environments such as a lake or shipwreck, read about the hydrodynamic forces acting on Heron, and more.

To learn more about the Heron USV, click the banner below. Subscribe to our newsletter for more updates on all things robots!