OldAiDocumentation » History » Version 2

J. Wienke, 04/22/2014 10:49 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 1 J. Wienke
h1.  How to configure my own vdemo script 
19 1 J. Wienke
20 1 J. Wienke
21 1 J. Wienke
h1.  How to write your own component 
22 1 J. Wienke
23 1 J. Wienke
24 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
25 1 J. Wienke
component_"name_that_is_used_in_the_configuration_file", no spaces and all letters lower case.
26 1 J. Wienke
Every line included in the file is executed in a bash. Be very carefull with spaces and special characters.
27 1 J. Wienke
Below is a example component file:
28 2 J. Wienke
29 2 J. Wienke
<pre>
30 1 J. Wienke
#!/bin/bash
31 1 J. Wienke
32 1 J. Wienke
# common parameters
33 1 J. Wienke
34 1 J. Wienke
# Parameters can be defined here.
35 1 J. Wienke
36 1 J. Wienke
37 1 J. Wienke
component="" <--- The command that starts your component.
38 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.
39 1 J. Wienke
40 1 J. Wienke
function clean_component {
41 1 J. Wienke
    true
42 1 J. Wienke
}
43 1 J. Wienke
44 1 J. Wienke
function on_start {
45 1 J. Wienke
    #This function will be called before your component starts.
46 1 J. Wienke
    true
47 1 J. Wienke
}
48 1 J. Wienke
49 1 J. Wienke
function on_check {
50 1 J. Wienke
    #This function will be called every time you manually check if the component is running.
51 1 J. Wienke
    true
52 1 J. Wienke
}
53 1 J. Wienke
54 1 J. Wienke
function on_stop {
55 1 J. Wienke
    #This function will be called if the component is stopped. Do your cleanup here.
56 1 J. Wienke
    true
57 1 J. Wienke
}
58 1 J. Wienke
59 1 J. Wienke
source "$VDEMO_root/vdemo_standard_component_suffix.sh"
60 2 J. Wienke
<pre>
61 1 J. Wienke
62 1 J. Wienke
63 1 J. Wienke
h1.  How to start vdemo 
64 1 J. Wienke
65 1 J. Wienke
66 1 J. Wienke
start the right version of vdemo (whole path) with your vdemo script. Example:
67 1 J. Wienke
68 2 J. Wienke
@/vol/airobots/releases/trunk/bin/vdemo2 /vol/airobots/releases/trunk/etc/vdemo_cfg/BIRON_base.sh@
69 1 J. Wienke
70 1 J. Wienke
you need public key ssh (probably with _empty_ passphrase) for this!
71 1 J. Wienke
<pre>
72 1 J. Wienke
> ssh-keygen -trsa 
73 1 J. Wienke
Generating public/private rsa key pair.
74 1 J. Wienke
Enter file in which to save the key ($HOME/.ssh/id_rsa): 
75 1 J. Wienke
Enter passphrase (empty for no passphrase): 
76 1 J. Wienke
Enter same passphrase again: 
77 1 J. Wienke
Your identification has been saved in $HOME/.ssh/id_rsa.
78 1 J. Wienke
Your public key has been saved in $HOME/.ssh/id_rsa.pub.
79 1 J. Wienke
The key fingerprint is:
80 1 J. Wienke
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
81 1 J. Wienke
</pre>
82 1 J. Wienke
h1.  How to start my demo with vdemo 
83 1 J. Wienke
84 1 J. Wienke
85 1 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. 
86 1 J. Wienke
87 1 J. Wienke
h1.  How to start only a single component with vdemo for testing purposes 
88 1 J. Wienke
89 1 J. Wienke
90 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
91 1 J. Wienke
92 1 J. Wienke
<pre>
93 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) 
94 1 J. Wienke
</pre>
95 1 J. Wienke
96 1 J. Wienke
h2.  If you have problems / see also / what you should note 
97 1 J. Wienke
98 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.