High-Fidelity Simulator

From TeamTalk
Jump to: navigation, search

The High-Fidelity Simulator is a system that works with TeamTalk as a set of virtual Boeing Treasure Hunt configured MOAST robots running in a USARSim theater. Here's a 0:54 video clip of a session with a screen capture of the TeamTalk interface, overlaid with the concurrent Unreal Client video.

Contents

Components

Virt system.png

The following four components make up the high-fidelity simulation system interacting with TeamTalk.

Requirement Realized By Component Notes
A virtual world with physics A Windows machine, (or Linux with caveats) running the USARSim server. The server runs natively under Linux, however compilation can only be done in Windows (or under WINE). The level editor requires Windows and does not run under WINE.
A human-centric visualization of the virtual world Another Windows or Linux machine (with a decent video card) running an Unreal client. The Unreal maps and models cause frame rates to drop to unacceptable levels without a decent video card. We're currently using the ATI Radeon X1800GTO. Conceivably the server and client can run on the same machine, but care needs to be taken as both processes can cause significant CPU loads. In particular the client tends to use whatever resources a particular machine has in order to maximize the realism.
A camera emulation for the robots Yet another Windows machine running the Image Server (ImageSrv) ImageSrv is a wrapper around an Unreal Tournament client. It runs an Unreal Tournament client, and manipulates the virtual position of the client so that images are rendered as if they came from a camera mounted on the robot. The virtual positions can be multiplexed, so that one ImageSrv suffices to serve as multiple cameras (with lower frame-rate). The underlying Unreal client cannot run in conjunction with any other Unreal client on the same machine, so it is not possible to run the Image server on the Unreal client machine. It is conceivable that the Image Server runs on the same machine as the USARSim server or even the TeamTalk tablet; however, one must be careful about CPU constraints.
Virtual autonomous robots operating in the virtual world x additional Linux machines running BTH/MOAST 1 per simulated robot
Required Components

Installation and Configuration

Software Requirements

Software Requirements Required at Build-time by Required at Run-time by Notes
Unreal Tournament 2004 USARSim USARSim, Unreal client, and ImageSrv If you have the Editor's Choice edition, unselect the ECE mods during install. In the examples below, Unreal Tournament is installed in C:\UT2004 on Windows and UTROOT on Linux.
The NIST Real-Time Control Systems Library MOAST MOAST
gcc and gcc-c++ on Linux MOAST
Subversion USARSim, ImageSrv, BTH/MOAST We recommend the useful Subversion Windows Explorer plug-in: ToirtoiseSVN.
Software Infrastructure Requirements

Optional Software

Software Requirements Required at Build-time by Required at Run-time by Notes
Microsoft Visual Studio 2005 with Visual C++ ImageSrv Compiling ImageSrv may be difficult and may not be necessary, see Image Server Installation
Microsoft DirectX SDK ImageSrv Compiling ImageSrv may be difficult and may not be necessary, see Image Server Installation
Simple Direct Media Layer version >= 1.2.8</strike> BTH/MOAST BTH/MOAST SDL is used by MOAST for it's joystick interface. We don't use the joystick controls, so this is not necessary. Modern Linux distributions should already have this in any case (try sdl-config --version). If you're installing SDL outside of /usr/local, be sure to set the SDL_CONFIG environement variable to the path of your local sdl-config file before attempting to build BTH/MOAST.
Optional Software Infrastructure

USARSim Server

The Linux installation works, but is not recommended because it is complicated by the need to run system compilation under WINE.

Windows

  1. Install Unreal Tournament 2004.
    • Uninstall any previous versions of UT2004
    • If you have the Editor's Choice edition, unselect the ECE mods during install.
  2. Apply the latest UT2004 patch[1].
  3. Install the USARSim Base Files (Only Version 3.14). These should go into your UT2004 folder.
  4. Install the AAA_MapBaseFiles[2]. These should go into your UT2004 folder.
  5. Checkout project-specific code (using subversion)
  6. NOTE: Subversion will not overwrite unversioned directories, so you'll have to temporarily move or rename the following folders:
    • Animations, Maps, Sounds, StaticMeshes, System, Textures
    • Once you have the code checked out copy (without overwriting) the contents of the old folders into the new ones.
  7. Compile.
    C:\UT2004\System> make.bat
    

Linux

Since compilation can only be done in Linux under WINE. Development installations of the USARSim server will require two installations, an installation under WINE for compilation and a native Linux installation for running.

  1. Load Unreal Tournament 2004. If you have the Editor's Choice edition, unselect the ECE mods during install.
    1. Under WINE, we run
      [~/.wine/d:]$ wine Setup.exe
      
      Install into UTROOT/ut2004-windows
    2. For our native Linux installation, we run the Linux installer
      [UTROOT]$ cp /media/UT2004ECE/linux-installer.sh .
      [UTROOT]$ ./linux-installer.sh
      
      Install into UTROOT/ut2004-linux
  2. Apply the latest patches[3] for both the wine and native installations.
  3. Install the AAA_MapBaseFiles[4]. This is only necessary to do for the runtime (native Linux) installation.
  4. Checkout (with subversion) http://trac.speech.cs.cmu.edu/repos/teamtalk/trunk/usarsim (for the latest, 10:07, 31 August 2007 (EDT), stable version use http://trac.speech.cs.cmu.edu/repos/teamtalk/tags/BTH-0.2/usarsim) into both the WINE and Linux installations. Subversion will not overwrite unversioned directories, so you will need to temporarily move the System and Maps directories before the checkout; then copy (without overwriting) the files back into that directory after the checkout. Here's a line-by-line example for the WINE installation:
    [UTROOT/ut2004-windows]$ mv System System.sav
    [UTROOT/ut2004-windows]$ mv Maps Maps.sav
    [UTROOT/ut2004-windows]$ svn co http://trac.speech.cs.cmu.edu/teamtalk/usarsim/trunk .
    [UTROOT/ut2004-windows]$ mv -i System.sav/* System
    [UTROOT/ut2004-windows]$ mv -i Maps.sav/* Maps
    [UTROOT/ut2004-windows]$ rm -rf *.sav
    
  5. Compile with
    [UTROOT/ut2004-windows/System]$ make
    
    The make script will compile USARSim under WINE, and then copy the made files into the native Linux installation.

CMU

Since we already have a dedicated server up and running you may prefer to skip this step and just use that server.

Unreal Client

If you plan to run the client on the same machine as the server (see requirements in High-Fidelity Simulator#Installation Overview), then you can skip client installation. The client is installed with the server. If you're running the client on another machine:

  1. Load Unreal Tournament 2004
  2. Apply the latest patch[5].
  3. Install USARSim-2004
  4. You'll need to copy the TreasureHunt files to the client. Note that you cannot simply build from the same sources on both the client and server as you might expect. You'll get a version mismatch error that way.
  • If you have a Linux server: The Linux server creates a TreasureHuntSim.zip package (which is created in the build process). It will be created in the root Unreal Tournament directory of the server. Unzip it in the root Unreal Tournament folder of the client after every server build.
  • If you have a Windows server: The Windows build script creates a TreasureHuntSim folder in the the root Unreal Tournament directory of the server. TreasureHuntSim.zip will be inside of that folder. You can share the TreasureHuntSim folder in Windows and extract the contents of TreasureHuntSim.zip onto the root of your client's Unreal tournament installation.

CMU

If you're using the dedicated server, it should publish the TreasureHunt package here, http://xxx.speech.cs.cmu.edu/Sim/TreasureHuntSim.zip, just replace xxx with the hostname. Unzip it in the root Unreal Tournament folder of the client after every server build.

Image Server

ImageSrv is a wrapper around an Unreal Tournament client. It runs an Unreal Tournament client, and manipulates the virtual position of the client so that images are rendered as if they came from a camera mounted on the robot. The virtual positions can be multiplexed, so that one ImageSrv suffices to serve as multiple cameras (with lower frame-rate). The underlying Unreal client cannot run in conjunction with any other Unreal client on the same machine, so it is not possible to run the Image server on the Unreal client machine. It is conceivable that the Image Server runs on the same machine as the USARSim server or even the TeamTalk tablet; however, one must be careful about CPU constraints.

Note: Steps 1-2 can be skipped if you've already installed an Unreal client on this machine, and steps 1-3 can be skipped if you've already installed a USARSim server on this machine.

  1. Load Unreal Tournament 2004
  2. Apply the latest patch[6].
  3. Checkout ImageSrv
    1. For the main development trunk use http://trac.speech.cs.cmu.edu/repos/teamtalk/trunk/usarsim/Tools/ImageSrv.
    2. For the latest, 10:07, 31 August 2007 (EDT), stable version use http://trac.speech.cs.cmu.edu/repos/teamtalk/tags/BTH-0.2/usarsim/Tools/ImageSrv.
  4. Compile ImageSrv.sln with MSVC++.
    The current version of ImageSrv was built against DirectX 8, and is incompatible with the current Microsoft DirectX SDK distributions. As such it cannot be compiled unless one has a working DirectX 8 SDK. Most Windows systems, however, should have run-time DirectX 8 libraries. A compiled ImageSrv.exe is included in the distribution.
  5. Copy ImageSrv.exe, FreeImage.dll, and Info.html into the System directory.

BTH/MOAST Robots

Before starting, ensure you're working with a 32-bit machine.

  1. Set the RCSLIB_DIR environment variable to point to where the NIST Real-Time Control Systems Library directory will be installed installed (folder will contain bin, lib, and include folders), and (if installed outside of your normal library load path) append the RCS lib directory to the LD_LIBRARY_PATH. An example in tcsh, assuming that the RCS install prefix was your home directory:
    [~]$ setenv RCSLIB_DIR `pwd`
    

    then: if your environment variable field is NOT empty:

    [~]$ setenv LD_LIBRARY_PATH $LD_LIBRARY_PATH:$RCSLIB_DIR/lib
    

    OR if your environment variable field is empty:

    [~]$ setenv LD_LIBRARY_PATH ${RCSLIB_DIR}/lib
    
  2. Build and install static only version of the NIST Real-Time Control Systems Library from http://www.isd.mel.nist.gov/projects/rcslib/getrcs.html . You must have root access to do a make install without setting an install prefix to configure. Example Command to Build and Install:
    [~]$ ./configure --prefix=$RCSLIB_DIR --enable-shared=no && make && make install 
    
  3. Get the BTH/MOAST package via subversion.
  4. Do an SVN Checkout for the treasure_hunt folder, while in the moast-bth directory:
    [~]$ svn checkout svn://metropolis.cta.ri.cmu.edu/treasure_hunt/trunk treasure_hunt
    
  5. Copy Makefile.conf.sample to Makefile.conf in RubyPlayManager folder.
    [~]$ cd RubyPlayManager/
    [~]$ cp Makefile.conf.sample Makefile.conf
    
  6. Make (32-bit OS required). You may need to loosen your permissions to execute make. You can safely ignore warnings about SDL (see #Software Requirements).
    [moast-bth]$ ./bootstrap
    [moast-bth]$ make
    

Configuration

For consistency, the robots can be configured using the same configuration file that TeamTalk uses (see User's Guide#Configuration). You may copy moast-bth/TeamTalkSimulator/peerfile-example.txt (as shown below) into moast-bth/TeamTalkSimulator/peerfile.txt, and edit as needed.

alphie 127.0.0.1:32787 callie safe
bashful 127.0.0.1:32788 david dangerous

You must also edit the moast.ini file located in moast-bth/moast/etc/moast.ini so that HOST_NAME is equal to the IP address of the USARSim server.

...
[USARSIM.INFSKIN]
HOST_NAME=XYZ.SPEECH.CS.CMU.EDU
PORT_NUMBER=3000
PLATFORM_TYPE_1=P2DX
PLATFORM_TYPE_2=P2AT
...

Running

Keep in mind the following run-time component dependencies when running the Simulation

  • TeamTalk -> MOAST/BTH -> USARSim (and Image Server)
  • MOAST/BTH -> USARSim (and Image Server)
  • Image Server -> USARSim
  • Unreal Client -> USARSim

Note that TeamTalk per se doesn't depend on the Unreal Client, the Unreal client is an extra-TeamTalk visualization tool.

Given the dependencies, here's a safe order to run things (followed by TeamTalk).

USARSim Server

  1. From the System directory, run

Linux

[UTROOT/ut2004-linux/System]$ ./usar_sx.sh DM-RoboticsLab_250

At CMU, this directory exists here: /usr0/ut2004-linux/System/

Windows

C:\UT2004\System> usar_sx.bat DM-RoboticsLab_250
C:\UT2004\System> usar_sx.bat MRM-GameMapv1

Unreal Client

  1. From the System directory, run
ut2004 HOST?game=TreasureHunt.TreasureHuntGame?TimeLimit=0?GameStats=False?NumBots=0 -ini=USARSim.ini -log=usar_server.log

where ut2004 is the full path to UT2004.exe and HOST is the host name of the USARSim server. A shortcut may be useful.

PW=findT

Image Server

Run ImageSrv. Set the server (127.0.0.1 by default) to the hostname of the USARSim server.

BTH/MOAST Robots

Set the USARSimHost environment variable to the hostname of the USARSim server. Also, start up X-Win32 if you are running the simulation robots remotely.

Since several computers may be needed, the system may run in a PBS queue, but this is not strictly necessary.

Not in PBS queue

[moast-bth/TeamTalkSimulator]$ ./Simulator.pl

With PBS

Remember to have your home directory be set to outside your AFS space. Place your SSH credentials on the queue and have them symbolically linked on your AFS space: http://www.speech.cs.cmu.edu/inner/ssh-keys.html.

[moast-bth/TeamTalkSimulator]$ ./qSimulator.pl

To close all tasks associated with the simulator:

[moast-bth/TeamTalkSimulator]$ qdel $ticket
Personal tools