#contents

* Test 1 [#mac35c2d]

** Execution of SIGVerse [#t5321241]
Execute SIGVerse server on the server. 
  $ cd ~/sigverse-<version>/bin

You can execute the SIGVerse server, using shell script sigserver.sh put on ~/sigverse-<version>/bin. You should specify a port number with -p option to be used for server/client connection. You should choose free port number. Over 9000 is recommendation.
  $ ./sigserver.sh -p 9001

 [SYS]  data directory :
 [SYS]   [1]  /home/<username>/sigverse-100317/share/sigverse/data/xml/
 [SYS]   [2]  /home/<username>/sigverse-100317/share/sigverse/data/shape/
 [SYS]  world file : MyWorld.xml
 [SYS]  reading /home/<username>/sigverse-  100317/share/sigverse/data/shape/sample3.x3d...
 read /home/<username>/sigverse-100317/share/sigverse/etc/X3DParser.cfg
 *** JavaVMOption ***
 options[0].optionString = (-Djava.class.path=/home/okamoto/sigverse-  
 
 &b100317/share/sigverse/jar/X3DParser.jar:/home/<username>/sigverse- 
 
 100317/share/sigverse/jar/xj3d-all.jar)
 options[1].optionString = (-Djava.library.path=/tmp)
 Java VM start ok
 all done.[SYS]  waiting for connection...

The above messages indicates that the SIGVerse server have started.

Puch Ctrl-z to suspend the server to progress the next step.


** Stop of SIGVerse server [#s82876bf]

If you didn't quit the SIGVerse server, the port number used in the process will be blocked. You should quit the process with kill command.

The following shell script is one of the useful solution.
 $ cd ~
 $ emacs kill.sh

 #!/bin/bash
 
 for i in `ps aux | grep sig | grep <username> | awk '{print $2}'`; do
     echo process id: $i
     kill -9 $i
 done
 
// for i in `ps aux | grep sigserver | grep <username> | awk '{print $2}'`; do
//     echo process id: $i
//     kill -9 $i
// done

<username> indicates your account ID.

 $ chmod 744 kill.sh
 $ ./kill.sh
     :
 [1]+  Stopped           ./sigserver.sh -p 9001  (wd: ~/sigverse-100908/bin)
The following message indicates quit of the process.

If you don't know detail mechanism of process management, you should execute kill.sh after you used the SIGVerse on host server.



//**SIGViewerの起動 [#k2157e91]
//
//インストールが完了したら、サーバ側でまずSIGVerseを起動します。
//
//$ cd ~/sigverse-<version>/bin
//$ ./sigserver.sh -p 9001

//次にSIGViewerを起動し、"Connection"の枠の中にある"server host name"に接続するサーバのホスト名、"server port No"にサーバで-pオプションを使って指定したポート番号を入力します。ポートフォワーディングによる接続方法は[[こちら>ポートフォワーディングでサーバに接続する方法]]

//次にサーバ側でSIGVerseを起動した状態でSIGViewerの"Connect to SimServer"ボタンを押してサーバに接続します。

//※この時firewallによるブロックを行いますかと聞かれることがあります。ここではfirewallによるブロックを解除するを選択してください。firewallによるブロックをすると一部使えない機能があります。


//#ref(inst_1.jpg)

//ここでSIGViewerで接続しても現時点では何も見えないと思います。

//SIGViewerを終了するときは、Disconnect SimServerボタンをクリックして接続を断ってから終了します。

//**SIGViewerの設定 [#r909f8c1]

//SIGViewerの設定はインストールした場所
//(デフォルトではc:\Program Files)
//の

//SIGViewer_*.*\release\
//
//にあるstartup.cfgで行います。
//
//このファイルではSIGViewerのカメラの位置や視線の方向などの設定を行えます。


*テスト実行2 [#k98de9c8]
*Test 2 [#s6aed4d4]

次に世界ファイルというものを作成して仮想世界にオブジェクトを登場させます。
Next, try to put several objects on virtual environment using world file.

**世界ファイル作成 [#z2214ae9]
** Making of world file [#gde6249c]
 $ cd ~/sigverse-<version>/share/sigverse/data/xml
ここに世界ファイルを作成します。世界ファイルはxmlファイルで記述されており、仮想世界に登場するキャラクターの設定を行います。
You should put the world file on this directory. The world file is described in XML format; it configures properties of objects and agents

 $ emacs test.xml

test.xml

 <?xml version="1.0" encoding="utf8"?>
 <world name="myworld">
 
   <!--重力の指定-->  
   <!--gravity parameter-->  
   <gravity x="0.0" y="-9.8" z="0.0"/> 
   
   <!--登場キャラクターのインスタンス作成-->
   <!--Create instance of agents-->
   <instanciate class="seToy_D.xml">
 
         <!--キャラクターの名前-->
         <!--Name of agent-->
         <set-attr-value name="name" value="Toy_D"/>
         
         <!--動力学演算の機能off-->
         <!--Switching of dynamics calculation-->
         <set-attr-value name="dynamics" value="false"/>
        
         <!--C++言語の指定-->
         <!--Set language of controller: C++ -->
         <set-attr-value name="language" value="c++"/>
 
   </instanciate>
 </world>

※ファイル保存時にコードシステムを聞かれたらutf-8を入力します。
The above world file will put one penguin agent in the virtual environment.

これは仮想世界にペンギンのキャラクターを登場させる世界ファイルです。
** Execution [#zb401a43]
Execute the SIGVerse server by the following commands.

**起動 [#uaa20dda]
それではSIGVerseを起動してみましょう。

 $ cd ~/sigverse-<version>/bin
 $ ./sigserver.sh -w test.xml -p 9001 &

先ほど作成した世界ファイルを-wオプションで指定しました。
The world file created on the previous section is specified by -w option.

次にSIGViewerを起動して接続先のホスト名、上で起動したポート番号を入力して、"Connect to SimServer"ボタンを押してサーバに接続します。
Next, input host server name and port number on SIGViewer; Click "Connect to SimServer" to connect to the server.


#ref(test_1.jpg)

ペンギンのようなキャラクターが見えます。
You must see the penguin agent.

接続が完了したら、サーバ側では以下のようなメッセージが出ます。(ポートフォワーディングによる接続時のメッセージ)
You can see the following messages after the establishment of connection. (if you uses port forwarding)
 all done.[SYS]  waiting for connection...
 [SYS]  attach view : polling
 [SYS]  127.0.0.1 connected
 [SYS]  SIGViewerDataPort : dataport
 [SYS]  127.0.0.1 connected
 [SYS]  127.0.0.1:8000  : service provider
 [SYS]  127.0.0.1 connected

You can change the direction of eyesight, with pushing Ctrl button and click right button of the mouse with putting the mouse pointer on the frame of SIGViwer.


SIGViewerの視点や方向を変えるには画面上でCtrlを押しながら右クリック(または右クリックのみ)でマウスを動かします。



//それではSIGViewer、メインサーバを一度終了します。(この時先ほど作成したkill.shを実行します。)

**キャラクターへのアタッチ [#w06ddb12]
** Attachment of controller to agent. [#g5d2f358]

このキャラクターを動かす為にはコントローラを作成し、登場するキャラクターにアタッチしなければなりません。ここではすでにいくつかのコントローラのサンプルが用意されているのでそれを使ってテスト実行してみましょう。
Controller should be attached on every agents to control.
You can attach several sample controllers. Let's test the attachment with this sample controllers.


//まずSIGVerseを起動します。
// $ cd ~/sigverse-<version>/bin
// $ ./sigserver.sh -w test.xml -p 9001 &

// all done.[SYS]  waiting for connection...

//この状態ではメインサーバではエージェントがアタッチされるのを待っています。

それでは準備されているサンプルコントローラバイナリを読み込み、エージェントにアタッチします。(Enterキーを押すとコマンドが使えます。)
Input the following commands when you can see the penguin agent.
This commands read a controller module and attach it to the agent.

ペンギンが見えている状態で以下のコマンドを実行します。

 $ ./sigrunac -l ../share/sigverse/samples/GoRound.so -n Toy_D -p 9001

If you can see the below message, attachment is succeeded.

 [SYS]  Controller attached to "Toy_D"
 [SYS]  127.0.0.1 connected
 [SYS]  Toy_D : dataport
 [SYS]  127.0.0.1 connected

これでキャラクタ-にアタッチしました。
sigrunacはコントローラをシミュレーションサーバ中のエージェントにアタッチしてテストするためのツールです。-lオプションでアタッチするコントローラライブラリを指定します。サンプルのコントローラライブラリは
sigrunac attaches the specified controller module to a agent. Controller module is specified by the -l option; a name of target agent should be specified by -n option.
You can use several sample controllers put on the
following directory.
 sigverse-<version>/share/sigverse/samples/
For example, GoRound.so controls make an agent roll at initial position; Toy_D is the name of penguin like agent.

sigverse-<version>/share/sigverse/samples/
** Confirmation of control by SIGViewer [#e8a2a1fe]
Next is confirmation of agent control by SIGViewer

にいくつか用意されています。
GoRound.soというコントローラは登場するキャラクターがぐるぐる回るサンプルです。
Click Send button after changing the status of SIM_CTRL_CMD frame to START.

-nオプションでアタッチするエージェントの名前を指定します。Toy_Dは先ほどのペンギンのようなキャラクターの名前です。

**SIGViewerで動作確認 [#d8e640c8]
それではシミュレーションを開始してみましょう。

次にSIM_CTRL_CMDの枠の中がSTARTとなっている状態でSendボタンを押してシミュレーションを開始します。


#ref(test_2.jpg)

ペンギンがぐるぐる回転しているのが見えましたでしょうか?
You should see the penguin agent is rolling in the SIGViewer.

If you want to quit the SIGVerse server, click the Send button after changing SIM_CTRL_CMD frame to STOP.

シミュレーションを停止するにはSIM_CTRL_CMDの枠の中がSTOPとなっている状態でSendボタンを押します。
Let's go to the next section, how to make the controller.

それではいったんSIGViewerを終了しましょう。
次はいよいよコントローラを作成します。
LEFT:[[Back>Tutorial]]
RIGHT:[[Next (Sample of dynamics simulation) >Samples/Dynamics simulation]]

LEFT:[[戻る>環境設定]]
RIGHT:[[次へ>動力学シミュレーションのサンプル]]


Front page   New List of pages Search Recent changes   Help   RSS of recent changes