-
Notifications
You must be signed in to change notification settings - Fork 0
Real Robot Labs
You can use these face-to-face lab sessions to have a go at implementing some of the things that you have learnt about ROS in simulation so far.
Under the current circumstances, it is important that you maintain social distancing throughout these sessions:
- Remain at the workstation that you have been assigned to.
- Only work with the laptop that you have been provided with.
- Maintain a 2 meter distance with anyone else at all times.
- Raise your hand if you have any issues.
- The robots will remain in the robot arena at the centre of the computer room and the teaching staff will handle them for you, if required.
Note: Any breach of these rules will be considered a health and safety violation, which will be reported and will result in you being asked to leave the session.
The first important thing to note is that so far you have been working with ROS Melodic and Ubuntu 18.04 in simulation. The real robots and laptops that you will be working with in these labs run on a slightly older version of both Ubuntu and ROS: ROS Kinetic and Ubuntu 16.04. As a result, there will be slight differences between some of the commands that you will use when working with ROS here, compared with what you have done in simulation.
Whilst working on these laptops you may at some point see a message asking if you would like to install software updates (as below) or update the operating system to the latest version. Please do not perform any sort of updates on this laptop, and just dismiss any messages that may appear:
Open up an Ubuntu Terminal Instance on the laptop using the Ctrl+Alt+T
keyboard shortcut. You should be presented with one of the two messages as shown in the figure below:
If the laptop is in MiRo Mode (like the left-hand image above) then you will need to run the following command in order to switch to Waffle Mode:
$ robot_switch turtlebot3
A further message in the terminal should indicate that the switch has been made successfully:
Then, close the terminal window (don’t worry if you see a warning message saying that there is a process still running, just click "Close Terminal" to proceed). Every new terminal window you open from now on should have the correct settings applied, so you can now carry on working.
Step 1:
Connect the laptop to the eduroam WiFi network by clicking on the WiFi symbol in the top right-hand corner of the laptop screen and selecting eduroam frm the list of available networks. Credentials should already be set up, so the laptop should connect straight away. Speak to a GTA if it doesn't.
Once connected, open up a new Ubuntu Terminal Instance on the laptop using the Ctrl+Alt+T
keyboard shortcut. We will refer to this as [TERMINAL 1]. In this terminal, run the following command:
[TERMINAL 1] $ sudo ntpdate ntp.ubuntu.com
...and enter the password for the laptop, when prompted.
We'll need to do this on the robot in a minute too and this makes sure that the time on both of the systems is synchronised, which will ensure that some of the ROS tools that we will use later can work properly.
Step 2:
The robots and Laptops will communicate with one another (and form a ROS Network) on a special wireless network running in the Diamond called DIA-LAB. Laptops must be connected to the DIA-LAB network in order for you to communicate with the robots, so make sure that this is the case now. DIA-LAB is an internal network, so you will not be able to access the internet and you should use the Computer Room 3 workstations to access any external resources (such as this Wiki) instead.
As with eduroam, credentials for DIA-LAB should have already been set on the laptops, allowing you to connect straight away, but speak to a GTA if you are having any issues.
The laptop you are working with is already paired with a specific TurtleBot3 Waffle robot in the robot arena. Identify your Laptop Number by checking the terminal prompt in the terminal instance that you launched above ([TERMINAL 1]). The prompt should look similar to this:
robot@dia-laptopX:~$
The X
indicates your Laptop Number. Above this should be a message explaining which robot this laptop is paired with:
ROBOT_ID: dia-waffleY
You can also find your Robot ID from this document if you want to double check (you will need to use your University of Sheffield login details to access the link).
Spyder is installed on the robot laptops if you want to use this to write/edit Python code. This is part of the Anaconda-Python installation so in order to launch it, follow the steps below:
-
Open a new terminal and activate
conda
:$ conda activate
(base)
should appear at the start of the terminal prompt. -
To then launch the Spyder IDE enter:
$ spyder
There are a number of initial steps that need to be carried out in order to start up your robot, establish communications between the robot and the laptop and get ROS running.
Note: As you will have experienced whilst working with ROS in simulation over the last six weeks: you will often need to have several terminal windows running simultaneously. Only close down terminals or shutdown processes (using
Ctrl+C
) when instructed to do so otherwise your robot may not function correctly!
We will be accessing the robot over the DIA-LAB WiFi network via a secure shell connection from the laptop, allowing us to access the the Linux terminal on the robot computer. We do this using ssh
.
Remember to make sure the laptop is connected to the DIA-LAB WiFi network!
-
In [TERMINAL 1] enter the following to establish a connection to your robot via
ssh
:[TERMINAL 1]: $ ssh waffle@dia-waffleY
Replace
X
with the number of the robot that your laptop is paired with. Enter the password when requested. -
The terminal prompt should change as follows:
waffle@dia-waffleY:~$
This indicates that you are now logged in to the computer on the robot (
dia-waffleY
) via the local username:waffle
-
Then launch a
tmux
session to provide some advanced functionality for the remote session:[TERMINAL 1]: $ tmux
Any text in the terminal should now clear and a green banner should appear across the bottom of the terminal window indicating that you are now working within a
tmux
session. tmux gives us a more robust connection to the robot and you can find a (very quick) guide for how to work with it here. We will refer to this terminal window as [TERMINAL 1][TMUX 0] for the remainder of these instructions. -
Run the
ntpdate
command on the robot now, to make sure its system time is the same as the laptop's:[TERMINAL 1][TMUX 0] $ sudo ntpdate ntp.ubuntu.com
...enter the password for the robot when prompted.
-
To get ROS up and running we need to launch the ROS master on the laptop. Open up a new terminal window on the laptop using
Ctrl+Alt+T
(herein referred to as [TERMINAL 2]), and then launchroscore
:[TERMINAL 2]: $ roscore
A terminal message ending as follows:
started core services [/rosout]
indicates that the ROS Master has been launched successfully.
-
We then need to launch all the core packages on the robot and we can do this using a single launch file located within a convenience package called
turtlebot3_bringup
, which is installed locally on the robot. Return to yourtmux
session in [TERMINAL 1] and enter the following:[TERMINAL 1][TMUX 0]: $ roslaunch turtlebot3_bringup turtlebot3_robot.launch
Once you see a message containing the text:
Calibration End
then the robot core packages are up and running.
-
To help manage all the terminal windows that are running ROS processes on the laptop, it's good to keep all of them together by using tabs within [TERMINAL 2]. Go to [TERMINAL 2] where
roscore
is running (and which will now be referred to as [TERMINAL 2][TAB 1]) and create a new tab using theCtrl+Shift+T
keyboard shortcut (we will refer to this new tab as [TERMINAL 2][TAB 2] from here on in). -
Finally, we need to launch some core packages on the laptop too. This is done in the same way as on the robot using the
turtlebot3_bringup
package again (which is installed locally on the laptop as well). This time however, we will point theroslaunch
command to a slightly different launch file. In [TERMINAL 2][TAB 2] enter the following:[TERMINAL 2][TAB 2]: $ roslaunch turtlebot3_bringup turtlebot3_remote.launch
The following message should appear to indicate that the remote packages on the laptop have also been launched successfully:
process[robot_state_publisher-1]: started with pid [xxxx]
The connection between our robot and the laptop is now established, the ROS master is up and running on the laptop and a number of ROS Nodes have been launched on both the robot and laptop, so we can now start working!
If you've not attended a face-to-face lab session before, or if you didn't finish all the exercises on your first visit, then you should move on to the "Lab Exercises for Beginners" page now.
If you completed all the exercises that we set for you to try the first time then check out the "Lab Exercises for Pros!" page instead.
COM2009/3009 Robotics Lab Course
Updated for the 2021-22 Academic Year
Dr Tom Howard | Multidisciplinary Engineering Education (MEE) | The University of Sheffield
The documentation within this Wiki is licensed under Creative Commons License CC BY-NC:
You are free to distribute, remix, adapt, and build upon this work (for non-commercial purposes only) as long as credit is given to the original author.