High-Fidelity Simulator

From TeamTalk
Revision as of 17:09, October 18, 2007 by Matt (Talk | contribs)

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.
The NIST Real-Time Control Systems Library MOAST MOAST
gcc and gcc-c++ on Linux MOAST
Microsoft Visual Studio 2005 with 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
Subversion USARSim, ImageSrv, BTH/MOAST I also find the Subversion Windows Explorer plug-in ToirtoiseSVN useful.
Simple Direct Media Layer version >= 1.2.8 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.
Software Infrastructure Requirements

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. Load Unreal Tournament 2004. If you have the Editor's Choice edition, unselect the ECE mods during install.
  2. Apply the latest 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 (with subversion) http://edam.speech.cs.cmu.edu/repos/teamtalk/trunk/usarsim (for the latest, 10:07, 31 August 2007 (EDT), stable version use http://edam.speech.cs.cmu.edu/repos/teamtalk/tags/BTH-0.2/usarsim) into the UT2004 directory. Subversion will not overwrite unversioned directories, so you'll have to temporarily move the System and Maps directories during the checkout; then copy (without overwriting) the files back into that directory.
  6. 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 USARSim Base Files (Only Version 3.14) for both the wine and native installations.
  4. Install the AAA_MapBaseFiles[4]. This is only necessary to do for the runtime (native Linux) installation.
  5. Checkout (with subversion) http://edam.speech.cs.cmu.edu/repos/teamtalk/trunk/usarsim (for the latest, 10:07, 31 August 2007 (EDT), stable version use http://edam.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://edam.speech.cs.cmu.edu/teamtalk/usarsim .
    [UTROOT/ut2004-windows]$ mv -i System.sav/* System
    [UTROOT/ut2004-windows]$ mv -i Maps.sav/* Maps
    [UTROOT/ut2004-windows]$ rm -rf *.sav
    
  6. Compile with
    [UTROOT/ut2004-windows/System]$ ./make.csh
    
    The make script will compile USARSim under WINE, and then copy the made files into the native Linux installation.

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.
    1. 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.
    2. The Windows batch file build does not create this package. You should
      1. Get the TresureHunt distribution from the subversion repository and put it on the client.
      2. Copy all of the .u files in the System directory from the server to 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://edam.speech.cs.cmu.edu/repos/teamtalk/trunk/usarsim/Tools/ImageSrv.
    2. For the latest, 10:07, 31 August 2007 (EDT), stable version use http://edam.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

  1. Install the NIST Real-Time Control Systems Library from http://www.isd.mel.nist.gov/projects/rcslib/getrcs.html
  2. Set the RCSLIB_DIR environment variable to point to the RCS directory, 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`
    [~]$ setenv LD_LIBRARY_PATH $LD_LIBRARY_PATH:$RCSLIB_DIR/lib
    
  3. Get the BTH/MOAST package via subversion.
  4. 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

Running

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

  • TeamTalk -> MOAST/BTH
  • 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.csh DM-compWorldDay2_250

Windows

C:\UT2004\System> usar_sx.bat DM-compWorldDay2_250

Unreal Client

  1. From the System directory, run
ut2004 HOST?quickstart=true -ini=USARSim.ini

where HOST is the host name of the USARSim server.

HOST=rampsold 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.

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]$ ./runSimulator.sh

With PBS

[moast-bth/TeamTalkSimulator]$ qsub -q i686 -I
[moast-bth/TeamTalkSimulator]$ ./runSimulator.sh
Personal tools