IndexNextUpPreviousUrbi SDK 3.0.0

Chapter 2
Getting Started

urbiscript comes with a set of tools, two of which being of particular importance:

launches an Urbi server. There are several means to interact with it, which we will see later.
runs Urbi components, the UObjects, and connects them to an Urbi server.

Please, first make sure that these tools are properly installed. If you encounter problems, please see the frequently asked questions (paragraph 14), and the detailed installation instructions (paragraph 13).

# Make sure urbi is properly installed. 
$ urbi --version 
Urbi version 3.x.y  

There are several means to interact with a server spawned by urbi, see Section 19.3 for details. First of all, you may use the options ‘-e’/‘--expression code ’ and ‘-f’/‘--file file ’ to send some code or the contents of some file to the newly run server. The option ‘q’/‘--quiet’ discards the banner.

You may combine any number of these options, but beware that being event-driven, the server does not “know” when a program ends. Therefore, batch programs should end by calling shutdown. Using a Unix shell:

# A classical program. 
$ urbi -q -e ’echo("Hello, World!");’ -e ’shutdown;’ 
[00000004] *** Hello, World!  
Listing 2.1: A batch session under Unix.

If you are running Windows, then, since the quotation rules differ, run:

# A classical program. 
$ urbi -q -e "echo(""Hello, World!"");" -e "shutdown;" 
[00000004] *** Hello, World!  
Listing 2.2: A batch session under Windows.

To run an interactive session, use option ‘-i’/‘--interactive’. Like most interactive interpreters, Urbi will evaluate the given commands and print out the results.

$ urbi -i 
[00000825] *** Urbi version 3.x.y 
[00001200] 3 
Listing 2.3: An interactive session under Unix.

The output from the server is prefixed by a number surrounded by square brackets: this is the date (in milliseconds since the server was launched) at which that line was sent by the server. This is useful at occasions, since Urbi is meant to run many parallel commands. Since these timestamps are irrelevant in most examples, they will often be filled with zeroes through this documentation.

Under Unix, the program rlwrap provides additional services (history of commands, advanced command line edition etc.); run ‘rlwrap urbi -i’.

In either case the server can also be made available for network-based interactions using option ‘--port port ’. Note that while shutdown asks the server to quit, quit only quits one interactive session. In the following example (under Unix) the server is still available for other, possibly concurrent, sessions.

$ urbi --port 54000 & 
[1] 77024 
$ telnet localhost 54000 
Connected to localhost. 
Escape character is ’^]’
[00004816] *** Urbi version 3.x.y 
[00018032] 98765432 
Connection closed by foreign host.  
Listing 2.4: An interactive session under Unix.

Under Windows, instead of using telnet, you may use Gostai Console (part of the package), which provides a Graphical User Interface to a network-connection to an Urbi server. To launch the server, run:

C:\...> start urbi --port 54000  
Listing 2.5: Starting an interactive session under Windows.

and to launch the client, click on Gostai Console which is installed by the installer.

Then, the interaction proceeds in the Gostai Console windows. Specify the host name and port to use (‘’) in the text field in the top of the window and click on the right to start the connection.


The program urbi-send (see Section 19.8) provides a nice interface to send batches of instructions (and/or files) to a running server.

$ urbi-send -P 54000 -e "1+2*3;" -Q 
[00018032] 7 
# Have the server shutdown; 
$ urbi-send -P 54000 -e "shutdown;"  

You can now send commands to your Urbi server. If at any point you get lost, or want a fresh start, you can simply close and reopen your connection to the server to get a clean environment. In some cases, particularly if you made global changes in the environment, it is simpler to start anew: shut your current server down using the command shutdown, and spawn a new one. In interactive mode you can also use the shortcut sequence Ctrl-D, like in many other interpreters.

In case of a foreground task preventing you to execute other commands, you can use Ctrl-C to kill the foreground task, clear queued commands and restore interactive mode.

You are now ready to proceed to the urbiscript tutorial: see Listing I.