Saturday, April 19, 2014

Using the Tele NP Hangout with the Turtlebot


Appendix C:

Using the Tele NP Hangout with the Turtlebot

This section is meant to describe the actual operation of the robot with the Hangout extension. We start by describing the startup procedure. Then we give tips for actually using the extension html interface. As before we outline the information that we are about to present.

  1. Start The Robot and Launch the ROS Package (and Google Chrome)
  2. Start The Controlling Computer (and Google Chrome)
  3. Launch Google Hangouts and The Hangout Extension on Both Computers
  4. Establish for the Hangout Extensions which computer is the Turtlebot
  5. Test Teleop
  6. Start Gmapping
  7. Save Map
  8. Start Navigation (Load A Map)
  9. Tell the Navigation Software Where the Turtlebot Is
  10. Tell the Navigation Software Where the Desired Goal Is
  11. Specify Additional Goals

Though there are several parts to the Hangout Extension and they do not all look the same, the entire Extension is confined to a band along the right side of the Hangout screen. On the central portion of the screen is the video from the robot. Along the top of that gray band on the right is a set of three tabs. The tabs are 'controls' , 'setup', and 'map'. You will be presented with the 'controls' tab first.

  1. Start The Robot and Launch the ROS Package (and Google Chrome)
    Plug the kinect device in to the Turtlebot's laptop computer. Remember that the kinect must be plugged into the adapter which itself plugs in to the Turtlebot for power and the laptop for data. Plug the Turtlebot itself into the laptop via the USB cable. Turn on the Turtlebot and the laptop, and make sure you are booting into the Ubuntu 12.04 LTS/ROS partition. The password for the laptop is usually 'turtlebot'. When the Turtlebot is on there will be a bright green light on its control panel. Check network connectivity on the laptop. You need access to the internet in general. 
     
    On the turtlebot computer start the Google Chrome Browser. Also start a terminal window. Type the following in the terminal window:
     
    $ roslaunch tele_presence app_manager.launch

  2. Start The Controlling Computer (and Google Chrome)
    Start the computer that you want to use as the controller. Your computer must have Google Chrome and Google Hangouts installed. Start Google Chrome at this time.

  3. Launch Google Hangouts and The Hangout Extension on Both Computers
    At this time you need to use the credentials that you set up for the tele presence robot. The two users that you choose to use at this time must be established as developers for the App Engine project. For the turtlebot computer log in with one user, and for the controller computer log in with the other user. Start Hangouts and the TeleNP extension on both computers. The TeleNP extension can be found in the left bar that shows up on Hangouts when you hover over that area with the mouse. You may have to choose the 'more extensions' button and then go to the 'developers' section to find your own project. You should then see the video connection between the computers now easily.

  4. Establish for the Hangout Extensions which computer is the Turtlebot
    On the screen of the laptop connected to the Tutlebot you should see the direction buttons for the extension, and also some options. One of the options, under the heading 'Start' is a checkbox that is labled 'Turtlebot Node'. On the Turtlebot laptop, click the 'Turtlebot Node' checkbox. The screen on both computers should change slightly. The direction pad will disappear from the screen on the Turtlebot Computer. At the same time the 'Turtlebot Node' checkbox will disappear from the controller computer's screen. You should hear a series of tones from the Turtlebot itself. There will be a checkbox on the controller computer's screen that says 'Controller Node'. On the controller computer, click this checkbox. 
     
  5. Test Teleop
    On the controller computer, click the arrow pictures on the screen. The turtlebot should move.

  6. Start Gmapping
    On the controller computer, click on the tab marked 'MAP'. You will see a panel of buttons arranged vertically. The top option, under the heading 'Do This:' will be the 'Make Test Map' button. Click this button. The sidebar will change to the 'Make Test Map' screen. There are two main buttons here, one marked 'NEW TEST MAP' and one marked 'NEW G MAP'. Click the 'NEW G MAP' button. At this time the turtlebot will reconfigure itself for g-mapping. This reconfiguration takes some time. The turtlebot will emit a tone, seem to pause, and then emit a second tone. After the second tone there will be a wait, and then a yellow box will appear on the controlling computer's screen that will tell you that the reconfiguration was completed successfully. Click the 'Done' button. You can now go to the tabs at the top of the sidebar and click 'CONTROLS'. From the 'Controls' tab you can direct the turtlebot around the area to be mapped. The robot will use its laser to record information about solid objects in its path. You cannot see the map as it is being made, so try to be thorough. You cannot go back and add to a map that is already made. If a map is incomplete you must start g-mapping over again and make an entirely new map.

  7. Save Map
    Go back to the 'MAP' tab, at the top of the sidebar, when you are done. You should see a series of buttons again. (If you are not seeing the vertical button panel, look for a 'Done' or 'Return' button.) The 'Save Map' button, second from the top, should be ready for you to click. DO NOT click the 'STOP/SWITCH SERVICE' button at the bottom of the row as you are not done g-mapping. When you click the 'Save Map' button you will be given a screen for naming the map in the library. Use simple names without spaces or special characters. Click the 'SAVE' button. Wait again for the yellow box that tells you that the process completed without error. Once you see the yellow box, you can click 'Done'. Your map should now be part of the turtlebot map library.

  8. Start Navigation (Load A Map)
    Back at the 'MAP' sidebar the 'Load Map' function is disabled. Click 'STOP/SWITCH SERVICE', and wait while the turtlebot reconfigures from g-mapping to teleop. The switch takes about a minute. When it is done you will notice that the 'Load Map' button is enabled. (There is no yellow box to tell you that the operation is finished.) Click the 'Load Map' button. The sidebar will change to show the Load Map options. The Load Map screen is used to launch the 'navigation' configuration for the turtlebot. There are many buttons on this screen. There is a horizontal line on the screen which you should note the position of. Try to use the buttons below the horizontal line. Next to the text that reads 'Load this file:' is a dropdown box that will allow you to select your map. After selecting your map, click the 'LOAD' button. At this time the turtlebot will reconfigure itself for the navigation function. This configuration takes some time. You should hear a series of tones, and a pause, and then another series of tones. After another short wait a yellow box with a confirmation message appears in the sidebar. When you see the yellow box you know you can proceed. Do not click DONE at this time. Click 'RUN NAV TOOLS'. This will take you to the screen where you can specify starting and ending coordinates for your navigation. After clicking the 'RUN NAV TOOLS' button the nav tools are visible on the 'View Current Map' page. You are automatically taken to that page now.

  9. Tell the Navigation Software Where the Turtlebot Is
    Click 'Refresh Current Map' at the top of the sidebar. Wait for a period of time while the map is loaded. When the map is ready an alert box appears on the screen with the xy location of the origin for your map. The numbers you see should not be zeros, but they are not user modifiable. Click OK on the alert and you should see the map appear in the window of the sidebar. Scroll until you see the main part of the map in the center of the window. Mentally figure out where the turtlebot robot is and what direction it is facing. The orientation of the map is determined by what direction the turtlebot was facing when the g-mapping process was started. The map cannot be rotated in the window. Click the 'START COORDS' button. Hover the cursor over the map, and specifically over the spot where the turtlebot is to start from. This should be it's location in the room. Click the mouse button and a small blue square is placed on the map. You can move it by hovering over another part of the map, and clicking again. Now you should click on the button that allows you to specify the starting angle. With every click the angle of the button changes. Twelve positions are available. Choose the one that best reflects the turtlebot's orientation on the map. Click the 'SEND START' button.

  10. Tell the Navigation Software Where the Desired Goal Is
    Click the 'STOP COORDS' button. Hover the cursor over the map in the spot you want the turtlebot to end up in. Click the mouse button. A red square is placed on the screen. Choose an angle using the button on the right side of the sidebar. This is the angle you want the turtlebot to be facing when it stops moving. If you click 'SEND GOAL' now the turtlebot will attempt to navigate from the starting location to the stop location. The process will be abandoned if it cannot figure a path, or if the start location as defined by the map does not match what it sees around it.

  11. Specify Additional Goals
    You can repeat step 10 as often as you like. Disregard the blue square after the robot has reached its destination. Place the red square in the next destination, and click the 'SEND GOAL' button.

Tuesday, April 15, 2014

Installing The Hangout Extension


Appendix A:

Installing The Hangout Extension
You can install the Google Hangout Extension used in this project by following the instructions below.

  1. Establish an account with Google for their App Engine service.
  2. Make a new App Engine Instance.
  3. Download and install the App Engine tools.
  4. Download the Google Hangouts project from the Google Code site.
  5. Configure the Hangout code
  6. Upload the Hangout Extension.
  7. Edit the list of approved users
  8. Start the Hangout Extension.
  9. Use the Hangout.

You could probably install the Google Hangout extension using a Windows or Macintosh Operating system, but for this explanation we will assume that you are using Ubuntu Linux, 12.04 LTS.

  1. You might want to set up a Google user just for working with the Hangout Extension. Setting up a Google account is easy. Go to any google sign in page and click on the 'create account' button.

  1. See the following link for information about getting your own account registered for Google App Engine. https://console.developers.google.com/start/appengine Google has tons of howto's about their products. When you are presented with options about what programming language you want to use, select python.

    At this stage you may be required to choose a unique name for your google App Engine instance. This name is important. For development the name 'awesometelenp' was chosen. Yours must be different. At this stage you must also create your own Hangout Extension. The following link shows how to publish your app:
    https://developers.google.com/+/hangouts/running . The following link goes through the process of creating a project. https://developers.google.com/console/help/#creatingdeletingprojects . After this you want to enable the specific API for Google Hangouts Extensions.

  1. The url for the python tools for working with App Engine follow: https://commondatastorage.googleapis.com/appengine-sdks/featured/google_appengine_1.9.1.zip .

    Follow instructions on this page for installing the appengine software on your computer : https://developers.google.com/appengine/downloads#Google_App_Engine_SDK_for_Python

  1. As of this writing the code for the Hangout Extension and also the ROS software is all located on a google code site called 'Telenp'. The url for the google code site is: https://code.google.com/p/telenp/ . Instructions for using 'git' is beyond the scope of this document, but the code is stored in a git repository and you will need to use git to download it. The repository is divided into two sections, one called 'awesometelenp' -- which is the hangout extension -- and one called 'turtlebot_tele_presence' -- which is the ROS package. When you download the software you get both at once. I recommend that people create a folder in their home directory called 'workspace' and then download the telenp code into that folder. Then the hangout code could be found at '~/workspace/telenp/awesometelenp/' and the ROS code could be found at '~/workspace/telenp/turtlebot_tele_presence/' .

  1. At '~/workspace/telenp/awesometelenp/' there is a file called 'app.yaml'. On line 2 is the spot for you to put your unique app engine instance name. Replace the word 'awesometelenp' with your name. Save and close the file. In the actual html and java code of the project, replace the word 'awesometelenp' with your name. It is used in several image names and url's. A simple find/replace operation in your favorite text editor should work. The four files you should be concerned with are called 'app.js' , 'app-map.js' , 'app.html' , and 'app-map.html' .

  1. After completing step 3 above you should be able to upload the App Engine app to the App Engine instance. Open a terminal and perform the command '

$ cd ~/workspace/telenp/awesometelenp
$ appcfg.py update .

(Notice the period after the word 'update'). This will update your instance. You can also perform the commands from another directory, as is outlined in the google site at this address: https://developers.google.com/appengine/docs/python/tools/uploadinganapp#Python_Uploading_the_app

  1. This document assumes that you are using the developers version of the Hangouts Extension. Using this setup, if you go to your app engine dashboard at: https://appengine.google.com/ and click on the link representing your app engine instance, you will be taken to a page that has 'Permissions' as one of the many links on the left side of the page. Here you can edit the email addresses that are used to access your project. These email addresses will be able to access the Hangout Extension in the developer section of your Google Hangouts. You must have at least two addresses in your list, one for the controller computer, and one for the turtlebot computer.

  1. Log in to Google as one of the email addresses that you set up in part 7. Open Google Plus and start a hangout. Invite the users from the list. You need to invite the user that is attached to the Turtlebot computer. Open the hangout extension that you've renamed by hovering over the left side of the screen and choosing 'Add Apps' from the bar that appears. Choose 'Developers' and then choose yours from the list presented. Do this on the turtlebot computer too.

  1. Here we describe the last part of the installation of the Hangout Extension. We assume that you have also installed the ROS operating system and the tele-presence software developed for this project. Log in to Google as one of the email addresses from section 7 using Google Chrome as your web browser. You must have the Hangout Plugin installed. See the link above for installing the plugin: https://www.google.com/tools/dlpage/hangoutplugin . Go to the Google Plus page. Start a hangout and invite others to join you. You must invite someone from the list you made in section 7 to join you. One of these emails should be on the turtlebot computer attached to the turtlebot itself. At this point you should start the ROS software on the turtlebot computer by typing 'roslaunch tele_presence app_manager.launch' in a terminal. Finally, with the ROS software running on the turtlebot and the hangout extensions running on both the turtlebot computer and the controlling computer, the last step of the setup can be performed. Click the 'Turtlebot Node' checkbox on the screen on the turtlebot computer. Go to the controller computer and click on the 'Controller Node' checkbox. Now you should be able to direct the Turtlebot using the arrow buttons on the controller computer's screen.

Installing the ROS Nodes


Appendix B

Installing the ROS Nodes:
You can install the custom ROS Nodes used in this project by following the instructions below.

  1. Install ROS On Your Computer.
  2. Setup ROS In Your '.bashrc' File.
  3. Locate the On-Line Code Resource.
  4. Download the ROS and Google Sources.
  5. Identify the ROS Workspace.
  6. Prepare the Workspace For Inclusion In ROS.
  7. Build the ROS Workspace.

Though programming Google Hangouts can be done on Macintosh or Windows computers, ROS should be used on a Ubuntu Linux computer. In this document we assume that you are using Ubuntu Linux 12.04 LTS.

  1. A good resource for installation of ROS can be found at the ROS Wiki, at the following URL: http://wiki.ros.org/hydro/Installation/Ubuntu . You should follow these instructions first before trying to install the ROS nodes from this project. For this project we used ROS Hydro. There is also some special software to install for this project. Execute the following code from a terminal:

$ sudo apt-get install ros-hydro-rosbridge-server
$ sudo apt-get install python-pip
$ sudo pip install pymongo

  1. Open a terminal window. Add the following line to your '.bashrc' file:

source /opt/ros/hydro/setup.bash

Next exit the terminal you are in and open a new terminal.

  1. Code for this project is all located at the following URL: https://code.google.com/p/telenp/ . The code is stored in a git repository.

  1. At this time the authors use a directory in their home directory called 'workspace' after the fashion of the Eclipse style workspace. In this directory is placed the git repository. Open a terminal and create an Eclipse style workspace by typing:

$ mkdir workspace
$ cd workspace

and finally to download all tele_np sources, type:

$ git clone https://david.c.liebman@code.google.com/p/telenp/

  1. The repository is divided into two sections, one called 'awesometelenp' -- which is the hangout extension -- and one called 'turtlebot_tele_presence' -- which is the ROS package. When you download the software you get both at once.

  1. You have to let ROS know that you're including your own material in your own development workspace. This is accomplished by adding another line to your '.bashrc' file. If you have been following closely, this is the line:

source ~/workspace/telenp/turtlebot_tele_presence/devel/setup.bash

Another line you should include is:

export ROS_PACKAGE_PATH=~/workspace/telenp/turtlebot_tele_presence/:$ROS_PACKAGE_PATH;

That makes three lines that are important in the '.bashrc' file. Close the terminal you are in and open another.

  1. Because my home folder is named differently from yours, you need to delete the 'build' and 'devel' folders from the 'turtlebot_tele_presence' folder before you build. The following commands should allow you to build the ROS software:

$ cd ~/workspace/telenp/turtlebot_tele_presence/src/
$ catkin_init_workspace

Then type:

$ cd ..
$ rm -fr build devel

Then type:

$ catkin_make

After that you should exit your terminal and open another. On subsequent builds you should only need to execute the 'rm -fr build devel' and 'catkin_make' .