How to make RoboSapien autonomous
and program it
in 7 Steps

Team NimbRo,
Learning Humanoid Robots
Albert-Ludwigs-University of Freiburg
Germany
www.nimbro.net


1. Buy a RoboSapien

Robo Sapien is produced by WowWee and selled in toy and electronic shops all over the world. In Germany you can buy it e.g. by Conrad for about 140 €.
 


2. Attach a Pocket PC with a camera

To control RoboSapien we use a Toshiba e755 Pocket PC with a LifeView FlyCAM or the Pretec CompactCam camera (both are compact flash slot cameras). We removed the head of the robot and parts of the case to embed the Pocket PC into the robot. Additionally we also removed the arms and the corresponding two motors to compensate for the extra weight of the Pocket PC and the camera. At best the Pocket PC should be attached in such a manner that the center of gravity does not change. The reason is that the gait dynamics of the robot is very sensitive to the distribution of mass. It is also important to ensure that the infrared sender of the Pocket PC points into the direction of the infrared receiver of the robot. Look at these pictures that show RoboSapien before and after our modifications.


3. Buy a Pocket PC infrared remote control program

RoboSapien is normally controlled by an infrared remote controller. For sending the same infrared signals from the Pocket PC to the robot we use a learnable Pocket PC infrared remote control programm called UltraMote (~ 13 € registration fee). Although this software provides no Programmer API we can use it by simulating the clicks on the buttons in the UltraMote program by producing the corresponding Windows events with our RoboSapien API.


4. Let the remote control program learn

The aim of this process is that we can use the UltraMote program to control the RoboSapien. Therefore the 'learn-mode' of the UltraMote program can be used to receive the infrared signals of the RoboSapien remote control by pressing on its buttons and assigning these infrared signals to certain UltraMote buttons. The RoboSapien API assumes that UltraMote has learned at least the following commands and attached it to the specified buttons. UltraMote provides an array of 5x5 buttons:

   1 2 3 4 5
============
1| . A . . .
2| B C D . .
3| . E . . .
4| . . . . .
5| . . . . .

A should be programmed with "Move forward"
B should be programmed with "Turn left"
C should be programmed with "Stop"
D should be programmed with "Turn right"
E should be programmed with "Move backward"

UltraMote stores the assignment of buttons to infrared signals in files called .raw. The button assignments we used are included in the RoboSapien API that can be downloaded from our project page www.nimbro.net. Just copy the whole folder
'RoboSapien' that you will find in 'RS_API\ultramote_key_assignments' into the 'data' folder of the UltraMote folder onto the Pocket PC.


5. Download embedded Visual C++ 3.0 (free)

The RoboSapien API was written in embedded Visual C++ 3.0. This IDE can be downloaded and used for free here from www.microsoft.com.


6. Download the RoboSapien API and start the test behavior program

  • Download the RoboSapien API from our project page www.nimbro.net. This API can be used to program own behaviors for the RoboSapien.
     
  • Open the RS_behavior.vcw project file with embedded Visual C++ 3.0, compile the project and copy the file 'RS_API\ARMRel\RS_behavior.exe' into a folder on your pocket PC.
     
  • If (and only if) you plan to use the Pretec Compact Camera:
    Copy the 'compcam.dll' which is located in 'RS_API\PretecCamera_API\LIB\ARMLib' into the same folder. The camera.cpp class needs this DLL.
     
  • Start the UltraMote-Program with the 'RoboSapien'-buttons-programming. 'RS_behavior.exe' needs it to send infrared signals from the Pocket PC to RoboSapien.
     
  • Now start RS_behavior.exe on your Pocket PC. RoboSapien should now use the FlyCAM camera to capture frames, try to detect an orange pole and run towards it.

Note:

1.)
If you download the embedded Visual C++ 3.0 IDE and start it the default values are set so such that it tries to download the destination executable 'RS_behavior.exe' to a certain folder onto the Pocket PC. This caused severe problems on our system (hang up) so we turned this option off and copied the executable by hand to a folder onto the Pocket PC to start it there. You can turn the 'automatic download option' off by deactivating
'Tools->Options->Reiter 'Download'->'Always download binary to the target'.

2.)
If you use another camera than the FlyCAM or your Pocket PC has not an Intel StrongARM or XScale CPU you need to make small modifications to the example program before compiling and copying it to the Pocket PC (see Step 7).


7. Program own behaviors by modifying the example program

The RoboSapien API package consists of three parts:

- The camera.cpp-class is used as a wrapper class to give access to the Lifeview FlyCAM and the Pretec CompactCam cameras.
- The robot.cpp-class provides motion primitives as turning and moving to control the RoboSapien.
- The RS_behavior.cpp-program is an example program that implements a simple behavior for the RoboSapien robot using the camera.cpp- and the
   robot.cpp-class. RoboSapien will run into the direction of an orange pole if it sees one.

If you want to modify this behavior or program own behaviors for RoboSapien you should modify the
BehaviorThread - method in RS_behavior.cpp.

In this method a camera-object to capture images is created with

camera* p_myCamera;
p_myCamera = new camera();

The camera type has to be defined in the camera_types.h - header file:

#define PRETEC_CF_CAMERA // for using the Pretec Compact Flash Camera
#define LIFEVIEW_FLYCAM  // for using the LifeView FlyCAM

The camera can then be initialized to capture frames of a certain dimension PIC_WIDTH x PIC_HEIGHT with:

p_myCamera->init(PIC_WIDTH,PIC_HEIGHT);

To capture an image you call:

PBYTE p_PicBuffer;
p_myCamera->getPicture(p_PicBuffer);

The data is stored in a byte array (= unsigned char array) p_PicBuffer points to and has a length of PIC_WIDTH x PIC_HEIGHT x 3 bytes, because for each pixel there will be stored 3 bytes: the B-,G-,R-values (in this order).

An object to control the RoboSapien can be created with

robot* p_myRobot;
p_myRobot = new robot();


This object allows to send move- and turning-commands to the robot. For moving call:

p_myRobot->Move(15 ,STEPTYPE_BIGSTEPS);
p_myRobot->Move(-15,STEPTYPE_SMALLSTEPS);

The first call moves the robot approximately 15 cm forward by using the big steps. The second call moves the robot approximately 15 cm backward performing small steps. For turning:

p_myRobot->Turn(15);   // turn 15 degree to the right
p_myRobot->Turn(-15);  // turn 15 degree to the left

You can also move the upper arm up and down in discrete steps:

p_myRobot->MoveUpperArm(Middle, Left);   // moves the left upper arm to a middle position
p_myRobot->MoveUpperArm(Lowest, Right);  // moves the right upper arm to the lowest of all possible positions

The lower arm can be moved with a similar method:

p_myRobot->MoveLowerArm(Inner,  Left);   // moves the left lower arm to the inner
p_myRobot->MoveLowerArm(Center, Right);  // moves the right lower arm to the center position

Tilt the trunk with the following commands:

p_myRobot->TiltTrunk(Left);   // tilts the upper body to the left


Important for compiling:

If the Pocket PC has not an Intel StrongARM or XScale CPU you have to modify two settings in the embedded Visual C++ 3.0 IDE:

- change the target CPU type in the Windows CE configuration target bar of the IDE to the desired CPU type.
  The target .exe-file will then not be found in 'RS_API\ARMRel' or 'RS_API\ARMDbg' but instead in 'RS_API\X86Rel' or
  'RS_API\X86Dbg'.
- change the camera libraries in 'Project->Settings->Reiter 'Link'->library modules'. The FlyCAM and the CompactCam SDKs
  provide different .lib files depending on the type of your Pocket PC CPU. For the Intel's StrongARM and XScale CPUs the
  library files are:
  'FlyCAM_API\LIB\ARM\CE\RETAIL\FlyCAMm1_AV.lib' (for the FlyCAM camera) and
  'PretecCamera_API\LIB\ARMLib\compcam.lib' (for the Pretec CompactCamera)
  Both SDKs also provide libraries for the MIPS and the SH3 CPUs.


We are interested in how many people will use the RoboSapien for robot experiments. Please send an email to 'jmuller at informatik.uni-freiburg.de'
if you
use this example program and write for which robot experiments you are planning to use the RoboSapien.