From Robin

Jump to: navigation, search

Two turtlebots are available at ROBIN. If you wish to use them, contact robin-engineer@ifi.uio.no.



Connecting to the turtlebot via ssh

One turtlebot is connected to the network called “nettbrett”, so you should use a development computer that is connected to this network. It is recommended to use the vixen -machine because all ports between the turtlebot and computer are open. The other turtlebot is not connected to any hidden network.

You can connect to the turtlebot by ssh-ing into it. The turtlebot is configured with key authentification, so it you have to generate a key pair for authentication purposes before connecting to the turtlebot. Follow these steps to do so:

  1. On your computer, navigate to the .ssh folder: cd ~/.ssh
  2. Create the key pair and give the key pair a suitable name key-name: ssh-keygen
  3. Send the public key to robin-engineer@ifi.uio.no. This key is in the key-name.pub file.
  4. Write the following lines in the .ssh/config file:
Host turtle
  User ubuntu
  IdentityFile ~/.ssh/your_key_pair_name

When the public key is added to the authorized keys on the turtlebot, you can connect to the turtlebot by running the command:

$ ssh turtle

If you want to use GUI on the turtlebot, add the -Y flag in the line above:

$ ssh -Y turtle

Setting up the ROS network

To be able to control the turtlebot, it is important that the ROS network configuration is set up properly. This entails setting up the environment variables correctly so that the turtlebot is able to communicate with the ROS master running on the computer (it is usually what we do). This is done according to the image here under the title “Network configuration”.

The turtlebot side is already set up, where the ROS_MASTER_URI is set to the vixen computer. If you are using any other computer, it needs to be connected to the hidden network “nettbrett” and you need to change the ROS_MASTER_URI on the turtlebot to use the IP of your computer for example by running this command in the terminal:

$ export ROS_MASTER_URI=http://IP_OF_YOUR_COMPUTER:11311

On the side of your computer you also need to set the ROS_MASTER_URI and ROS_HOSTNAME variables according to this, where you use the IP of your computer. To make it easier, you can add these lines to a FILENAME.sh file that you can source.

Updating the .sh file

In each terminal on the development computer you have to specify the model of the turtlebot you are using. To make it easier, you can add this line (export TURTLEBOT3_MODEL=turtlebot model) in the same FILENAME.sh file as above.

In addition, you can add the following lines in the FILENAME.sh as well to avoid writing it when entering a new terminal.

source /opt/ros/noetic/setup.bash
source /turtlebot_ws/devel/setup.bash


Currently the robot is running ROS Noetic. To interact with the robot from the development computer, you can use a ROS Noetic-based container which is available on Robin’s project area (IT'S NOT UP YET). You can enter the container by running the following command:

$ apptainer shell /uio/kant/ifi-project06/robin/programs/sing-con/ros-noetic/turtlebot.sif


The turtlebot is equipped with a LiPo battery which can be charged using the ISDT Q8 smart charger, as shown in figure 1. In this charger you can plug the power supply (shown in figure 2) on the left side that is marked with “DC IN” and the battery on the right side that is marked with “BATTERY”. You also need to plug in the pin connector of the battery into the charger on the side marked with “2S”. The full setup is shown in image 3.

When you have connected everything you need to start the charging. Tap the round button beside the screen to get the “Task setting” menu. Make sure that the task is set to charging. Then click “Start”. When the battery is done charging, the charger will make a loud noise and the screen will be green. Then disconnect the battery.

If you plan on using the battery frequently, you can charge it normally by setting “Task” is set to “Charging”. But if you don’t plan to use the battery for a longer period of time, it is recommended to set the battery in “storage mode”. You do this by setting “Task” to “Storage” instead.

You can read more about this charger in the manual here.

Example uses of the turtlebot

Simulation in Gazebo

To simulate the robot in Gazebo, be sure to first enter a container:

$ apptainer shell /uio/kant/ifi-project06/robin/programs/sing-con/ros-noetic/turtlebot.sif

You can follow this guide to launch Gazebo and control the robot using the keyboard. Remember to source ROS and the workspace!

You can also send velocity commands directly to the robot to make it move. You can publish messages in the /cmd_vel topic directly from the terminal to set the linear velocity and angular velocity of the robot (in x,y and z directions).

$ rostopic pub /cmd_vel geometry_msgs/Twist -r 10 -- '[0.0, 0.0, 0.0]' '[0.0, 0.0, 0.0]'

Here the first list corresponds to the linear velocity in x, y and z directions and the second list is the angular velocity in x, y and z directions. For the Turtlebot, it will only be necessary to set the linear velocity in the x and y directions, because this corresponds to the ground (the z-axis points upwards, and the turtlebot cannot fly). You can also set the angular velocity in the z-direction only, because it can rotate on the ground around the z-axis, but it cannot rotate through the ground around the x and y axes.

You can find more information about this here.

Controlling the actual robot - a simple example

To control the physical turtlebot with a keyboard, you can follow this guide.

  • Make sure that you launch bringup on the turtlebot and the rest of the commands in a container on the devlopment computer.

Mapping and navigation with the simulated turtlebot in Rviz

You can use the turtlebot for navigation purposes in simulation. This shows a simple tutorial for how to launch the turtlebot navigation node and set navigation goals for the turtlebot.

  • You have to specify the location of the map you want to navigate in. A premade map (.yaml) you can use in simulation can be found by:
$ cd /opt/ros/noetic/share/turtlebot3_navigation/maps

You can also publish a navigation goal directly from the terminal by publishing a geometry_msgs/PoseStamped on the /move_base_simple/goal topic. Before you do this, make sure to have the navigation node running (like in the example linked to above), because if not, the topic will not be available. The message is built like this:

$ rostopic pub /move_base_simple/goal geometry_msgs/PoseStamped '{header: {stamp: now, frame_id: "map"}, pose: {position: {x: 0.5, y: 2.0, z: 0.0}, orientation: {w: 1.0}}}’

You can also perform SLAM with the turtlebot by using Rviz and Gazebo. This is done by followting this tutorial, which shows how to run a SLAM node and create a map by using the keyboard. Make sure to open Gazebo in a world that is not empty (or add objects) so you can create a more interesting map.

You can first create a map of a simulated world with SLAM, save the map, and then navigate in that map by launching the navigation tutorial.

SLAM and navigation on the real robot

This tutorial shows how to do SLAM on a real turtlebot in a real environment.

The tutorial can be followed step by step, but beware of these points:

  • Some of the commands in the tutorial needs to be run on the turtlebot’s computer, while some needs to be ran in a container. Remember to enter the container in order to run these commands.
  • If you have ssh-ed into a development computer that is connected to the “nettbrett” network, you have to use the -Y flag when ssh-ing in order to be able to open GUIs.

You can save the map as shown in the tutorial (it is saved on the development computer), and then use this map in order to navigate with the turtlebot in the real environment using the map made with SLAM. Follow this tutorial to do this.

Turtlebot camera

The turtlebot is equipped with a Raspberry PI Camera Module V2. You can view the video stream of the camera using Mplayer, which is already installed on the turtlebot. Follow these steps to make it work:

  1. ssh turtlebot
  2. mplayer tv://device=/dev/video0

Beware that you have to be on the vixen compute to be able to view the video stream (not over SSH). In addition, you have to use the -Y flag when SSH-ing into the turtlebot to view the GUI.

Personal tools