Getting Started with Turtlebots

Before diving into the core of ROS, let’s see and practice on capabilities of ROS. We are going to simulate a Turtlebot Waffle Pi with and without the Open Manipulator on. Turtlebot Waffle Pi is a generic differential robot with 2 actuated wheels and one passive ball joint. It is the same model which you are supposed to use in your project.

In this lecture, we are going see how to visualize, control, simulate such a robot in the ROS environment as well as exploring the available data using the ready-to-use turtlebot packages.

Theme (Lab4)

  1. Turtlebot tutorials

  2. ROS

  3. Turtlebot

  4. Bringups

  5. Get familiar

Equipment (Lab4)

  1. PC with ROS installed

  2. Turtelbot tutorials from robotis.com

Before the lab (Lab4)

  1. Install ROS.

  2. Try to get together in a group of 2-4 people.

  3. To use a real turtlebot, find your way to the HVL Robotics lab.

Report (Lab4)

There is no need to hand in a report after this lab.

Signed attendance will suffice as approved lab exercise.

Optional: Installation instructions

Note

The Turtlebot packages are already installed in the VM copy provided to you. However, for those who used a different installation method (for example dual boot, or your own VM) below are the basic instructions for installing the necessary packages.

How to install on ROS Melodic:

sudo apt-get install ros-melodic-dynamixel-sdk
sudo apt-get install ros-melodic-turtlebot3-msgs
sudo apt-get install ros-melodic-turtlebot3

cd ~/catkin_ws/src
git clone https://github.com/ROBOTIS-GIT/turtlebot3_manipulation.git
git clone https://github.com/ROBOTIS-GIT/turtlebot3_manipulation_simulations.git
git clone https://github.com/ROBOTIS-GIT/open_manipulator_dependencies.git
git clone https://github.com/ROBOTIS-GIT/dynamixel-workbench.git
git clone https://github.com/ROBOTIS-GIT/dynamixel-workbench-msgs.git

cd ..
rosdep install --from-paths src --ignore-src -r -y
catkin_make
source devel/setup.bash

Note that in general, the following packages are available for the Turtlebots (TB) and Open Manipulator (OM), depending on your exact model and needs:

Simulation

This lab is done with simulation. Using a real robot is later.

See simulation tutorial.

Simulations in ROS are done by both RViz and Gazebo. These are not interchangable. Rviz is a ROS package for visualization purposes. On the other hand, Gazebo is a simulation environment with physical properties with gravity, lights/shadows, collisions, mass etc. Gazebo simulations can be considered as real robot since it requires Gazebo ROS control.

Turtlebot with RViz

../_images/tb_rviz.png

Turtlebot in Rviz

  1. Run the command: roslaunch turtlebot3_bringup turtlebot3_model.launch

  2. Fiddle with the joint state publisher gui.

Note

You can run Rviz standalone with rosrun rviz rviz and load the desired tools on the left bar.

Turtlebot with Gazebo

../_images/tb_gazebo.png

Turtlebot in Gazebo

  1. Run the command: roslaunch turtlebot3_gazebo turtlebot3_empty_world.launch

  2. Navigate in Gazebo tools.

Note

You can run gazebo as a ROS node with rosrun gazebo_ros gazebo or as standalone software by simply typing gazebo in the terminal. Please see the difference between these two commands. One starts a node which can communicate by other ROS nodes. The other one starts a standalone Gazebo software which can be used seperately than ROS.

You can check the difference by checking which ROS nodes are running by rosrun rqt_graph rqt_graph or just listing available ROS nodes by rosnode list. There will be no Gazebo related ROS node with gazebo terminal command but a node named /gazebo with rosrun gazebo_ros gazebo ROS command.

Turtlebot Control

When you launch the Gazebo simulated robot, there are several nodes started and those nodes publish/subscribe topics.

../_images/rostopic-list.png

Available topics

  1. Run the command: roslaunch turtlebot3_gazebo turtlebot3_empty_world.launch

  2. See which nodes and topics are available:

    1. rosnode list

    2. rostopic list

    3. rostopic info /joint_states

    4. rostopic echo /joint_states

Normally, you can control wheel joints by publishing /joint_states topic in Rviz. However, to control a real robot you need a controller. There are various ways in achieving it in Gazebo but for this tutorial we have an already set teleoperation package which enables sending velocity commands to the robot by PC keyboard.

  1. Run the command: roslaunch turtlebot3_teleop turtlebot3_teleop_key.launch

  2. Use W-A-S-D to control the robot speed

  3. Check the available nodes: rosrun rqt_graph rqt_graph

  4. Chech the message in /cmd_vel with the command rostopic echo /cmd_vel

  5. Get info about the topic rostopic info /cmd_vel

  6. See what features have the rosmsg info geometry_msgs/Twist

  7. Kill the teleoperation launcher with Ctrl+C.

  8. Control the robot velocity by publishing /cmd_vel via terminal (Use Tab auto completion):

    rostopic pub cmd_vel geometry_msgs/Twist "linear:
    x: 0.0
    y: 0.0
    z: 0.0
    angular:
    x: 0.0
    y: 0.0
    z: 2.0"
    

Only TB:

In Gazebo:

roslaunch turtlebot3_gazebo turtlebot3_empty_world.launch
roslaunch turtlebot3_teleop turtlebot3_teleop_key.launch

Only OM with JointPositionController:

roslaunch open_manipulator_with_tb3_gazebo empty_world.launch
rostopic pub /om_with_tb3/joint1_position/command std_msgs/Float64 "data: 0.5"

Only OM with Moveit:

roslaunch open_manipulator_gazebo open_manipulator_gazebo.launch
roslaunch open_manipulator_controller open_manipulator_controller.launch use_platform:=false use_moveit:=true

TB+OM with Moveit:

Exercise Can you control both Turtlebot and the Open Manipulator? Start here:

roslaunch open_manipulator_with_tb3_gazebo empty_world.launch

Turtlebot Retrieve Sensor Data

Most of the time there are various sensors on the robot where we get information about the robot state (battery percentage, speed, acceleration, encoder readings etc.) or about the environment (magnetization, obstacle distance, etc). For all these, we equip robots with necessary sensors.

On the real TurtleBot Waffle Pi and on the Gazebo simulated version, there are inertial measurement unit, encoder, camera and LIDAR where we can collect some data.

Let’s visualize the surrounding of the turtlebot.

../_images/turtlebot-gazebo-camera.png

Turtlebot Gazebo retrieve camera data

  1. Start the Gazebo robot in a different environment this time: roslaunch turtlebot3_gazebo turtlebot3_world.launch

  2. Start the Rviz to visualize sensor data: roslaunch turtlebot3_gazebo turtlebot3_gazebo_rviz.launch #. Observe the red laser dots. #. Activate camera (select the checkmark)

  3. Start teleoperation and navigate: roslaunch turtlebot3_teleop turtlebot3_teleop_key.launch

  4. Observe active nodes and topics.

Questions (Lab4)

  1. What is the Turtlebot3 Waffle Pi?

  2. What is Rviz?

  3. What is Gazebo?

  4. What is a key difference between RViz and Gazebo?

  5. How can you see running nodes?

  6. How can you see available topics?

  7. How can you see the message type of a topic?

  8. Bonus: How can you see that topics are published/subscribed by a ROS node?