From 27f09f5a0a1cba73b49f9f11804e4dcff9647f05 Mon Sep 17 00:00:00 2001 From: Ferdi Franceschini Date: Fri, 9 Aug 2013 05:24:29 +1000 Subject: [PATCH] SICS-655 Update tasmots when driving axes. SICS-512 Experimental anticollider for m2, s2 and a2 --- .../instrument/tas/taipan_configuration.tcl | 77 +++++++++++++------ 1 file changed, 54 insertions(+), 23 deletions(-) diff --git a/site_ansto/instrument/tas/taipan_configuration.tcl b/site_ansto/instrument/tas/taipan_configuration.tcl index 0277ba23..141a032b 100644 --- a/site_ansto/instrument/tas/taipan_configuration.tcl +++ b/site_ansto/instrument/tas/taipan_configuration.tcl @@ -33,7 +33,8 @@ fileeval $cfPath(scan)/scan.tcl fileeval $cfPath(commands)/commands.tcl fileeval $cfPath(commands)/pulser.tcl fileeval $cfPath(commands)/hvcommands.tcl -fileeval $cfPath(anticollider)/anticollider.tcl +namespace eval anticollider { proc ::anticollider::init {} {} } +#fileeval $cfPath(anticollider)/anticollider.tcl #fileeval $cfPath(tasmad)/taspub_sics/tasp.tcl #fileeval $cfPath(tasmad)/taspub_sics/tasscript.tcl fileeval $cfPath(environment)/temperature/sct_eurotherm_2000.tcl @@ -71,32 +72,62 @@ server_init # WARNING: Do not add any code below server_init, if you do SICS may fail to initialise properly. # Provide tasmot notifications to GumTree when real motors move -hchain /sample/ei /instrument/crystal/m2 -hchain /sample/en /instrument/crystal/m2 -hchain /sample/ki /instrument/crystal/m2 -hchain /sample/qh /instrument/crystal/m2 -hchain /sample/qk /instrument/crystal/m2 -hchain /sample/ql /instrument/crystal/m2 -hchain /sample/qm /instrument/crystal/m2 +proc m2tasupdate {} { + tasub update + hupdate /sample/ei + hupdate /sample/en + hupdate /sample/ki + hupdate /sample/qh + hupdate /sample/qk + hupdate /sample/ql + hupdate /sample/qm +} +publish m2tasupdate user -hchain /sample/qh /sample/s1 -hchain /sample/qk /sample/s1 -hchain /sample/ql /sample/s1 -hchain /sample/qm /sample/s1 +proc s1s2tasupdate {} { + tasub update + hupdate /sample/qh + hupdate /sample/qk + hupdate /sample/ql + hupdate /sample/qm +} +publish s1s2tasupdate user -hchain /sample/qh /sample/s2 -hchain /sample/qk /sample/s2 -hchain /sample/ql /sample/s2 -hchain /sample/qm /sample/s2 +proc a2tasupdate {} { + tasub update + hupdate /sample/ef + hupdate /sample/en + hupdate /sample/kf + hupdate /sample/qh + hupdate /sample/qk + hupdate /sample/ql + hupdate /sample/qm +} +publish a2tasupdate user -hchain /sample/ef /instrument/detector/a2 -hchain /sample/en /instrument/detector/a2 -hchain /sample/kf /instrument/detector/a2 -hchain /sample/qh /instrument/detector/a2 -hchain /sample/qk /instrument/detector/a2 -hchain /sample/ql /instrument/detector/a2 -hchain /sample/qm /instrument/detector/a2 +scriptcallback connect m2 MOTEND m2tasupdate +scriptcallback connect s1 MOTEND s1s2tasupdate +scriptcallback connect s2 MOTEND s1s2tasupdate +scriptcallback connect a2 MOTEND a2tasupdate +set MY_INSTRUMENT_IS_BROKEN_AND_I_DIDNT_FIXIT false +if {$MY_INSTRUMENT_IS_BROKEN_AND_I_DIDNT_FIXIT} { + AntiCollisionInstall + anticollision register m2 + anticollision register s2 + anticollision register a2 + array set tasacscript_levels {m2 0 s2 1 a2 2} + proc tasacscript {args} { + anticollision clear + array set targets $args + foreach {mot target} $args { + anticollision add $::tasacscript_levels($mot) $mot $targets($mot) + } + return + } + publish tasacscript user + anticollision script tasacscript +} # fix all motors if {0} { foreach m [sicslist type motor] {