Familiarization and Charging

There are four main components of the ARbot robot:

  • The iRobot Create base
  • The MinSegMega board (the Arduino)
  • The custom ARbot board connecting the MinSegMega and iRobot Create
  • The Hokuyo laser range scanner
  • A Dell Inspiron m11z netbook computer

There are also a number of cables and a USB hub.  The netbook connects to the robot through a single USB cable that plugs into the side of the USB hub.  You shouldn’t need to worry about the other connections, except for the following two:

  • There is a 2-pin header with black and red wires connected to the custom ARbot board.  This must be plugged in with the red wire connected to RX when the robot is being used.  However, it needs to be unplugged in order to charge the robot.
  • There is a power cable connected to the USB hub.  This should be disconnected when charging the robot.

To charge the robot, disconnect these two cables and insert the charger into the iRobot Create.  The power LED will pulse red when charging and switch to green when fully charged.  Once charged, disconnect the charger and reconnect both cables.

Turn the robot on and off by pressing the power button.  Note that the Arduino will turn off the power button LED when connected, so you can’t rely on this LED to tell whether the robot is off or not.

Controlling the Robot Without ROS (Optional)

It is possible to control the robot without ROS using a serial connection to the MinSegMega (the Arduino) over the USB cable.  This may be useful for verifying functionality of the robot.  First, determine the name of the port that the Arduino is connected to by running the following:

ls -l /dev/arduino

Now start the Arduino IDE (click the Ubuntu button in the upper left and start typing Arduino to bring it up).   Use Tools -> Serial Port to set the serial port to the one identified above (e.g. /dev/ttyACM1).  Click on Tools -> Serial Monitor.  Set the two drop-down boxes on the bottom to “Both NL & CR” and “57600 baud”.  Now use the textbox on top to send commands.  Below are the ARbot commands available.   Do not send the “v” command unless the robot is on the floor and you are prepared to catch it as it moves.

Command     Arguments     Description
o           None          Displays odometric pose
f           0 or 1        Controls advance LED
v           See below     Sets robot velocity

For example, send “o” to get an estimate of the robot’s pose by odometry.  Note that this is only an estimate and will only be accurate if the robot moves itself and starts from rest.  Send “f 1″ to turn on the robot’s LED adjacent to the advance button and “f 0″ to turn it off.  The “v” command takes two arguments: the desired forward speed in mm / sec and the desired angular speed in radians / 1000 seconds.  Both of these values must be integers separated by spaces.  If you know your desired forward and angular speeds in m / sec and radians / sec, just multiply by 1000 to get the right arguments for “v”.

Connecting to the Robot using ssh

You can use the ARbot without a network, but it may prove awkward.  To control the robot remotely, you will first need to power the robot and connect a running netbook.  Log into your team’s account on the netbook.  You may already be connected to the network.  If not, click on the wireless connection symbol in the upper right and select “SRV1ROUTER”.  This will only work in EN-1049.  After a few moments you should have a network connection.  You may wish to open the Firefox browser and check a news website to verify your connection.  Now right-click on the wireless symbol and select “Connection Information”.  Record the IP address.  You should be able to close your netbook’s lid, but first go to “System Settings” then Power and make sure that “Do nothing” is selected under both columns in the “When the lid is closed” row.  Now close the netbook’s lid to conserve power.

Log on to a desktop computer and reboot into Ubuntu.  Open a terminal (you will need several) and execute the following, replacing TEAM_NAME with your team’s user name (e.g. team_a) and IP_ADDRESS with the IP address identified above:


You can open several terminals on the desktop and create different ssh connections to the robot.  The commands you execute will run on the netbook, directly.  You can even start graphical programs if you add the “-Y” argument to the ssh command.  However, network bandwidth limitations may prevent graphical programs from running smoothly.

You can edit files directly on the netbook over ssh.  Programs such as nano or vi will execute well in a terminal.  You can also run “gedit” using ssh -Y.  However, the best approach is to develop your code in a subdirectory of your LabNet account.  Once the code is ready you can copy it using scp (secure copy).  The following example scp command copies the file Test1.txt to the home directory of team_a’s account:

scp Test1.txt team_a@IP_ADDRESS:.

Replace the “.” with the desired destination directory.

Controlling the ARbot with ROS

Your team’s account should already contain a catkin_ws directory.  In the src directory you will find three packages:

ros_arduino_bridge: This package was originally developed by Patrick Goebel as a general-purpose mechanism to connect ROS with Arduino microcontroller boards and their sensors and actuators.  It has been modified here to incorporate ARbot specific functionality.

arbot_rab: This package is really just a collection of launch files to bring up the robot using ROS.

comp4766_a3_mod: This is a modified version of the instructor’s solution for Assignment 3.

To start using the robot, execute the following in a terminal connected to your ARbot via ssh:

roslaunch arbot_rab arbot_basic.launch

Look for red text indicating errors.  There are occasional errors accessing the serial ports which can be resolved by reconnecting the USB cable and retrying.  Charging the robot is another important step.  See the instructor if you are getting persistent errors that are not solved by reconnecting, rebooting, and charging.

Execute rostopic list to see a list of topics.  Some of the most useful are /tf, /cmd_vel, and /base_scan.  To verify the ability to control the robot over ROS, execute the following to turn on the ARbot’s advance button LED

rostopic pub -1 /arbot_advance_led std_msgs/Bool 1

To control the robot Twist messages should be sent over /cmd_vel.  This can be done using the following command:

roslaunch arbot_rab teleop_key.launch

Make sure the robot is safely on the floor before hitting any keys!

The /base_scan topic is the raw laser scan data.  Unfortunately, this sensor produces infinite values as well as NaN’s.  The comp4766_a3_mod package does line extraction (improved from assignment 3) and also filters bad values out of /base_scan and publishes /scan.  To get this functionality, execute the following:

roslaunch comp4766_a3_mod extract_all.launch

Run rostopic list to see the new topics /scan, /extracted_lines,/visualization_lines, and /visualization_scanpoints.

Configuration for Running rviz Remotely

You have seen above how we can ssh to your ARbot’s netbook.  This is great for sending commands and even editing files but is not so good for graphical programs.  Using remote desktop or the ssh -Y commands are other options, but the following approach is preferred.

Add the following line to the end of your ARbot’s .bashrc file:

export ROS_IP=`ifconfig wlan0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'`

This sets the ROS_IP environment variable with the netbook’s wireless LAN IP address.  It lets the ROS master know its address on the network.  For this to take effect, you can either log out and log back in again or execute source ~/.bashrc.  Execute echo $ROS_IP to make sure that this environment variable is set correctly.

Now proceed to launch (or close and re-launch) the following in separate terminals:

roslaunch arbot_rab arbot_basic.launch
roslaunch comp4766_a3_mod extract_all.launch

Now on the LabNet machine (running Ubuntu) open a new terminal and execute the following commands where INSERT_IP is replaced with your ARbot’s IP address

export ROS_MASTER_URI=http://INSERT_IP:11311
rosrun rviz rviz

rviz should now start locally on your machine.  However, rviz is really connected to the ROS master on the ARbot.  Use the Add button to display various topics just as you did in Assignment 3.