OldAiDocumentation » History » Version 4

J. Wienke, 04/22/2014 10:52 AM

1 1 J. Wienke
h1.  Vdemo 
2 1 J. Wienke
3 1 J. Wienke
4 1 J. Wienke
Vdemo is a program used to easily start complex demos with many components on different machines. Vdemo uses screen and a shared key environment to start the components. 
5 1 J. Wienke
6 1 J. Wienke
To write your own vdemo script checkout [source:software/vdemo_scripts/trunk] and take a look at the existing scripts. Vdemo is configured via the scripts that have no vdemo at the beginning of the file name. The scripts are then processed via a makefile and a second shell script is created that starts the configured vdemo GUI. To process a adapted vdemo script you have to insert it into [source:software/vdemo_scripts/trunk/Makefile]. The Makefile uses a environment variable called prefix to specify the output folder the processed vdemo files and the needed scripts are copied to. 
7 1 J. Wienke
8 1 J. Wienke
To process your script use: 
9 1 J. Wienke
10 1 J. Wienke
<pre>
11 1 J. Wienke
   export prefix="yourTargetPath"
12 1 J. Wienke
   make all
13 1 J. Wienke
   make install
14 1 J. Wienke
</pre>
15 1 J. Wienke
16 1 J. Wienke
Now you should find a bin directory in yourTargetPath containing a lot of shell scripts. Run your shell script to start your demo.
17 1 J. Wienke
18 3 J. Wienke
h1.  How to configure my own vdemo script
19 1 J. Wienke
20 1 J. Wienke
h1.  How to write your own component 
21 1 J. Wienke
22 1 J. Wienke
23 1 J. Wienke
A component in vdemo is configured through a single file that has to be in the folder source:ai/software/vdemo_scripts/trunk/component_scripts. The file has to be named
24 1 J. Wienke
component_"name_that_is_used_in_the_configuration_file", no spaces and all letters lower case.
25 1 J. Wienke
Every line included in the file is executed in a bash. Be very carefull with spaces and special characters.
26 1 J. Wienke
Below is a example component file:
27 2 J. Wienke
28 2 J. Wienke
<pre>
29 1 J. Wienke
#!/bin/bash
30 1 J. Wienke
31 1 J. Wienke
# common parameters
32 1 J. Wienke
33 1 J. Wienke
# Parameters can be defined here.
34 1 J. Wienke
35 1 J. Wienke
36 1 J. Wienke
component="" <--- The command that starts your component.
37 1 J. Wienke
title=name <--- The title of the component. This will be used to identify the screen your component runs in. Don't use spaces or bash characters in the name.
38 1 J. Wienke
39 1 J. Wienke
function clean_component {
40 1 J. Wienke
    true
41 1 J. Wienke
}
42 1 J. Wienke
43 1 J. Wienke
function on_start {
44 1 J. Wienke
    #This function will be called before your component starts.
45 1 J. Wienke
    true
46 1 J. Wienke
}
47 1 J. Wienke
48 1 J. Wienke
function on_check {
49 1 J. Wienke
    #This function will be called every time you manually check if the component is running.
50 1 J. Wienke
    true
51 1 J. Wienke
}
52 1 J. Wienke
53 1 J. Wienke
function on_stop {
54 1 J. Wienke
    #This function will be called if the component is stopped. Do your cleanup here.
55 1 J. Wienke
    true
56 1 J. Wienke
}
57 1 J. Wienke
58 1 J. Wienke
source "$VDEMO_root/vdemo_standard_component_suffix.sh"
59 3 J. Wienke
</pre>
60 1 J. Wienke
61 1 J. Wienke
h1.  How to start vdemo 
62 1 J. Wienke
63 1 J. Wienke
start the right version of vdemo (whole path) with your vdemo script. Example:
64 1 J. Wienke
65 2 J. Wienke
@/vol/airobots/releases/trunk/bin/vdemo2 /vol/airobots/releases/trunk/etc/vdemo_cfg/BIRON_base.sh@
66 1 J. Wienke
67 1 J. Wienke
you need public key ssh (probably with _empty_ passphrase) for this!
68 1 J. Wienke
<pre>
69 1 J. Wienke
> ssh-keygen -trsa 
70 1 J. Wienke
Generating public/private rsa key pair.
71 1 J. Wienke
Enter file in which to save the key ($HOME/.ssh/id_rsa): 
72 1 J. Wienke
Enter passphrase (empty for no passphrase): 
73 1 J. Wienke
Enter same passphrase again: 
74 1 J. Wienke
Your identification has been saved in $HOME/.ssh/id_rsa.
75 1 J. Wienke
Your public key has been saved in $HOME/.ssh/id_rsa.pub.
76 1 J. Wienke
The key fingerprint is:
77 1 J. Wienke
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
78 1 J. Wienke
</pre>
79 4 J. Wienke
80 1 J. Wienke
h1.  How to start my demo with vdemo 
81 1 J. Wienke
82 4 J. Wienke
Vdemo allows you to specify levels and groups for your component. You can start each single component, a group of components or all components from a level by clicking on the start button from the component the group or the level. If you click on start next to All Components vdemo will begin starting all components from the lowest level, if those components are successfully started it will continue with the next higher level until all components are running. This can be used to wait for spread to start before trying to start a dispatcher etc.
83 1 J. Wienke
84 1 J. Wienke
h1.  How to start only a single component with vdemo for testing purposes 
85 1 J. Wienke
86 1 J. Wienke
87 1 J. Wienke
Sometimes a component does not start up if you press the start button in the vdemo GUI. To check you component configuration you can start only this component in a shell configured through vdemo. Press the button with the name of the machine you want to start the component at. The button should be located at the bottom of the vdemo GUI. Then use the command line tool
88 1 J. Wienke
89 1 J. Wienke
<pre>
90 1 J. Wienke
    vdemo_component (path to your vdemo installation)/etc/vdemo_cfg/(the script for your whole setup)  (path to your vdemo installation)/etc/vdemo_cfg/component_scripts/(the script for your component) 
91 1 J. Wienke
</pre>
92 1 J. Wienke
93 1 J. Wienke
h2.  If you have problems / see also / what you should note 
94 1 J. Wienke
95 1 J. Wienke
* since vdemo was initially built for biron some time ago you might find additional info on/in the [[BironStart|BIRON page/part]] in this trac. Otherwise ask those people who are working with biron or other robots to help you.