Skip to content

Real Robot Remote Deployment

Tom Howard edited this page Apr 5, 2022 · 5 revisions

'Remote' Deployment

On this page we look at how to introduce the Robot Laptop into the ROS Network. This is useful if we want to leverage visualisation tools (for instance) that we can't run on the robot (because it doesn't have a display!) The laptops are more powerful too, so we may want to perform more computationally intensive tasks here, to make things work more efficiently (and save our robot some work).

Quick Links

Prerequisites

  1. First, make sure that the laptop is connected to the DIA-LAB WiFi network.
  2. Remember that the ROS Master runs on the robot, and we have to have certain core packages running on the robot too, in order for it to actually be able to do anything! Before you start then, you need to launch ROS on the robot (if you haven't done so already).

Configuring the Laptop

Next, there are three important things you need to do in order to make sure that the laptop is configured correctly and knows which robot it should be connecting to...

Thing 1: Enabling 'Waffle Mode'

Our robot laptops are also setup to work with our friendly MiRo robots, and so there are two different modes that the laptops can operate in: 'MiRo Mode' and 'Waffle Mode'. Clearly, we want to use the latter, so make sure the laptop is in Waffle Mode by opening up an Ubuntu Terminal Instance on the laptop (using the Ctrl+Alt+T keyboard shortcut) and running the follow command:

$ robot_switch tb3

The following message indicates that the laptop has successfully been switched into Waffle Mode (if it wasn't already):

Thing 2: Enabling 'Real Robot Mode'

The robot laptops can also be used to work in simulation too (but you've probably had enough of that by now, haven't you?!). To work with the physical robots, make sure that you are in 'Real Robot Mode' by running the following command:

$ robot_mode robot

... which should present you with the following message:

Switching into 'Real Robot Mode' (run 'robot_mode sim' to work in simulation instead).

Thing 3: Pairing the Laptop with a Robot

Remember that the ROS Master runs on the robot itself, and the laptop therefore needs to know where to look to connect to the same ROS Network.

To tell the laptop which robot that you will be working with, run the following command:

$ pair_with_waffle X

... replacing X with the number of your robot.

You should then see the following message:

Pairing with robot: dia-waffleX...
Done. Re-source the .bashrc (by typing 'src') for the changes to take effect.

Do as instructed and re-source your environment now:

$ src

Once you've done all three of these things, it's a good idea to close down the terminal window. Don’t worry if you see a pop-up message saying that "there is a process still running," just click the "Close Terminal" button to proceed. Every new terminal window you open from now on should have the correct settings applied, so you're good to go!

Exercises

Here are some exercises for you to have a go at for a taste of what ROS things you can run 'remotely' on the laptop.

Exercise 1: Observing your robot's environment

You can use some ROS tools that you will be familiar with from simulation in order to see the real world through the eyes of the robot!

  1. You'll need to launch the camera packages on the robot first and for that, you'll need access to a new terminal instance on the robot. You can do this in one of two ways (select whichever you prefer, you don't need to do both!):

    1. Either, return to the tmux instance that you launched ROS in (on the robot) earlier (TERMINAL 1: TMUX 0). Here, use the Ctrl+B, C key combination to create a new tmux window, which we'll call TERMINAL 1: TMUX 1 (see here for some tips on using Tmux).
    2. Or, create a new terminal instance from an ssh session running on the robot from within VS Code.
  2. Inside this, launch the camera nodes on the robot:

     $ roslaunch realsense2_camera rs_camera.launch
    

    Pro Tip: We've got an alias for that one too!

    You may see some warnings when you execute this launch command, but - in most circumstances - it's OK to ignore them, so just carry on for now.

    This essentially grabs images from the RealSense Camera, creates some new topics on the ROS network and publishes the image data to these topics.

  3. Leave this terminal instance running in the background now and open up a new terminal instance on the laptop (TERMINAL 2). In here, enter the following command:

     [TERMINAL 2] $ roslaunch turtlebot3_bringup turtlebot3_remote.launch
    

    (or use one of our handy aliases again!)

  4. Remember from Week 3 that RViz is a ROS tool that allows us to visualise the data being measured by a robot in real-time. We can launch this on the laptop. To do so, create another terminal instance (TERMINAL 3) and launch RViz with the following command (also available as an alias):

     [TERMINAL 3] $ rosrun rviz rviz -d `rospack find turtlebot3_description`/rviz/model.rviz
    

  5. As we did in Week 6, we can also use rqt_image_view to view live image data being streamed to ROS image topics. You could open another terminal instance on the laptop to launch this (TERMINAL 4):

     [TERMINAL 4] $ rqt_image_view
    

    Select /camera/color/image_raw in the dropdown topic list to see the images being obtained and published by the robot's camera!

Use these tools to keep an eye on your robot's environment whilst performing the next exercise...

Exercise 2: Driving your robot around using the laptop keyboard

In simulation, you used the turtlebot3_teleop package to drive your robot around in an empty world. This works in exactly the same way with a real robot in a real world!

  1. Open a new tab in [TERMINAL 2] (which we will call TERMINAL 2: TAB 2) and enter exactly the same roslaunch command as you used in simulation to launch the turtlebot3_teleop node:

     [TERMINAL 2: TAB 2] $ roslaunch turtlebot3_teleop turtlebot3_teleop_key.launch
    
  2. Drive your robot around using the laptop keyboard (as you did in simulation) taking care to avoid any obstacles as you do!

  3. Once you've spent a bit of time on this, close the teleop node down by entering Ctrl+C in TERMINAL 2: TAB 2 and close down TAB 2 so you are just left with a single terminal instance open in TERMINAL 2.

  4. Close down RViz and the rqt_image_view nodes running in TERMINAL 3 and TERMINAL 4 as well, we won't need these for the next exercises.

  5. Back in TERMINAL 2 the turtlebot3_remote bringup should still be running. You can close this down as well now.