| Garcia Teleoperation Example |
Last Modified: 2006-12-11
This tutorial discusses a C++ program running on a host computer that allows the Garcia to be controlled from a web browser over TCP/IP. This allows remote operation of the Garcia from anywhere you have network connectivity!
This example assumes both the Camera Boom option as well as either the CMUCam2+ or a USB webcam and the Stargate processor. Other configurations could be adapted, but not without some work and changes to the code.
A CMUCam or CMUCam2+ on the boom works well with this code example.
Provide a minimal HTTP sever to allow navigation of the Garcia from an arbitrary web browser. The user gets a current image from the robot and can click on the image to pick a new destination for the robot to pursue. The robot navigates open-loop allowing long latencies in the control link and it both checks for obstructions (stopping if they are encountered) as well as showing updated images along the way while navigating.
The Camera Abstraction
For the purposes of this example, we need a simple camera abstraction that does only a couple of things. First, it encapsulates all the camera communication. Second, it reports the native camera resolution. Finally, it fills a memory buffer with RGB data from the camera. Currently this example supports a Video-For-Linux interface to a Web camera as well as a serial port interface to a CMUCam2+. The abstraction of the camera is handled with a base class and these two implementations are done with sub-classes of the acpCamera base class. The acpCamera will take a fake picture of a solid blue rectangle for debugging purposes when no camera is present.
The aRobot API
The initial example uses the aGarcia API but will be re-written to use the successor API called the aRobot API. This will allow the example to work with classes of robots that implement just a few particulars in the aRobot API.
The Web Server
The aUI shared library which is completely cross-platform and integral in the basic Acroname code tree includes a basic HTTP server which we will use to serve up the pages. This server is tiny and great when you don't want an entire Apache server or when you are writing code that runs on multiple platforms.
Source Code Package
This code is tested with the build 23 sources and should work with most any release from then on. The code is intended to be uncompressed into a sibling directory to the C development download root level "brainstem" directory.element type not assigned
Image Grabber Application
The grabber application is the first step and it just tests out the camera interface by grabbing a single image from the camera and writing it to a .png file. This code is very short and provides a great starting point and example of camera interface. Getting this program working reliably ensures your camera is up and running, properly configured, and stable. You can then move on to the next phase.
Building the Code
This code sits as a sibling to the standard C development directory structure allowing you to link the libraries and work with the distribution without modifying any files in it. To build the code, just type make for a native build. If you are cross compiling, you may need to specify the ARCH and CC variables. For example, with a cross-compile for the Stargate on PC running Linux, you would type:
tool% make ARCH=ARM CC=arm-linux=g++
This assumes you have already downloaded and built the C Development tree on your machine for the same target architecture specified above.
Since the code uses shared libraries from the C development distribution, you need to specify a library path to access the built shared libraries when you are running the code. There are several ways to do this but the least obtrusive is using the LD_LIBRARY_PATH variable:
tool% LD_LIBRARY_PATH=../host/aRelease/aUnix/i686:$LD_LIBRARY_PATH tool% export LD_LIBRARY_PATH tool% grabber
This prepends the Acroname shared library location to your library path when running the command "grabber". On Stargate, things are a bit different as you will need to have uploaded the shared libraries to the Stargate (we put them in /home/acroname/aBinary) as well as the application you are running. We do this with the "scp" command. We then "ssh" into the Stargate and run the application there. When running the grabber program, we then "scp" the out.png file back to a desktop and view it there.
| voice: 720-564-0373, email: email@example.com, address: 4822 Sterling Dr., Boulder CO, 80301-2350, privacy |
© Copyright 1994-2012 Acroname, Inc., Boulder, Colorado. All rights reserved.