Skip to content

Instantly share code, notes, and snippets.

@pvandervelde
Last active May 21, 2022 09:55
Show Gist options
  • Save pvandervelde/1477162fc4c933b56bbd7f9038483eab to your computer and use it in GitHub Desktop.
Save pvandervelde/1477162fc4c933b56bbd7f9038483eab to your computer and use it in GitHub Desktop.
Getting started with ROS and Gazebo for SCUTTLE

Running SCUTTLE in Gazebo

In order to run a virtual SCUTTLE in Gazebo you will first need to install ROS Noetic on Ubuntu 20.04. This can be a physical machine, e.g. a spare laptop or a VM. If you're building a VM you can follow these instructions to get a VM with ROS noetic installed. In all cases you want to make sure you have at least the following ROS packages (and their dependencies) installed.

  • ros-noetic-desktop-full
  • ros-noetic-catkin
  • ros-noetic-navigation
  • ros-noetic-robot
  • ros-noetic-tf2

The next step is to create a ROS workspace, which is essentially a directory with some specific subdirectories. You can create this directory anywhere and it can be called anything. For example mine is ~/ros_ws/scuttle.

mkdir -p <WORKSPACE_DIRECTORY_PATH>/src
cd <WORKSPACE_DIRECTORY_PATH>/src

In the src directory clone the following repositories.

You can do this by running the following command lines in a terminal. Make sure your current directory is the src directory.

git clone -b noetic https://github.com/scuttlerobot/scuttle_bringup.git
git clone -b noetic https://github.com/scuttlerobot/scuttle_description.git
git clone -b noetic https://github.com/scuttlerobot/scuttle_gazebo.git
git clone -b noetic https://github.com/scuttlerobot/scuttle_navigation.git
git clone -b noetic https://github.com/scuttlerobot/scuttle_slam.git
git clone -b indigo-devel https://github.com/scuttlerobot/teleop_twist_joy.git

The last package is optional and will only be useful if you have a way of getting the joystick commands into the ROS machine (which might be difficult with a VM).

Once you have cloned the repositories you need to 'build' the workspace. This is done by calling 'catkin', the ROS build system.

catkin_make

After running catkin_make once you can source the workspace setup file. This allows the ros commands to find your packages. Depending on the terminal you are using you can source the .bash file or the .zsh file.

source devel/setup.bash

or

source devel/setup.zsh

In the end you should have a ROS workspace that looks like this

<WORKSPACE_DIRECTORY>
    build
    devel
    src
        rplidar_ros
        scuttle_bringup
        scuttle_description
        scuttle_gazebo
        scuttle_navigation
        scuttle_slam
        teleop_twist_joy

In order to for ROS commands to work you will need to load a bunch of variables into your current terminal. You can either do that by manually sourcing the setup.bash or setup.zsh file in each terminal you open. Or you can add the source line to your .bashrc or .zshrc config files. Note that adding it to your bashrc or zshrc file means you can only have one ROS workspace.

Finally you can run Gazebo with the SCUTTLE model. The scuttle_gazebo repository has a number different worlds that you can use. Each world will load the SCUTTLE model into an environment with walls and obstacles. For the examples we'll use the empty room world, but you can pick any world you want.

To run the SCUTTLE model in Gazebo run the following command line

cd <WORKSPACE_DIRECTORY_PATH>
roslaunch scuttle_gazebo scuttle_empty_room.launch

This will start Gazebo with the SCUTTLE model. You can control the model by sending Twist messages. One way to do so is to use the teleop_twist_keyboard or the joystick. In a new terminal run

 rosrun teleop_twist_keyboard teleop_twist_keyboard.py

If you want to use navigation and SLAM you'll need to start rviz and the SLAM node. The navigation node (move_base) is included in the scuttle_gazebo launch files.

In a new terminal run

roslaunch scuttle_description rviz.launch

And in yet another terminal run

roslaunch scuttle_slam scuttle_slam.launch

At this stage you should have three therminals running, as well as both Gazebo and RViz. In the RViz application you can use the 2D Nav Goal button at the top to send a navigation goal to the navigation stack, which will move the SCUTTLE model. Once you have given the command your virtual SCUTTLE in Gazebo should start moving.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment