RoboCup Rescue Simulation using Google Earth


This documentation is written for version 1.0.0 of RoboCup Rescue Simulation using Google Earth(RCRSuGE). The files are found this web site(http://sakura.meijo-u.ac.jp/~sato2008/Robocup/document/RCRSuGE.zip)
The tool can do following,

  1. Generate Map of Rescue Simulation from GIS data.
  2. View log files of Rescue Simulation on GoogleEarth.



Required environment
Microsoft Windows XP/Vista, Linux, java (later 1.5), ruby(later 1.8), postgreSQL(later 8.0), GoogleEarth.

The tool uses Windows, because ruby AP that can access GoogleEarth are available only Windows.

Windows Linux
java
ruby ~
postgreSQL
GoogleEarth ~

RCRSuGE.zip contains following files,


Installation
Setup System
Run the RCRSuGE
Now problem
Future works

  • Installation
    Running RCRSuGE requires followings,
    1. postgreSQL
    2. ruby
    3. java
    4. GoogleEarth
    5. RoboCup Rescue Simulation

    postgreSQL

      RCRSuGE uses postgreSQL to manage map data.

      Install on Windows.

      Refer postgreSQL's HP. Select Country, and download postgreSQL installer.
      Run the postgreSQL installer.

    ruby

    RCRSuGE uses ruby. Install on windows.
    1. Refer RUBYFORGE, and download ruby186-26.exe(08/7/19).
    2. Run the ruby186-26.exe.
    3. Check installed ruby.

      If terminal outputs following sentence, your computer installed ruby.

      C:\>ruby -v
      ruby 1.8.6 (2007-09-24 patchlevel 111) [i386-mswin32]
    4. Install ruby-postgres

      Install ruby-postgres using rubygems, because ruby is going to be able to access postgreSQL.

    5. Click [windows menu->all programs->ruby->rubygems->rubygems package manager]

      You need to setup proxy of rubygems, when your network uses proxy.

      C:\ruby> set http_proxy=http://YourProxyAddress:port

      YourProxyAddress and port are your status.

      C:\ruby> gem install ruby-postgres
      Bulk updating Gem source index for: http://gems.rubyforge.org
      Select which gem to install for your platform (i386-mswin32)
      1. ruby-postgres 0.7.1.2006.04.06 (ruby)
      2. ruby-postgres 0.7.1.2006.04.06 (mswin32)
      3. ruby-postgres 0.7.1.2006.04.05 (ruby)
      4. ruby-postgres 0.7.1.2006.04.05 (mswin32)
      5. Skip this gem
      6. Cancel installation
      >
      2
    6. Check installed ruby-postgres.
    7. When terminal outputs following sentence, your computer installed ruby-postgres.
      C:\ruby> gem list ruby-postgres (0.7.1.2006.04.06)
      Ruby extension library providing an API to PostgreSQL

    java

    1. Refer java's HP
    2. Run the java installer.
      java is used RCRSuGE and Robocup Rescue Simulation.
      If you use Windows and Linux, you install java both Windows and Linux.

    GoogleEarth

    1. Refer GoogleEarth's HP.

      The tool uses GoogleEarth COM API, because it is going to be able to access GoogleEarth.

    2. Refer Google COM API, and save earth.idl.
    3. Put earth.idl onto directory "C:\Program Files\Google\Google Earth\ "

    4. Input following command with terminal, so the tool can use GoogleEarth COM API.
      C:\> "C:\Program Files\Google\Google Earth\googleearth.exe" /RegServer

    RoboCup Rescue Simulation

    Refer RescueAgents HP
  • Setup system

    Set environment to use RCRSuGE.

    To set environment variables.

    Set following environment variables.

    RUBYOPT=-rubygems
    PGLIB=C:\hogehoge\PostgreSQL\8.2\lib
    Path=c:\hogehoge\ruby\bin;c:\hogehoge\PostgreSQL\8.2\bin
    To create databases and tables.
      Create databases to manage map data.
      Example
      C:\> cd \"Program Files"\PostgreSQL\8.2\bin
      C:\Program Files\PostgreSQL\8.2\bin>
    1. Create a database.
      In example, DBNAME is the name of database to create. USERNAME is the name of the username.
      C:\Program Files\PostgreSQL\8.2\bin> createdb -U USERNAME DBNAME
      Password:
      Input password
      CREATE DATABASE
    2. Access a database.
      C:\Program Files\PostgreSQL\8.2\bin>psql -U USERNAME -h localhost DBNAME
      Password for user postgres::
      Input password

      When terminal outputs following messages, You can use SQL command.

      Type: \copyright for distribution terms
      \h for help with SQL commands
      \? for help with psql commands
      \g or terminate with semicolon to execute query
      \q to quit

      maplist=#
    3. Create following dabatases and tables to store map data and to manage scope.

      Use command list to create tables in maplist.
      Use command list to create tables in Robocup.

      • maplist
        Database named maplist manages scope and areas status.
        • areaoffset
          A table named areaoffset manages areas status.
          The tool creates following datas, when you insert map data.
             Column    |  Type   | Modifiers
          -------------+---------+-----------
           area        | integer | not null
           offset_x    | integer |
           offset_y    | integer |
           nodenum     | integer |
           roadnum     | integer |
           buildingnum | integer |
          Indexes:
              "areaoffset_pkey" PRIMARY KEY, btree (area)

        • scope
          A table named scope manages latitudes and longitudes of objects maps. A column named 'area' related table named maplist.
          The tool insert following datas within a scope that you set.
           Column  |      Type      | Modifiers
          ---------+----------------+-----------
           area    | integer        |
           x_under | numeric(20,10) |
           x_top   | numeric(20,10) |
           y_under | numeric(20,10) |
           y_top   | numeric(20,10) |
           id      | text           | not null
          Indexes:
              "scope_pkey" PRIMARY KEY, btree (id)

      • Robocup
        following tables correspond to the files of RCRS.
        • aichi_test
          The table contains building's apexs.
            Column  |         Type          | Modifiers
          ----------+-----------------------+-----------
           id       | integer               |
           outlinex | character varying(20) |
           outliney | character varying(20) |

        • building
          The table contains building's properties.
              Column    |         Type          | Modifier
          --------------+-----------------------+---------
           id           | integer               | not null
           x            | character varying(20) |
           y            | character varying(20) |
           connectid    | integer               |
           buildingarea | character varying(20) |
          Indexes:
              "building_pkey" PRIMARY KEY, btree (id)

        • road
          The table contains road's properties.
           Column |  Type   | Modifiers
          --------+---------+-----------
           headid | integer |
           tailid | integer |
           id     | integer | not null
           width  | integer |
          Indexes:
              "road_pkey" PRIMARY KEY, btree (id)

        • node
          The table contains node's properties.
           Column |         Type          | Modifiers
          --------+-----------------------+-----------
           id     | integer               | not null
           x      | character varying(20) |
           y      | character varying(20) |
          Indexes:
              "node_pkey" PRIMARY KEY, btree (id)

    To use GIS map data.

    Conditions of map data to use are following,
    1. Get source for windows, and put directory: windows/src onto "C:\Program Files\Google\Google Earth\googleearth\ ".
      • Data of building
        • To insert data of building into tables named building and aichi_test.
          C:\> cd C:\Program Files\Google\Google Earth\googleearth\src\GML
          C:\Program Files\Google\Google Earth\googleearth\src\GML> ruby BuildingInsertSql.rb
        • To convert to KML file from Data of building format GML.
          C:\> cd C:\Program Files\Google\Google Earth\googleearth\src\GML
          C:\Program Files\Google\Google Earth\googleearth\src\GML> ruby GetBuilding.rb

          The tool outputs kml file in Directory: GML/building. The kml file view data of building on GoogleEarth.

      • Data of node and road
        • To insert data of node and road into tables named node and road.
          C:\> cd C:\Program Files\Google\Google Earth\googleearth\src\RCRS-GE
          C:\Program Files\Google\Google Earth\googleearth\src\RCRS-GE> ruby GetData.rb
        • To convert to KML file from old GIS Data of node and road.
          C:\> cd C:\Program Files\Google\Google Earth\googleearth\src\RCRS-GE
          C:\Program Files\Google\Google Earth\googleearth\src\RCRS-GE> ruby GisNode.rb
          C:\Program Files\Google\Google Earth\googleearth\src\RCRS-GE> ruby GisRoad.rb

          The tool outputs kml file in Directory: RCRS-GE/output. The kml file view data of node and road on GoogleEarth.

    When you insert map data which you get in database,
    1. ID of map data may not be unique.
    2. You must change program.
    Please wait version up.
    To change program of RoboCup Rescue Simulation

    Copy programs, in directory:Linux/src, onto name accords Directories in Robocup Rescue Simulation.


  • Run the RCRSuGE
    1. Run the RCR.rb.
    2. Run the ConvertToBin.bat.
    3. Copy Map data of RCRS.
    4. Run the RCRS.
    5. Copy snapshots.
    6. Run the RCRprint.rb
    7. View logfile of RCRS on GoogleEarth.

    1. Run the RCR.rb

      C:\> cd C:\Program Files\Google\Google Earth\googleearth\src
      C:\Program Files\Google\Google Earth\googleearth\src\> ruby RCR.rb
      1. Viewing KML file(building ,road) on GoogleEarth.
        Viewing KML file of building in GML/building and road in RCRS-GE/output on GoogleEarth.
        Create scope:1
        Delete one scope:2
        Delete all scope:3
        Convert to txt files from GIS:4
        Open kml file:5
        Put scope on GoogleEarth:6#un-supported
        Exit number:99
        Input:5
        "kmlfile of Building"
        [".", "..", "building_23116_2.kml"]
        Input filename of kml: building_23116_2.kml
        "kmlfile of road"
        [".", "..", "23623node.kml", "23623road.kml"]
        Input filename of kml: 23623road.kml
        Do one more ? yes / no:
      2. Save scope
        Save scope into table named scope.
        Elements of scope are latitudes and longitudes of scope outputting window of GoogleEarth.
        C:\Program Files\Google\Google Earth\googleearth\src\>ruby RCR.rb
        Manage MAP of Robocup simulation Using GoogleEarth
        Create scope:1
        Delete one scope:2
        Delete all scopes:3
        Open kml file:5
        Put scope on GoogleEarth:6#un-supported
        exit:99
        input:1
        Save point of Simulation.
        Set scope yourself.

        When you set a scope,viewing location is point viewed direct above.Check it seeing upper right-hand compass.
        Or the tool may not create map data of RCRS.

         
        Ready? yes or no:yes
        x-width:2529.98385362676(m)
        y-width:1943.37507611534(m)
        Input ID's name this scope:****
        Do one more ? yes / no:
      3. Conversion to txt file from map data in database in scope to select.
        The tool outputs onto output/scopename? txt file of building, buildingcenter, road, node, offset.log, galpolydata.dat and shindopoly.dat.
        These txt files contain following,
        (example)
        • Txt file of building contains building ID and building apex.
        • Txt file of buildingcenter contains building ID and center point of building.
        • Txt file of road contains tailid, headid, road ID, and width(constant).
        • Txt file of node contains node ID and point of road.
        The offset.log contains following,
        (example)
        • Offset.log decide when Area of scope match area of areaoffset.
        • Offset.log is column offset_x,offset_y in table areaoffset.
        The galpolydata.dat and shindopoly.dat contains following,
        (example)
        • Two dat files are size of scope.
        scopename? is the name of the scope.
        Do one more ? yes / no: yes
        Create scope:1
        Delete one scope:2
        Delete all scopes:3
        Convert to txt file from GIS:4
        Open kml file:5
        Put scope on GoogleEarth:6#un-supported
        Exit:99
        Input number:4
        Input username on database:****
        Input password:****
        ["tenpaku-small", "tenpaku", "tenpaku-big", "atsumi3", "atsumi2"]
        Select Scope Converting:****
        Make galpolyfile
        Make shindopolyfile
        Make offsetfile
        Make nodefile,node count 238
        Make roadfile,road count 349
        Make buildingfile,building count 298
    2. Run the ConvertToBin.bat
      1. Select a directory to create txt files.
        The tool Converts BIN files of RCRS from txt files.
        c:\Program files\Google\Google Earth\src>ConvertToBin.bat
        atsumi2
        atsumi3
        select directory:directoryname?
        directoryname? is the name of the directory.
      2. Automatic random generation at gisini.txt.

        * is arbitrarily number. Number of IgnitionPoints, Fire Stations, AmbulanceCenters and PoliceOffices aren't over number of building.

        Input the number of Civilians :*
        Input the number of FireBrigades :*
        Input the number of Ambulances :*
        Input the number of PoliceForces :*
        Input percentage of Agents in Building (Integer):*
        Input the number of IgnitionPoints :*
        Input the number of Refuges :*
        Input the number of FireStations :*
        Input the number of AmbulanceCenters :*
        Input the number of PoliceOffices :*

        The tool outputs MAP files in Directory: src/output/hogehoge/MAP.

        Map files contains following;
        • building.bin
        • node.bin
        • road.bin
        • galpolydata.dat
        • shindopolydata.dat
        • gisini.txt
      The tool doesn't create brockades.lst.

    3. Copy MAP data of RCRS

      Create arbitrarily Directory in Directory: RCRS/maps/.(Now Directory's name is atsumi)
      Copy output MAP files onto Directory: RCRS/maps/atsumi/

    4. Run the RCRS

      hogehoge@$ cd home/hogehoge/0.49plus/boot
      hogehoge ~hogehoge/0.49plus/boot$ ./all.sh atsumi
      wait a minutesEEE
      hogehoge ~hogehoge/0.49plus/boot$ ./sampleagent.sh
      The tool outputs snapshots onto Directory: boot/viewer42/robocupsample every step.
      You can change config of snapshot, if you edit viewer.conf on Diretory:boot/viewer42.

    5. Copy snapshots

      Copy snapshots which are got in Linux onto src/RCRsql/output/atsumi/image (Now Directory's name is atsumi).

    6. Run the RCRprint.rb
      C:\> cd c:\Program Files\Google\GoogleEarth\src\RCRsql C:\Program Files\Google\GoogleEarth\src\RCRsql:> ruby RCRprint.rb

      The tool outputs KML file viewing on GoogleEarth onto Directory: src/RCRsql/output/atusmi/image/.

    7. View logfile of RCRS on Googleearth.
      You view KML file on GoogleEarth, and view logfile of RCRS on GoogleEarth.

  • Now problem.
  • Future work.