~opencog-dev/embodiment-mv1.5-proxy/trunk

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
=========================================
Opencog's Embodiment Proxy for Multiverse
=========================================

This file contains instructions for building and running the Opencog's
Embodiment Proxy within an instance of Multiverse server. It also
explains how to configure and run the MV Client for connecting to a
Multiverse world prepared for Opencog's embodiment agents.
For all instructions bellow, when you read ${mv-proxy}, it means the
folder where this README file is, i.e., the root folder of the
mv-proxy you've checked out from version control repository.

NOTE: "Petaverse" was the former name of project for intelligent pets
before it became part of Opencog project, when it was renamed to
Embodiment (for an "opencog brain"). So, wherever you read "Petaverse"
in this file or any source files of this project, it actually means
"Opencog's Embodiment". 

1) Install and configure prerequisite software. 
   In summary, you just need to follow the instructions from
   Multiverse site:
   http://update.multiverse.net/wiki/index.php/Platform_Tutorial_Getting_Started#Install_prerequisite_software
   with some minor changes/comments, as follows:
     - About Java JDK installation, If you're going to run MV-Proxy on
     Windows, you may have problems related to path to the server
     jvm. If so, put the folder where SDK's java.exe was installed
     inside the PATH environment variable (as the first option). For
     that, open  "Control Panel->System->Advanced->Environment
     Variables" window. At "System Variables" section (changing user
     variables will not work fine), find and edit the PATH variable. 
     - You don't need to download/install MySQLConnector/JDBC driver,
     since it is already included in mv-proxy project (which is where
     this file is) 
     - If you intend to run MV-Proxy on  Windows, Cygwin is not
     optional, as the site states. That's because we've set only
     shell script files properly for running MV-Proxy. Besides,
     these script files provide a more complete and stable set of
     features for running and monitoring multiverse process than the
     windows batch files do (so .bat files were not included in this
     project)
     - When you reached the "Extract server files", you're done, since
     the server files are included in this project as well.
     - Ant (http://ant.apache.org) may also be needed, if you're going
     to change and re-build the MV-Proxy java code. Unless you want
     to set up a java project in an IDE (we've been using Eclipse,
     by the way). 

1.1) Link-grammar
   - MV-Proxy make use of RelEx
   (http://www.opencog.org/wiki/RelEx_Semantic_Relationship_Extractor)
   to transform natural language commands into structures that can be
   understood by the Opencog agents. RelEx has a dependency of a third
   party library called link-grammar
   (http://www.abisource.com/projects/link-grammar/). Link-grammar is
   written in C. As the MV-Proxy is written in Java, we are using a
   JNI binding to link-grammar. Both RelEx and
   link-grammar(binding).jar files can be found at
   ${mv-proxy}/server/other/relex. To avoid compatible problems, do
   not try to use another version of these libs.
   - Installing the native link-grammar shared library
     - Linux: Get the link-grammar version 4.5.8, follow the
     instructions in the README file, to compile it, and cerfify
     that the .so files can be found (LD_LIBRARY_PATH) by the JVM.
     - Windows: There is a .zip package in
     ${mv-proxy}/server/other/relex/ called
     link-grammar-resources-mingw-win32.zip. It contains the
     compiled dll for link-grammar, besides other data files and the
     necessary dictionary. To install it, just unpack the file in
     the root directory c:\ of your computer. After that you must
     have and structure like c:\msys\1.0\... (you must add the
     directory C:\msys\1.0\local\bin to the system path)

1.2) WordNet
  - Although it is not required, it is recommended the usage of
  WordNet. (** the following content was copied from the relex README
  file):
    Download, unpack and install WordNet 3.0.  The install directory
    then needs to be specified in
    server/other/relex/data/wordnet/file_properties.xml,
    with the name="dictionary_path" property in this file. 
  - if you install it from the debian package don't forget
  wordnet-sense-index

2) Build the pvp.jar file. 
   - Unless you're using a specific IDE (which has specific
   instructions), just go to ${mv-proxy}/server folder and enter
   "ant". It will process the build.xml file and build the pvp.jar at
   ${mv-proxy}/dist/lib folder. 

3) Configure the multiverse database:  
  - Just follow the instructions at
  http://update.multiverse.net/wiki/index.php/Platform_Tutorial_Getting_Started#Configure_database_server,
  just replacing the location of the install.sql file by
  ${mv-proxy}/server/bin/install.sql

4) Running MV-Proxy 
  - Before you run MV-Proxy, you must start the servers of the
  Opencog's embodiment system (by running ./pb.csh at distribution
  folder of Opencog's embodiment project -- read more about that at
  opencog/embodiment/README file from Opencog project's bzr repository
  at lp:opencog).
  - Then, you need to configure MV-Proxy properties so that it knows
  how to connect to the router of Opencog's embodiment system. Just
  edit the ${mv-proxy}/server/bin/PetaverseProxy.properties" file and
  set the following parameters properly: 
    MY_IP: the name or IP of the local machine. WARNING "localhost"
    will not work you need to enter the IP as it is seen from the
    outside. To know it run ifconfig and look for the address after
    "inet addr:".
    ROUTER_IP: the name of IP of the machine (perhaps the same one)
    where the router of Opencog's embodiment system is running. The
    same remark holds as above.
  - Also, edit the $mv-proxy}/server/bin/multiverse.properties and
  change the mysql user and password properly (according to what
  you've set when installed/set up mysql). They are respectively
  multiverse.db_user and multiverse.db_password parameters. And set
  multiverse.msgsvr_hostname and multiverse.proxyserver with the IP
  (or hostname) of the machine where the proxy is running.
  - Finally, you just need to follow the instruction at
  http://update.multiverse.net/wiki/index.php/Platform_Tutorial_Getting_Started#Start_the_servers,
  by using the ${mv-proxy}/server folder as the "mv_home" it mentions
  there.
    - IMPORTANT TIP: always use "./multiverse.sh -v restart" instead
    of "./multiverse.sh -v start" because if you accidently use
    "start" when there is already a MV server running it will crash
    and corrupt both databases and cache files (and you will have to
    re-configure everything again).
    - If everything goes well, you must see the following messages in
    the screen:
      initialize: Read 'PetaverseProxy.properties' file.
      DONE INITIALIZING, you can log in now
      onLine: Available element message received for 'ROUTER'.
      - the first one indicates the PVP plugin was activated and read
      the specific property file used for setting Opencog's Embodiment
      stuff.
      - the second message indicates that Multiverse servers are ready
      for receiving connections from MV clients.
      - the last one means that PVP has already handshaked with the
      router of the Opencog's embodiment system and is receiving
      'ping-like' messages from it.
    - If the above does not happen, you can check what went wrong, as
    follows:
      - use the "status" option: "./multiverse.sh -v status" and check
      if all MV servers are running
      - use a "grep ERROR ../logs/sampleworld/*" command to check if
      there were errors at MV servers startup. If there are errors,
      edit the corresponding log file and look for more details on the
      error.
      - The following common errors may happen: 
         1) You get an error message like "./multiverse.sh: 24: Syntax
         error: "(" unexpected"
            Description: the version of the shell (/usr/bin/sh) in
            your linux distribution is not compatible with this
            multiverse.sh script
            Solution: edit the multiverse.sh and change the shell to
            "bash" (i.e., replace "#!/bin/sh" by "#!/bin/bash")
         2) The error that appears at log files are related to
         connection to database.
            Probable cause: due to some machine-specific
            configuration, the IP value used for
            multiverse.db_hostname parameter in multiverse.properties
            file is not valid (or the expected one)
            Solution: Try to use the value for the "inet addr" field
            reported by the "ifconfig" command as the value for the
            multiverse.db_hostname parameter.
         3) An Exception with the message "too many open files" happens. 
            Probable cause: You may be using the java program that
            comes with your OS (e.g., ubuntu) distrubution, which may
            not work well with MV.
            Solution: install and use Sun's Java SDK instead (see this
            discussion at MV forums:
            http://update.multiverse.net/forum/viewtopic.php?t=5876&theme=multiverse&sid=9985f121b9aa5c9bffa77ced29bdbe45)
            Alternative solution: see
            http://www.patoche.org/LTT/kernel/00000128.html
         4) It prints a lot of messages related to processing of jar
         files but it nevers ends the startup process.
            Probable cause: it takes too much time to process all jar
            files and a startup timeout happens.
            Solution: just try to restart the servers. Since the
            previously processed jar files are cached, it will take
            less time now and complete startup.

5) Installing and configuring the MV Client (run only on Windows) 
   - Just download and install it from
   http://www.multiverse.net/consumer/gettingstarted.jsp?cid=1&scid=0. (you
   must have an user registration at MV)

6) Installing and selecting the assets repository to be used by MV Client
   - Since we have not integrated our MV World into Multiverse
   Network, we need to download an asset repository and the MV tools
   just for setting which assets reporitory MV Client will use.
   - First, download and install the MV tools from
   http://www.multiverse.net/developer/downloadtools.jsp (you must
   have a developer registration at MV).
   - Follow the instruction at
   http://update.multiverse.net/wiki/index.php/Platform_Tutorial_Getting_Started#Download_and_designate_asset_repository
   (you don't need to run World Editor, just check that you can open
   models from the assets repository in Model Viewer)
   - Then, you need to copy the whole ${mv-proxy}/client/sampleworld
   folder to the assets repository with the same name (i.e.,
   .../SampleAssets/sampleworld), which will create some files there
   and overrite some existing ones as well.

7) Running the MV Client and connecting to MV servers (where PVP is running)
   - By default, MV Client try to connect to MV network and, then,
   opens a screen for browsing the available world demos at this
   network. However, we are going to use a local world (not one at MV
   network), so, you must configure MV Client (shortcut) to run in
   this mode, as follows:
   - Copy the ${mv-proxy}/client/world_settings.xml to the
   "{install_dir}/Multiverse Client/Worlds" folder.
   The default configuration is for connecting to a MV server
   deployed at petaverse.vettalabs.com for demo purposes (note that
   it may not be up and running anytime though). If you want to
   connect to other MV server (usually your local MV server), edit
   this file and replace the value of the hostname attribute to the
   corresponding IP or name of the machine where MV/PVP is running.
   - Run one of the scripts in ${mv-proxy}/use**Map.{bat|sh} in order
   to copy a map to the correct place to let MultiverseProxy ready to
   run.
   - For running MV Client connecting to a standalone server (not to
   the MV network), change the created shortcut of the
   MultiverseClient.exe (or create another one by copying & paste it)
   to use the following options instead: 
        --use_default_repository --frames_between_sleeps 2 --world_settings_file <path_to_the_world_settings.xml_file>  
     As an example, the target field should be set like follows:
       "C:\Program Files\Multiverse Client\bin\MultiverseClient.exe" --use_default_repository --frames_between_sleeps 2 --world_settings_file "C:\Program Files\Multiverse Client\Worlds\world_settings.xml"
   - Of course, the steps above are needed only once. After that, you
   may need to change world_settings.xml file for connecting to a MV
   server (PVP) at a different machine.
   - Finally, run the MV Client by double clicking its shortcut.

If you have any problems/questions on these instructions, send me an
email (welter@vettalabs.com or opencog-developers@googlegroups.com)