updated/added file to support galil contoller in Lyrebird - jgn
r3067 | jgn | 2011-02-24 09:12:56 +1100 (Thu, 24 Feb 2011) | 3 lines
This commit is contained in:
committed by
Douglas Clowes
parent
ea087769dc
commit
102b722b5a
102
site_ansto/instrument/lyrebird/config/motors/sct_flightTube.tcl
Normal file
102
site_ansto/instrument/lyrebird/config/motors/sct_flightTube.tcl
Normal file
@@ -0,0 +1,102 @@
|
|||||||
|
# Author:
|
||||||
|
|
||||||
|
|
||||||
|
##
|
||||||
|
# @file Lyrebird Flight Tube Rotate controller
|
||||||
|
namespace eval ::scobj::galil {
|
||||||
|
variable sim_mode
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
##
|
||||||
|
# @brief Send a command which returns a TPF value from Motor
|
||||||
|
# @param nextState, State which handles the reply
|
||||||
|
# @return The next state
|
||||||
|
proc ::scobj::galil::getTPF {} {
|
||||||
|
sct send "TPF"
|
||||||
|
return ackCmd
|
||||||
|
}
|
||||||
|
|
||||||
|
##
|
||||||
|
# @brief Get a TPF value from Motor
|
||||||
|
# Convert TPF value to the Angle value which be displayed on Gumtree client.
|
||||||
|
proc ::scobj::galil::ackCmd {batpath} {
|
||||||
|
set tpfValue [sct result]
|
||||||
|
set tmp [expr {($tpfValue - 190161)*(-0.006696) + 25.77375473}]
|
||||||
|
broadcast "tpfValue = $tpfValue; tmp = $tmp"
|
||||||
|
hset $batpath/Angle $tmp
|
||||||
|
broadcast "Angle = [hget $batpath/Angle]"
|
||||||
|
return idle
|
||||||
|
}
|
||||||
|
|
||||||
|
##
|
||||||
|
# @brief Read Angle value from Gumtree client and then send the command to the Motor
|
||||||
|
# @return The next state
|
||||||
|
proc ::scobj::galil::getValue {nextState} {
|
||||||
|
set tmpAngle [sct target]
|
||||||
|
set comm "ANGLE=$tmpAngle"
|
||||||
|
sct send $comm
|
||||||
|
return $nextState
|
||||||
|
}
|
||||||
|
|
||||||
|
##
|
||||||
|
# @brief Get ACK from the Motor after sending an ANGLE command to the Motor
|
||||||
|
# @return IDLE
|
||||||
|
proc ::scobj::galil::rdStatusFunc {} {
|
||||||
|
set ack [sct result]
|
||||||
|
if {$ack == -1} {
|
||||||
|
broadcast "Done: angle command set correctly!"
|
||||||
|
} elseif {
|
||||||
|
broadcast "Error $ack: Angle is not set correctly, check the error code $ack!"
|
||||||
|
}
|
||||||
|
return idle
|
||||||
|
}
|
||||||
|
|
||||||
|
proc ::scobj::galil::mkGalil {argList} {
|
||||||
|
|
||||||
|
foreach {k v} $argList {
|
||||||
|
set KEY [string toupper $k]
|
||||||
|
set pa($KEY) $v
|
||||||
|
}
|
||||||
|
|
||||||
|
set NS ::scobj::$pa(NAME)
|
||||||
|
set internal $pa(INTERVAL)
|
||||||
|
set batObjName $pa(NAME)
|
||||||
|
|
||||||
|
set batpath /sics/$batObjName
|
||||||
|
|
||||||
|
set sim_mode [SplitReply [motor_simulation]]
|
||||||
|
#set sim_mode "false"
|
||||||
|
|
||||||
|
puts "sim_mode=$sim_mode"
|
||||||
|
|
||||||
|
MakeSICSObj $batObjName SCT_OBJECT
|
||||||
|
|
||||||
|
# Set hipadaba properties for GumTree interface
|
||||||
|
# and NeXus data file.
|
||||||
|
#sicslist setatt $pa(NAME) klass instrument
|
||||||
|
#sicslist setatt $pa(NAME) long_name $pa(NAME)
|
||||||
|
hsetprop $batpath klass NXaperture
|
||||||
|
|
||||||
|
hfactory /sics/$pa(NAME)/Angle plain user float
|
||||||
|
hfactory /sics/$pa(NAME)/setAngle plain user float
|
||||||
|
|
||||||
|
makesctcontroller sct_ft galil $pa(IP):$pa(PORT)
|
||||||
|
#makesctcontroller sct_ft std $pa(IP):$pa(PORT)
|
||||||
|
|
||||||
|
# Get the TPF value from the Motor, then convert to current ANGLE position
|
||||||
|
hsetprop $batpath read ${NS}::getTPF
|
||||||
|
hsetprop $batpath ackCmd ${NS}::ackCmd $batpath
|
||||||
|
|
||||||
|
# Read the ANGLE value from the Gumtree client, then send roate command to Motor and get ACK from Motor.
|
||||||
|
hsetprop $batpath write ${NS}::getValue rdStatus
|
||||||
|
hsetprop $batpath rdStatus ${NS}::rdStatusFunc
|
||||||
|
|
||||||
|
::scobj::hinitprops $batObjName setAngle Angle
|
||||||
|
|
||||||
|
puts "batpath : $batpath"
|
||||||
|
sct_ft poll $batpath $internal
|
||||||
|
sct_ft write $batpath
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
11
site_ansto/instrument/lyrebird/config/motors/spin_galil.tcl
Normal file
11
site_ansto/instrument/lyrebird/config/motors/spin_galil.tcl
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
fileeval $cfPath(motors)/sct_flightTube.tcl
|
||||||
|
|
||||||
|
::scobj::galil::mkGalil {
|
||||||
|
name "galil"
|
||||||
|
#IP 137.157.204.25
|
||||||
|
IP localhost
|
||||||
|
PORT 1034
|
||||||
|
tuning 1
|
||||||
|
interval 1
|
||||||
|
}
|
||||||
|
|
||||||
@@ -18,7 +18,7 @@ fileeval $cfPath(source)/source.tcl
|
|||||||
source $cfPath(hipadaba)/hipadaba_configuration.tcl
|
source $cfPath(hipadaba)/hipadaba_configuration.tcl
|
||||||
|
|
||||||
fileeval $cfPath(motors)/motor_configuration.tcl
|
fileeval $cfPath(motors)/motor_configuration.tcl
|
||||||
fileeval $cfPath(motors)/sct_flightTube.tcl
|
fileeval $cfPath(motors)/spin_galil.tcl
|
||||||
|
|
||||||
fileeval $cfPath(motors)/positmotor_configuration.tcl
|
fileeval $cfPath(motors)/positmotor_configuration.tcl
|
||||||
#fileeval $cfPath(velsel)/velsel.tcl
|
#fileeval $cfPath(velsel)/velsel.tcl
|
||||||
|
|||||||
Reference in New Issue
Block a user