Minitask 0 - RobotTeaching/COMP4034 GitHub Wiki

This minitask aims to allow you to get to grips with ROS basics and to make sure you have a working simulation environment for practicing outside of the lab. For some, this step may take long, but don't despair. Just follow the Robotics Simulation Setup instructions and you should be good to go in no time. We suggest using an native Linux installation and ROS on your own computer (could be dual-boot) or using a virtual machine such as VirtualBox or Parallels Desktop.

Task 1: Reading

If you haven't already done, take a look at the useful resources, where you'll find information about ROS, Python and Git (we will use Gitlab throughout the module, so it's important to understand what it is). Also familiarise yourself with the module reading list. You can find an excerpt from "Effective Robotics Programming with ROS" by Mahtani et al. in Moodle, read Chapter 2.

Task 2: Linux and ROS Installation

Make sure Linux and ROS are installed following the Robotics Simulation Setup instructions. If you encounter issues during installation or setup, reach out to the support team sooner than later, as once we start the module will move on with a quick pace!

Help for Installing Linux:

  • We use Ubuntu 20.04LTS and ROS Noetic in this module - please do not install any other (i.e. newer) system, as our robots do not yet support those.
  • You can dualboot Ubuntu 20.04 alongside Windows/iOS
  • You can use VirtualBox to run Ubuntu as a guest OS inside Windows/iOS
  • You can use Windows Subsystem for Linux (WSL) and install Ubuntu 20.04.6 LTS and the Windows Terminal.

For those who are unfamiliar with Ubuntu, we will use the terminal most of the time. Take your time to get familiar with it. A good starting point is the official tutorial for beginners (skip the bit about adding a new user).

Here are some hints to make your life easier:

  • [Ctrl+C] will stop a currently running command
  • [Tab] is your best buddy that will auto-complete a partially typed file or command name in the terminal
  • [Up] and [Down] allow you to browse the history of previously typed commands
  • [Ctrl+R] will search your terminal history for a previously typed command
  • [Ctrl+Alt+T] will open a new terminal
  • [Ctrl+Shift+T] will open a tab within an existing terminal

Task 3: Beginning with ROS

Boot into your Linux and complete the Beginner Level ROS Tutorials #1-7.

  • Can you explain what is a topic and what is a node?

Task 4: Launch and Run Turtlebot3 Simulation using Gazebo

In the rest of the module, we will use Gazebo as our physics simulator and the RViz visualization software, which will allow you to view Gazebo data (and also real world data when you are working with a real robot). If you haven't done already, goto the Robotics Simulation Setup page and complete the steps for Turtlebot3 Simulation installation (skip if already done).

Since you don't have a real robot at home, we will run a simulated robot. Start an empty scene with a Turtlebot (yes this is the hello world of the simulation land...):

roslaunch turtlebot3_gazebo turtlebot3_empty_world.launch

Open a new terminal and examine the published topics using command rostopic list.

Now let's move our robot. Launch turtlebot3_teleop_key node for a keyboard-based teleoperation demo:

roslaunch turtlebot3_teleop turtlebot3_teleop_key.launch

This should result with a successful launch and give you the instructions to move your robot:

teleop_commands.png Note: whenever you start a new ROS node, use a new terminal or a new tab in your existing terminal!

Let's see how your odometry changes while moving the robot using command rostopic echo /odom.

  • Can you understand what are the elements of /odom, e.g. pose, twist?

Run an rqt_graph for visualising your topics and nodes.

  • What message is passed between turtlebot3_teleop_keyboard and gazebo?
  • Which topic could be responsible for the velocity command that drives the robot?

Now, let's examine the /cmd_vel topic: rostopic echo /cmd_vel

  • What do you think the linear and angular components of Twist denote?
  • Examine the Twist message type.
  • How do the values echoes for this topic compare with the messages you echoed for /odom?

Now close turtlebot3_teleop_keyboard node with Ctrl+C.

We will now use the rostopic pub command to move your robot. In order to do this, we will manually publish a Twist message to the /cmd_vel topic:

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

  • Do you understand all the parameters of the command?
  • Can you make your robot draw a square?

Task 5: Launch and Run RViz with Turtlebot3 Simulation using Gazebo

You can launch different world files in the turtlebot3_gazebo package to generate different environments (or you may create your own using existing models, such as the cube, sphere and cylinder in the toolbar in Gazebo). Close the previous gazebo instance (press X on the GUI or Control+C on the terminal) and let's stick to the TurtleBot3 World:

roslaunch turtlebot3_gazebo turtlebot3_world.launch

And execute RViz in a new terminal

roslaunch turtlebot3_gazebo turtlebot3_gazebo_rviz.launch

In RViz, tick the box near the Camera visualization in the Display panel on the left. You should now see the camera feed on the left, and see red flickering points near your robot. These are your LaserScan data.

rviz-gazebo-TurtleBot3World

Drive through your environment using the turtlebot3_teleop_key and see how it perceives the world in rviz.

Next week: we will start programming in ROS and Python. It is suggested that you use a development environment, such as Microsoft Visual Studio Code (VSCode).