Commit 708be432ee5ecdcd49c64516aaa6dde452f24a89
1 parent
056bae11
Exists in
dev
Grosse amélioration config XML et classe ConfigPyros
Showing
2 changed files
with
90 additions
and
0 deletions
Show diff stats
... | ... | @@ -0,0 +1,90 @@ |
1 | +# =========================================================== | |
2 | +# Commandes pour piloter manuellement un telescope avec pyros | |
3 | +# ----------------------------------------------------------- | |
4 | +# Idealement les commandes suivantes sont effectuées dans un agent. | |
5 | +# | |
6 | +# Liens entre les devices et les agents wrappers | |
7 | +# 'TCHMount', 'MountPointing' ---> wrapper_deltatau_tch | |
8 | +# 'TCHCamera', 'DetectorSensor' ---> wrapper_andor_tch | |
9 | +# 'TCHCamera', 'DetectorShutter' ---> wrapper_andor_tch | |
10 | +# 'TCHCamera', 'DetectorTimer' ---> wrapper_meinberg_tch | |
11 | +# 'TCHCamera', 'FilterSelector' ---> wrapper_deltatau_tch | |
12 | +# 'TCHCamera', 'DetectorFocus' ---> wrapper_deltatau_tch | |
13 | +# | |
14 | +# 'DetectorFocus' ==> | |
15 | +# =========================================================== | |
16 | + | |
17 | + | |
18 | +# Lors d'une instanciation de la classe Config : | |
19 | +# - On lit les key,value des sections 'instanciation' du fichier de config | |
20 | +>>> config = Config("config.xml") | |
21 | + | |
22 | +# On peut trouver les instanciations qu'il faut effectuer | |
23 | +>>> config.get_instanciations() | |
24 | +['mount1'='TCHMount', 'channel1'='TCHCamera'] | |
25 | + | |
26 | +# On veut connaitre tous les devices de cette mounture | |
27 | +>>> config.get_devices('TCHMount') | |
28 | +['MountPointing'] | |
29 | + | |
30 | +# On peut recevoir une liste de dictionnaires de tous les parametres d'un device de cette mounture | |
31 | +>>> config.get_device_params('TCHMount','MountPointing') | |
32 | +[ {'section':"MountPointing", 'key':"wrapper", 'value':"wrapper_deltatau_tch.py"}, | |
33 | +{'section':"MountPointing", 'key':"home", 'value':"GPS 1.477083 E 43.81667 150" 'type':"str" 'unit':""} ] | |
34 | + | |
35 | +# On veut connaitre tous les devices d'un channel | |
36 | +>>> config.get_devices('TCHCamera') | |
37 | +['DetectorSensor', 'DetectorShutter', 'DetectorTimer', 'FilterSelector', 'DetectorFocus'] | |
38 | + | |
39 | +# On peut recevoir une liste de dictionnaires de tous les parametres d'un device de ce channel | |
40 | +>>> config.get_device('TCHCamera','DetectorSensor') | |
41 | +[ {'section':"DetectorSensor", 'key':"wrapper", 'value':"wrapper_andor_tch.py", 'type'="str"}, | |
42 | +{'section':"DetectorSensor", 'key':"sensor_type", 'value':"CCD", 'type':"str"} ] | |
43 | + | |
44 | + | |
45 | +>>> pyros = Pyros(config) | |
46 | +>>> w1 = pyros.launch_agent("wrapper_deltatau_tch") | |
47 | +>>> w2 = pyros.launch_agent("wrapper_andor_tch") | |
48 | +>>> w3 = pyros.launch_agent("wrapper_meinberg_tch") | |
49 | +>>> pyros.kill_agent(w3) | |
50 | + | |
51 | +% === envoie une commande vers un agent | |
52 | +pyros.command_agent(w1,"current status") | |
53 | +pyros.command_agent(w1,"current status") | |
54 | + | |
55 | + | |
56 | + | |
57 | +!!!!!!!!! ajouter I am alive database pour les agents !!!!!!!!!!!! | |
58 | + | |
59 | + | |
60 | + | |
61 | + | |
62 | +mount1 = pyros.mount1 | |
63 | +channel1 = pyros.channel1 | |
64 | + | |
65 | +mount1.MountPointing("current status") | |
66 | +mount1.MountPointing("do init") | |
67 | + | |
68 | +channel1.FilterSelector("current error") | |
69 | +channel1.FilterSelector("set symbol B") | |
70 | +channel1.FilterSelector("do goto") | |
71 | +while True: | |
72 | + action = channel1.FilterSelector("current action") | |
73 | + if (symbol == "B"): | |
74 | + break | |
75 | + | |
76 | +channel1.FocusTuning("set position 10.0") | |
77 | +channel1.FocusTuning("do goto") | |
78 | +while True: | |
79 | + position = channel1.FocusTuning("current position") | |
80 | + if ( abs(position-10)): | |
81 | + break | |
82 | + | |
83 | +mount1.MountPointing("set slew speed [20, 20]") | |
84 | +mount1.MountPointing("set drift speed ['diurnal', 0]") | |
85 | +mount1.MountPointing("set coord ephem_radec [date:'now', ra='3h38m', dec='-0d3m', equinox='J2000']") | |
86 | +mount1.MountPointing("do goto") | |
87 | + | |
88 | +channel1.DetectorSensor("set binning [1, 1]") | |
89 | +channel1.DetectorSensor("set exptime 10.0") | |
90 | + | ... | ... |