[[SIGVerse.org:http://sigverse.org]] | [[SIGVerse Forum:http://sigverse.org/sigverse/forum/]] | [[SIGVerse Wiki (JP):http://www.sociointelligenesis.org/SIGVerse/]] | [[SIGVerse Web:http://web.iir.nii.ac.jp/sigverse/web/]] ---- %%%''&size(20){SIGVerse Web};''%%% #contents ---- ** Introduction [#d01a4ae2] SIGVerse Web is a ''Web Interface for SIGVerse Application Development''. Together with SIGViewer, SIGVerse application development can be done without command-line interface terminal (e.g. Cygwin). A light-weight programming editor with multiple languages support is equipped on the system to ease programming jobs. Code compiling (make), building of project files, and execution can be done with just a click. Furthermore, the web-based system also enable development to be carry out anywhere with just an internet browser. Main feature of SIGVerse Web: - Web-based Editor and Compiler - Remote Control SIGServer - Workspace on the Cloud ---- ** Setup [#vd1221fc] - Register and Login Webuser account -- Pull down the top panel for web registration and login http://web.iir.nii.ac.jp/sigverse/web/login/index.php &ref(./Register&Login.png,alt-title-Register & Login on Top Panel); - SIGVerse Installation/Uninstallation -- On the main page, after '''Connect to Socio''', select the desired version and click to install/uninstall SIGVerse. -- ''*Important*'' After clicking the '''Install''' button, please allow some time (~5 mins) for the processing until a long list of output is displayed. Please do not press any other button during the processing. -- Once the installation is completed, you can click '''Go''' to access your '''Workspace'''. &ref(./SetupPage.png,alt-title-Setup Page); - '''* Socio Server Access''' -- In order for SIGViewer to visualize your simulation running on Socio server, you are required to have an access account on the server. Please contact Professor Inamura (inamura@nii.ac.jp) to apply an access account and follow the guide here http://www.sociointelligenesis.org/SIGVerse/index.php?SSH%E6%8E%A5%E7%B6%9A to establish the SSH connection. ---- ** Basic Development Guide [#g3744b5c] - Workspace Overview &ref(./Workspace.png,alt-title-Workspace); -- Project Directory --- The left panel consists of a file navigation for project directory. You can create new project folder and file, upload project file, and even import a whole project (Refer to '''Import''' below). -- Editor Area --- The center area is the editor for programming code developments. It supports multiple programming languages with syntax highlight, search and replace, and multi-tab for working of several files in parallel. -- Control Panel --- The lower panel is the Control Panel for code compiling and execution. --- ''Make'' - To '''make''' controller codes with a Makefile. Please make sure to prepare the Makefile.txt as below (sample): --- Makefile.txt #SIGVerseソースの場所指定 SIG_SRC = ../sigverse-$(sigversion)/include/sigverse #オブジェクトファイルの指定 OBJS = Controller.so all: $(OBJS) #コンパイルを行います。 ./%.so: ./%.cpp g++ -DCONTROLLER -DNDEBUG -DUSE_ODE -DdDOUBLE -I$(SIG_SRC) -I$(SIG_SRC)/comm/controller -fPIC -shared -o $@ $< --- ''Build'' - To "build" the project files into the current SIGVerse version (indicated on the right end of Control Panel). --- ''Import (.zip)'' - To import a project from local machine, upload the zip file of the project (with all files inside) onto Project Directory. Press '''Import''' to extract it (refresh to view the new folder). --- ''Export'' - To download a project in zip format. --- ''Delete'' - To delete a project (with all files inside). --- Execute [Admin] - For administrative purpose only. - Running Simulation -- ''Run'' - To execute SIGServer (./sigverse.sh). -- ''Check'' - To view output of the execution (for possible error). -- ''Kill'' - To terminate SIGServer. ---- ** Tutorials [#i308f6c9] - First Test (Tutorial01) -- To simulate a falling object due to gravitational and external forces. -- Step 1: Create a new project --- Click the '''Add Folder''' icon on the top of the left Project Directory. --- Insert "Tutorial01" and click SAVE. --- A new folder named "Tutorial01" appears on the Project Directory. -- Step 2: Create an agent controller --- An agent is an autonomous object controlled by a controller. --- Click into "Tutorial01" and click '''Add File''' to create the controller source code. --- Insert "MoveController" and select "cpp" as the file type. --- Insert the following codes into the Editor Area and click SAVE. MoveController.cpp #highlight(cpp){{ #include "Controller.h" #include "Logger.h" //ControllerのサブクラスMoveControllerの宣言します。 class MoveController : public Controller { public: //定期的な処理を行うonActionの利用を宣言します。 double onAction(ActionEvent&); }; double MoveController::onAction(ActionEvent &evt) { return 5.0; //次にonActionが呼ばれるまでの時間を返します。 } //自身のインスタンスをSIGVerseに返します。 extern "C" Controller * createController() { return new MoveController; } }} --- The above controller codes do nothing except execute "onAction" on every 5 s. -- Step 3: Compiling the controller codes --- Create a file named "Makefile" with "txt" file type. --- Insert the following codes into the Editor Area and click SAVE. Makefile.txt #SIGVerseソースの場所指定 SIG_SRC = ../sigverse-$(sigversion)/include/sigverse #オブジェクトファイルの指定 OBJS = MoveController.so all: $(OBJS) #コンパイルを行います。 ./%.so: ./%.cpp g++ -DCONTROLLER -DNDEBUG -DUSE_ODE -DdDOUBLE -I$(SIG_SRC) -I$(SIG_SRC)/comm/controller -fPIC -shared -o $@ $< --- Click '''Make''' and refresh the Project Directory to ensure the creation of "MoveController.so" file. -- Step 4: Create a virtual world with the agent --- Create a new file named "NewWorld" with "xml" file type. --- Insert the following codes into the Editor Area and click SAVE. NewWorld.xml #highlight(xml){{ <?xml version="1.0" encoding="utf8"?> <world name="myworld"> <!--重力の設定--> <gravity x="0.0" y="-9.8" z="0.0"/> <!--エージェントToy_Dのインスタンス作成--> <instanciate class="seToy_D.xml"> <!--エージェント名--> <set-attr-value name="name" value="Toy_D"/> <!--C++言語の指定--> <set-attr-value name="language" value="c++"/> <!--作成したコントローラの指定--> <set-attr-value name="implementation" value="./MoveController.so"/> <!--動力学演算フラグ--> <set-attr-value name="dynamics" value="true"/> <!--エージェントの最初の位置(x,y,z)--> <set-attr-value name="x" value="0.0"/> <set-attr-value name="y" value="18.0"/> <set-attr-value name="z" value="5.0"/> <!--エージェントの質量設定--> <set-attr-value name="mass" value="1.0"/> </instanciate> </world> }} --- The above codes create a virtual world named "myworld". --- In the world, an agent named "Toy_D" using the instance of "seToy_D.xml" is created. --- The "implementation" attribute attaches "MoveController.so" as the controller of the agent. --- With the "dynamics" attribute value set to "true", the agent is subjected to dynamics simulation. --- The initial position (x,y,z) and mass are set. -- Step 5: Execute the simulation --- On the Control Panel, build the project by using '''Build'''. --- Set "Port" to 9001 and "World" to "NewWorld.xml" --- Click '''Run''' to execute SIGVerse. --- Click '''Check''' to check the last line of the output is " Java VM start ok" for successful execution. --- Run SIGViewer. Establish SSH connection under Setting. Set host name as "localhost" and port no. to "9001". Click '''Connect to SimServer'''. --- An agent in a virtual world appears as follows. #ref(動力学シミュレーションのサンプル/toy_1.jpg) --- Click '''Send''' under SIM_CTRL_CMD (START) to start the simulation. --- The agent falls straight down the ground. --- '''Disconnect SimServer''' in SIGViewer and '''Kill''' in the Control Panel to terminate the simulation. -- Step 6: Apply external force --- To apply an external force to the agent, edit the agent controller as follows: MoveController.cpp #highlight(cpp:firstline[13]){{ double MoveController::onAction(ActionEvent &evt) { return 5.0; //次にonActionが呼ばれるまでの時間を返します。 } }} ↓ #highlight(cpp:firstline[13]){{ double MoveController::onAction(ActionEvent &evt) { SimObj *obj = getObj(myname()); //自分自身の取得 obj->setForce(0,0,300); //z軸方向に300[N]の力を加える return 5.0; //次にonActionが呼ばれるまでの時間を返します。 } }} --- '''Make''', '''Build''' and '''Run''' the simulation as above. --- The agent moves forward as below. #ref(動力学シミュレーションのサンプル/toy_3.jpg) - Tutorial Project Files -- Tutorial01 - -- Tutorial02 - -- Tutorial03 - -- Tutorial04 - -- Tutorial05 - -- Tutorial06 - -- Tutorial07 - -- Tutorial08 - -- Tutorial09 - -- Tutorial10 - ---- For any inquiry, please contact Jeffrey [jeffrey@nii.ac.jp]. #highlight(end)