Page tree
Skip to end of metadata
Go to start of metadata

THIS PAGE IS DEPRECATED - PRESERVED FOR HISTORICAL PURPOSES.

Introduction

Basic operation of the Kingfisher USV in the Gazebo simulation environment requires 

  1. A physical description of the USV - supplied by the ros-indigo-kingfisher-description package
  2. A Gazebo Plugin to define the dynamics of the USV - 

The problem is that plugin libraries (compiled binaries) available from Clearpath robotics are for older versions of ROS (Hydro) and Gazebo (1.9).

Prerequisites

We assume that you are using the NPS ROS development environment: Ubuntu 14.04 and ROS Indigo

You should have the following packages installed

  • ros-indigo-kingfisher-description: provides the URDF description of the shape and size of the USV
  • ros-indigo-kingfisher-msgs: defines the kingfisher-specific ROS messages - including the "cmd_drive" message type used to command the USV.
  • ros-indigo-hector-gazebo-plugins: defines the IMU and GPS simulators as plugins to Gazebo
sudo apt-get install ros-indigo-kingfisher-description ros-indigo-kingfisher-msgs ros-indigo-hector-gazebo-plugins

Gazebo Plugin: Kingfisher Dynamics (USV Model)

The dynamic model of the USV is defined in the Gazebo plugin.  This C++ program is included in the kingfisher_plugins ROS package  (https://gitlab.nps.edu/bsbingha/kingfisher_plugins) in the src/kingfisher_plugin.cpp source file.  Currently there are two ways to get and use this plugin (in the future we hope to have an Ubuntu package):

  1. Use the pre-compiled shared library file and install it by hand.
  2. Build the library file from the source code in the git repository.  

Both option are described below

Option 1: Using Pre-Compiled Plugin

Still working on this and need to test

Option 2: Building the Gazebo Plugin from Source

We will need to compile the Gazebo plugin for this updated version of ROS/Gazebo.  

Git a working copy of the plugin source from https://gitlab.nps.edu/bsbingha/kingfisher_plugins and place it in your catkin workspace by doing the following 

cd ~/catkin_ws/src
git clone git@gitlab.nps.edu:bsbingha/kingfisher_plugins.git
OR
git clone https://gitlab.nps.edu/bsbingha/kingfisher_plugins.git

Now we'll need to compile the source code.  The Gazebo plugin that defines the dynamics is defined in kingfisher_plugin/src/kingfisher_plugin.cpp

cd ~/catkin_ws
catkin_make

With any luck the project will build without errors and you will see something like this...

Notice the lines in green and red which are encouraging signs that the library was build.  If you look in ~/catckin_ws/devel/lib/ you should see the file libkingfisher_gazebo_plugins.so which is the compiled library that will be used by Gazebo

Launching a Kingfisher in Gazebo

We will use a separate ROS package to create an instance of the model and plugin - this is referred to as spawning the model.  Git the kingfisher_gazebo package (https://gitlab.nps.edu/bsbingha/kingfisher_gazebo)  from gitlab...

cd ~/catkin_ws/src
git clone git@gitlab.nps.edu:bsbingha/kingfisher_gazebo.git
OR
git clone https://gitlab.nps.edu/bsbingha/kingfisher_gazebo.git
 
cd ~/catkin_ws
catkin_make
source ~/catkin_ws/devel/setup.sh

Now we should be able to use a launch file to do the following...

  1. Start Gazebo
  2. Load the URDF description of the Kingfisher in the parameter server.  This includes our Gazebo plugin to define the dynamics
  3. Start the robot_state_publisher node
  4. Spawn the Kingfisher within Gazebo
roslaunch kingfisher_gazebo base_gazebo.launch

If successful you should see something like this...

Note: Sensor Simulation - IMU and GPS

Two Gazebo plugins are used to define the simulation of sensor data: hector_gazebo_ros_imu and hector_gazebo_ros_gps.  The parameters of these values are currently defined in the base.urdl.xacro file (in the kingfisher_gazebo git repository).  It is a bit problematic that the parameters are defined inside the same file that defines the physical model - they should probably be moved to a separate xacro file and or defined as xacro parameters so that they can be defined in the launch file or a yaml config file.

Troubleshooting

Failed to load plugin

Verified that the libkingfisher_gazebo_plugin.so was created and is in catkin_ws/devel/lib  (where catkin puts our compiled library).

Reading the error above, it turned out there was an older version of libkingfisher_gazebo_plugins.so in the directory /usr/lib/x86_64-linux-gnu/gazebo-2.2/plugins.  Using ldd I determined that this older version was linked to shared libraries not on the machine.  I moved the older version to a different name...

sudo mv libkingfisher_gazebo_plugins.so oldlibkingfisher_gazebo_plugins.so

so that Gazebo would use the version in catkin_ws/devel/lib.  Then things worked!

 

 

  • No labels