Home Lecture Blog Resources Project Discussion Group Assignments

Bilibot Bring-Up and Wall Follow

The goal of this assignment is to learn how to use the Bilibot, and to develop a wall-follow program that allows the Bilibot to navigate down the 3rd floor hallway of Olsen.

Files You Need

Submit Instructions

Submit the following:

  • file for performing wall-follow
  • short movie (or link to movie) of the robot working
  • 500-word discussion (txt file only) of what you observed, learned, and who you worked with

Name the files as:

  • for the code file, a concatenation of your CS username and "" (e.g.,
  • for the movie, a concatenation of your CS username and ".mpg" (or whatever format suffix is appropriate; e.g., fredm.mpg)
  • for the text file, a concatenation of your CS username and ".txt" (e.g., fredm.txt)

Submit these three files:

 submit fredm ps8 username.mpg username.txt

Get the Bilibot on Internet

Connect the robot to the uml-research wireless net. The password for this net will be given out in class.

The Bilibot's password is Bb0t4tw (mnemonic: Bilibot for the win). You can use this to save the wireless net password in the Bilibot's keychain.

The hardwired computers in the room are also on this subnet.

We will take advantage of this next week when we use a separate computer for running ROS visualizations.

How to Bring Up the Bilibot

The steps are the following. After this basic list, they are described in detail.

  1. Launch ROS with the minimal Bilibot launch script.
  2. Get the Create into the correct state to listen to the Bilibot control board.
  3. Launch ROS with the full Bilibot launch script.
  4. Make sure the Kinect is working (possibly iterating back to Step 2 until successful).
  6. Tele-op the robot.

After this, you will create a program to drive the robot until it sees an object 0.9 meters a way, and the robot will stop.

1. Launch ROS with Minimal Script

Open a terminal window, and run the following command:

 roslaunch bilibot_bringup minimal.launch

It should display various stuff, ending with something like:

 process[rosout-1]: started with pid [3224]
 started core service [/rosout]
 process[base_laser_link_tf-2]: started with pid [3235]
 process[base_link_tf-3]: started with pid [3237]
 process[gyro_link_tf-4]: started with pid [3238]
 process[bilibot_node-5]: started with pid [3239]

2. Get the Create into the Correct State

Open another terminal window, and run:

 rosservice call toggle_create_power

Now you have to look into the left edge of the Bilibot at the Create's power/charge indicator LED. It will be in one of three states:

  1. Flashing Orange—this means it is charging.
  2. Green—this means it is ready.
  3. Off—this means it is not listening.

Keep running the rosservice command until you get it into the Green/ready mode.

If you can't seem to do this, press the Create power button (just beyond the indicator LED) and then try the command again (multiple times as necessary).

When the indicator LED is green, you can continue.

3. Launch ROS with Full Script

In yet a third terminal window, run:

 roslaunch bilibot_bringup robot.launch

If all goes well, the Create will beep, and you will see something like this at the bottom:

process[create_node-1]: started with pid [6761]
process[robot_pose_ekf-2]: started with pid [6762]
process[openni_manager-3]: started with pid [6763]
process[openni_camera-4]: started with pid [6764]
process[pointcloud_throttle-5]: started with pid [6765]
process[kinect_laser-6]: started with pid [6772]
[INFO] [WallTime: 1331932573.893125] serial port: /dev/ttyUSB0
[INFO] [WallTime: 1331932573.893363] update_rate: 30.0
[INFO] [WallTime: 1331932573.893548] drive mode: twist
[INFO] [WallTime: 1331932573.893727] has gyro: False
[INFO] [1331932575.556641621]: [/openni_camera] Number devices connected: 1
[INFO] [1331932575.556886390]: [/openni_camera] 1. device on bus 002:10 is a Xbox NUI Camera (2ae) ....
[WARN] [1331932575.558022431]: [/openni_camera] device_id is not set! Using first device.
[INFO] [1331932575.617299961]: [/openni_camera] Opened 'Xbox NUI Camera' on bus 2:10 with .............
[INFO] [1331932575.630314447]: rgb_frame_id = 'kinect_rgb_optical_frame' 
[INFO] [1331932575.633025371]: depth_frame_id = 'kinect_depth_optical_frame' 

If this fails, type CTRL-C twice in the terminal, and make sure the Kinect is plugged in and has power (green LED on adapter cable). If it seems to be plugged in, but does not have power, try rosservice call toggle_kinect_power and get the LED to turn on.

Then try again with the full launch.

4. Verify Kinect

To see if the Kinect is working, there are a couple of ways.

You can do a rostopic list (use another terminal window). You should see /scan as one of the options. Then do rostopic echo /scan . Then you'll get a printout of the ranges array, which has 360 values. There's a band in the middle that should have legitimate changing values.

Also, you can bring up RViz:

  rosrun rviz rviz

You should make sure to:

  • add a grid
  • set the fixed frame (top of left options window) to /base_footprint
  • add a laser scan

Then you should see the Kinect data as a laser scan.


The robots cost $1,500 each.


6. Tele-Op the Robot

Is the robot and its monitor on the floor? If not, go back to Step 5.

Then get another terminal window, and do:

 rosrun teleop_twist_keyboard 

Try the rotate keys j or l before driving it forward and backward.

Did it move? Congratulations!! Now you can write some code.

A Simple Control Program

Now we're going to create a simple program for the Bilibot to drive until it sees something 0.9 meters away and then stop. If you pull the object away, it will start driving again.

After getting this working, the assignment is to extend the starter program so that the Bilibot can do a wall-follow down the 3rd floor hallway.

Let's get started.

Create a New Package

Begin by cd'ing to the ros directory, located in the Bilibot user's home directory:

 cd ~/ros

Next, create a new package in ROS. Name the package with your CS username concatenated with -wall; this way multiple people can easily share a given Bilibot.

Create the package and give it dependencies of rospy geometry_msgs sensor_msgs. E.g., with username fredm, you would type:

 roscreate-pkg fredm-wall rospy geometry_msgs sensor_msgs

Then do the following:

  1. cd into the new package directory, and do a mkdir nodes .
  2. cd into the new nodes directory
  3. Grab the file and put it into the nodes directory.
  4. Make the file executable (chmod +x
  5. Edit the roslib.load_manifest command at the top of the file per your actual package name.

Run the Program

The program as supplied won't actually make the robot move until you change it. The key statement which determines whether the robot moves is the following:

 cmd.linear.x= (0.0 if dist < .9 else 0.0)  #change the else to 0.5

Per the comment, you must change the number after the else to get the robot to move.

But for now, let's run the program knowing the robot won't move, so you can test the sensing.

You can run the program two different ways:

 rosrun fredm-wall

or, just


Testing the Kinect Distance Sensor

You should see a stream of sensor readings, move commands, and a numerically increasing count of reading numbers. The move speeds should be zero regardless of the distance per the line of code above.

Find a piece of cardboard or other object to wave in front of the robot, and verify that the distance sensor is working.

If the sensor is unhappy, you may get a continuous stream of bogus laser scan messages.

If so, go back and check that Kinect driver is loaded (above). Also check the physical positioning of the sensor—make sure that all three sensor lenses (transmitter, IR receiver, camera receiver) are not blocked by the Bilibot frame.

Also note, that the actual physical obstacle matters—the Kinect sees some things better than others. If the obstacle is black, it won't see it very well. Also, the Kinect has trouble seeing the box fan that's in the lab.

Running the Code for Real

When you're confident the Kinect is working, modify the code to replace the else speed with 0.5.


Does it work?

The Assignment

The goal of this assignment is to make a wall-follower.

Test the performance of your code by running the Bilibot out in the 3rd floor hallway.

The Bilibot should be able to drive from outside the 302 lab door to the elevator lobby without getting stuck.

The best time as demonstrated by the video wins a prize.

Before You Leave...


The Bilibot's battery will be permanently damaged—namely, destroyed—if the Bilibot is left unplugged for too long. We have already killed two lead-acid batteries because of our own negligence.

So, before leaving, do three things:

  1. Plug the big fat power brick into the Bilibot.
  2. Execute the rosservice call toggle_create_power as necessary until the Create indicator LED is flashing orange. You might have to press the Create power button to get the Create to listen to the Bilibot's command.
  3. Shut down the Bilibot computer.

Note: When the Create is in charge mode, it cannot move. THIS IS A GOOD THING.

Once you have the Bilibot plugged in and the Create charging, you can do a software shutdown of the Bilibot computer.