CPLUSGEARS
  • Blog
  • Projects and Papers
  • ROS/Gazebo Tutorial
    • Lesson 1: Set-up
    • Lesson 2: URDF and XACRO
    • Lesson 3: Robot Plugins
    • Lesson 4: Programming our Rover
    • Lesson 5: Adding a LIDAR
  • Contact
Lesson Purpose:
By the end of this lesson we want to:
  • Have Gazebo set up and working with ROS.
  • Be able to spawn a robot and control it.
  • Be able to send controls to a robot from another node.

Intro

For the purpose of this tutorial I'm going to assume that you are running the same setup as I am which is:
Ubuntu 16.04 LTS LTS (Xenial Xerus)
and
ROS Kinetic Kame  (http://wiki.ros.org/kinetic)

Other versions of linux and ROS should work, but some of the syntax and instructions in this might end up being Kinetic dependent.

I also recommend running through these tutorials at some point, since the goal of this is not to teach all of ROS or Gazebo, but just how to make a plugin to control a robot.
http://wiki.ros.org/ROS/Tutorials

I'll cover some of the material in those tutorials, but not all. But all of that material is pretty important for work in ROS.

Lesson 1: Set-Up

1. Make a Workspace
First things first we need a workspace to play around in, so lets go on and make one.
Full Tutorial by more qualified people
My handwavey tutorial:
Source your ROS:
$ source /opt/ros/kinetic/setup.bash
Go to where you want to make your workspace
$ mkdir -p WORKSPACE/src
$ cd WORKSPACE/
$ catkin_make
And now source your new workspace:
$ source devel/setup.bash

2. Get the Tutorial Package
cd into WORKSPACE/src
Clone the first tutorial package:
$ git clone https://github.com/wrbernardoni/robot_tutorial_1
cd into WORKSPACE/
$ catkin_make
$ source devel/setup.bash
cd into WORKSPACE/src/robot_tutorial_1
$ ./scripts/play.sh
Select the terminal window with the commands in it. Press w to begin moving forward, s to begin moving backwards, a and d to yaw, and q to set the desired velocities to 0.

Homework:
1. Create a controller program
1a -Create a C++ node that sends geometry/twist messages to the DES/DES/cmd, where DES is a string passed in by the argument line.
Send messages with linear.x ranging from -1 to 1, and angular.z from -1 to 1.
Either take a controller input or keyboard input and send it to the wheely_boi

1b -Create a shell script to 1) launch gazebo, 2) spawn in a wheely_boi, and 3) launch your created node

Reference Tutorial
Reference Answers:
  • Node: Look at /src/keyin.cc
  • Script: Look at /scripts/play.sh

2. Familiarize yourself with the files
Poke around in the package and the workspace, familiarize yourself with the structure of the package and the workspace. Particularly look at these files:
  • CMakeLists.txt
  • /scripts/play.sh
  • /src/keyin.cc
  • /plugin/wb_plugin.cc
For the plugin just skim it for now, we will come back to it later in more detail.

Next Lesson

  • Blog
  • Projects and Papers
  • ROS/Gazebo Tutorial
    • Lesson 1: Set-up
    • Lesson 2: URDF and XACRO
    • Lesson 3: Robot Plugins
    • Lesson 4: Programming our Rover
    • Lesson 5: Adding a LIDAR
  • Contact