From a8203ffa6e5000e6034aa489429c927b6e09f4d2 Mon Sep 17 00:00:00 2001 From: Ferdi Franceschini Date: Tue, 2 Aug 2011 14:20:46 +1000 Subject: [PATCH] Copied changes which were made in-situ. r3236 | ffr | 2011-08-02 14:20:46 +1000 (Tue, 02 Aug 2011) | 2 lines --- .../config/commands/commands.tcl | 30 ++++++++++++------- .../config/motors/motor_configuration.tcl | 8 ++--- 2 files changed, 23 insertions(+), 15 deletions(-) diff --git a/site_ansto/instrument/reflectometer/config/commands/commands.tcl b/site_ansto/instrument/reflectometer/config/commands/commands.tcl index 9e38af05..ee7078f4 100644 --- a/site_ansto/instrument/reflectometer/config/commands/commands.tcl +++ b/site_ansto/instrument/reflectometer/config/commands/commands.tcl @@ -56,7 +56,8 @@ namespace eval exp_mode { } - command omega_2theta { float arg1 float arg2 } { +proc ::exp_mode::omega_2theta { arg1 arg2 {s1vg 0} {s2vg 0} {s3vg 0} {s4vg 0}} { + #need to set omega first. This is because #for Single bounce the twotheta positions depend on the angle of incidence # whenever omega_2theta is called, or the mode is changed, the slits should close @@ -69,7 +70,9 @@ namespace eval exp_mode { omega $arg1 twotheta $arg2 - + if {![string is double $arg1] || ![string is double $arg2]} { + return -code error "omega and two theta should be a proper number" + } if {[catch { ::exp_mode::set_omega $arg1 ::exp_mode::set_two_theta $arg2 @@ -78,17 +81,22 @@ namespace eval exp_mode { twotheta -1 return -code error $errMsg } + if {![string is double $s1vg] || ![string is double $s2vg] || ![string is double $s3vg] || ![string is double $s4vg]} { + return -code error "ERROR: all the slit openings need to be numbers" + } + drive ss1u [expr 0.5 * $s1vg] ss1d [expr -0.5 * $s1vg] ss2u [expr 0.5 * $s2vg] ss2d [expr -0.5 * $s2vg] ss3u [expr 0.5 * $s3vg] ss3d [expr -0.5 * $s3vg] ss4u [expr 0.5 * $s4vg] ss4d [expr -0.5*$s4vg] return -code ok } } +publish ::exp_mode::omega_2theta user ## # @brief Drive c1ht and set guide_element parameter # # @param arg is the user mode proc ::exp_mode::set_guide_element { arg } { - global ::exp_mode::c1ht_pos + global ::exp_mode::c1ht_pos global ::exp_mode::valid_modes drive ss1u 0 ss1d 0 ss2u 0 ss2d 0 ss3u 0 ss3d 0 ss4u 0 ss4d 0 @@ -167,7 +175,7 @@ proc ::exp_mode::set_omega { arg } { } errMsg ] } { return -code error $errMsg } - run sth $arg st3vt 0 + drive sth $arg st3vt 0 } MT { if { [catch { @@ -176,7 +184,7 @@ proc ::exp_mode::set_omega { arg } { } errMsg ] } { return -code error $errMsg } - run sth $arg st3vt 0 + drive sth $arg st3vt 0 } POL { if { [catch { @@ -185,7 +193,7 @@ proc ::exp_mode::set_omega { arg } { } errMsg ] } { return -code error $errMsg } - run sth $arg st3vt 0 + drive sth $arg st3vt 0 } POLANAL { if { [catch { @@ -194,7 +202,7 @@ proc ::exp_mode::set_omega { arg } { } errMsg ] } { return -code error $errMsg } - run sth $arg st3vt 0 + drive sth $arg st3vt 0 } default { return -code error "omega driving not specified for that mode" @@ -278,7 +286,7 @@ proc ::exp_mode::set_two_theta { arg } { } errMsg]} { return -code error $errMsg } - run st4vt $h2 dz $h1 + drive st4vt $h2 dz $h1 } MT { set d1 [SplitReply [dy]] @@ -292,7 +300,7 @@ proc ::exp_mode::set_two_theta { arg } { } errMsg ] } { return -code error $errMsg } - run st4vt $h2 dz $h1 + drive st4vt $h2 dz $h1 } POL { set d1 [SplitReply [dy]] @@ -306,7 +314,7 @@ proc ::exp_mode::set_two_theta { arg } { } errMsg ] } { return -code error $errMsg } - run st4vt $h2 dz $h1 analz -200 analtilt 0 + drive st4vt $h2 dz $h1 analz -200 analtilt 0 } POLANAL { set d1 [SplitReply [dy]] @@ -325,7 +333,7 @@ proc ::exp_mode::set_two_theta { arg } { } errMsg ] } { return -code error $errMsg } - run st4vt $h2 dz $h1 analz $h3 analtilt $ang1 + drive st4vt $h2 dz $h1 analz $h3 analtilt $ang1 } default { return -code error "two_theta not defined for that mode: $expmode" diff --git a/site_ansto/instrument/reflectometer/config/motors/motor_configuration.tcl b/site_ansto/instrument/reflectometer/config/motors/motor_configuration.tcl index 79a9e66f..203d1b88 100644 --- a/site_ansto/instrument/reflectometer/config/motors/motor_configuration.tcl +++ b/site_ansto/instrument/reflectometer/config/motors/motor_configuration.tcl @@ -40,7 +40,7 @@ set m1ro_home 134658 set bat_home 8308518 set st3vt_home 5250496 #set st3vt_home 8742250 - victim of the encoder rearrangement -set st4vt_home 5806721 +set st4vt_home 6560460 set sth_home 23541737 #set sphi_home 7548440 - victim of the NaN set sphi_home 7450470 @@ -350,7 +350,7 @@ Motor st4vt $motor_driver_type [params \ axis F\ units mm\ hardlowerlim 0\ - hardupperlim 249\ + hardupperlim 248\ maxSpeed 10\ maxAccel 1\ maxDecel 10\ @@ -360,8 +360,8 @@ Motor st4vt $motor_driver_type [params \ cntsPerX 8192] st4vt part slits.$slit4VGroup st4vt long_name st4vt -st4vt softlowerlim 0 -st4vt softupperlim 249 +st4vt softlowerlim 1 +st4vt softupperlim 247 st4vt home 0 st4vt backlash_offset -0.1 st4vt creep_offset 0.05