User Tools

Site Tools


doc:grb_scripts

GRB scripting

Scripting informations are stored in table grb_script. Here is sample output:

stars= SELECT * FROM grb_script;
 camera_name | grb_script_end | grb_script_script 
-------------+----------------+-------------------
 C5          |            600 | F 2 E 20
 C5          |                | F 2 E 60 F 4 E 60
 C4          |            600 | E 30
 C4          |                | E 60
 C6          |            600 | F 2 E 20
 C6          |                | F 2 E 60 F 4 E 60
 C7          |            600 | F 2 E 20
 C7          |                | F 2 E 60 F 4 E 60
  • camera_name hold name of camera. It must reference to cameras table. Usually you will encounter only single camera in the system, which will be called C0.
  • grb_script_end is time after GRB when this script will NOT be used. If it's NULL, this is default script. 600 in this field means that script will be used up to 600 seconds (10 minutes) after GRB trigger. After this time, script with bigger number in grb_script_end, or grb_script_end left NULL, will be used
  • grb_script_script is script to be executed. Plese refer to man rts2.script for details.

If you would like to modify this table, the easiest approach is to use pg-dump

user@host:~$ pg_dump -t grb_script stars > grb_script
user@host:~$ editor grb_script

edit grb_script so it contains only lines similar to the example bellow:

COPY grb_script (camera_name, grb_script_end, grb_script_script) FROM stdin;
C5      600     F 2 E 20
C5      \N      F 2 E 60 F 4 E 60
C4      600     E 30
C4      \N      E 60
C6      600     F 2 E 20
C6      \N      F 2 E 60 F 4 E 60
C7      600     F 2 E 20
C7      \N      F 2 E 60 F 4 E 60
\.

Please bear in mid that there MUST be tabulator between entries (after C5 and 600 in the example above). Edit those lines, particularly scripts, add new lines, and send the file back to psql

user@host:~$ psql stars < grb_script

Updating by using psql

The following is added by someone learning the system and is not official:

Since the grb_script table in the stars database is properly set to have the constrain of being UNIQUE, if the method described above is attempted for updating the script psql will refuse to add it again and will output among other things:

ERROR:  relation "grb_script" already exists

This can be circumvented by simply using psql to edit the table.

user@host:~$ psql stars
stars=> UPDATE grb_script SET grb_script_script = 'filter=0 E 30' WHERE grb_script_end = '600' and camera_name="C5";
stars=> INSERT INTO grb_script VALUES ('C5', '300', 'filter=0 EMON=off filter=C E 30');
stars=> UPDATE grb_script SET grb_script_script = 'filter=0 E 180' WHERE grb_script_end IS NULL and camera_name="C5";

Note that:

  1. The first command will update what camera C5 will do until 10 minutes
  2. The second command will insert the previously undefined behaviour for C5 that will happen until 300 seconds
  3. And the third will update that which will be done after all other defined behaviours. Note that for this case the column is not search by a literal expression like '\N' but by the condition “IS NULL”
doc/grb_scripts.txt · Last modified: 2012/03/23 00:00 (external edit)