platypus chopper.tcl
Configures the new chopper driver. r3140 | ffr | 2011-05-19 08:44:20 +1000 (Thu, 19 May 2011) | 2 lines
This commit is contained in:
committed by
Douglas Clowes
parent
8ddb808119
commit
dea8c2c1bb
@@ -1,83 +1,9 @@
|
|||||||
set sim_mode [SplitReply [chopper_simulation]]
|
set sim_mode [SplitReply [chopper_simulation]]
|
||||||
set CH1_MAXSPEED 1800
|
|
||||||
|
|
||||||
namespace eval ::chopper {}
|
namespace eval ::scobj::chopper {
|
||||||
if {$sim_mode == "true"} {
|
variable chopper_IP "137.157.202.137"
|
||||||
MakeChopper chopperController sim
|
variable chopper_port "10000"
|
||||||
ChopperAdapter ch1speed chopperController speed 0 $CH1_MAXSPEED
|
variable UID "NCS"
|
||||||
ChopperAdapter ch2speed chopperController speed 0 $CH1_MAXSPEED
|
variable PWD "NCS013"
|
||||||
ChopperAdapter ch3speed chopperController speed 0 $CH1_MAXSPEED
|
|
||||||
ChopperAdapter ch4speed chopperController speed 0 $CH1_MAXSPEED
|
|
||||||
|
|
||||||
ChopperAdapter ch1phase chopperController phase 0 180
|
|
||||||
ChopperAdapter ch2phase chopperController phase 0 180
|
|
||||||
ChopperAdapter ch3phase chopperController phase 0 180
|
|
||||||
ChopperAdapter ch4phase chopperController phase 0 180
|
|
||||||
proc ::chopper::ready? {} {}
|
|
||||||
proc ::chopper::get_frequency {} {variable frequency; return $frequency}
|
|
||||||
proc ::chopper::set_frequency {freq} {variable frequency; set frequency $freq}
|
|
||||||
::chopper::set_frequency 0
|
|
||||||
|
|
||||||
publish ::chopper::set_frequency user
|
|
||||||
} else {
|
|
||||||
# Chopper NCS013 communications
|
|
||||||
set chopper_controller(host) 137.157.202.137
|
|
||||||
set chopper_controller(port) 10000
|
|
||||||
set chopper_controller(user) NCS
|
|
||||||
set chopper_controller(password) NCS013
|
|
||||||
|
|
||||||
|
|
||||||
# CHOPPER
|
|
||||||
MakeChopper chopperController tcpdocho [params \
|
|
||||||
host $chopper_controller(host) \
|
|
||||||
port $chopper_controller(port) \
|
|
||||||
nchopper 4 \
|
|
||||||
timeout 30 \
|
|
||||||
user $chopper_controller(user) \
|
|
||||||
password $chopper_controller(password) \
|
|
||||||
]
|
|
||||||
ChopperAdapter ch1speed chopperController speed_1 0 $CH1_MAXSPEED
|
|
||||||
ChopperAdapter ch2speed chopperController speed_2 0 $CH1_MAXSPEED
|
|
||||||
ChopperAdapter ch3speed chopperController speed_3 0 $CH1_MAXSPEED
|
|
||||||
ChopperAdapter ch4speed chopperController speed_4 0 $CH1_MAXSPEED
|
|
||||||
ChopperAdapter ch1phase chopperController phase_1 0 180
|
|
||||||
ChopperAdapter ch2phase chopperController phase_2 0 180
|
|
||||||
ChopperAdapter ch3phase chopperController phase_3 0 180
|
|
||||||
ChopperAdapter ch4phase chopperController phase_4 0 180
|
|
||||||
|
|
||||||
|
|
||||||
##
|
|
||||||
# @brief Return TCL_ERROR if chopper is in a state which disallows data acquisition.
|
|
||||||
# This is useful for aborting scans or batch files.
|
|
||||||
proc ::chopper::ready? {} {
|
|
||||||
set msg [chopperController status]
|
|
||||||
if {[lindex $msg 2] == "NOTREADY:"} {
|
|
||||||
set errmsg "CHOPPER [lrange $msg 2 end]"
|
|
||||||
return -code error $errmsg
|
|
||||||
}
|
}
|
||||||
}
|
source $cfPath(chopper)/sct_chopper.tcl
|
||||||
|
|
||||||
##
|
|
||||||
# @brief Return the last known chopper frequency. To get the current frequency you
|
|
||||||
# must issue a 'chopperController status' or ::chopper::ready? command first.
|
|
||||||
proc ::chopper::get_frequency {} {
|
|
||||||
set msg [split [SplitReply [chopperController frequency]] : ]
|
|
||||||
if {[lindex $msg 0] == "FAILED"} {
|
|
||||||
return -code error [lindex $msg 1]
|
|
||||||
} else {
|
|
||||||
return $msg
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
publish ::chopper::ready? user
|
|
||||||
publish ::chopper::get_frequency user
|
|
||||||
|
|
||||||
sicslist setatt ch1speed units "rpm"
|
|
||||||
sicslist setatt ch2speed units "rpm"
|
|
||||||
sicslist setatt ch3speed units "rpm"
|
|
||||||
sicslist setatt ch4speed units "rpm"
|
|
||||||
sicslist setatt ch1phase units "degrees"
|
|
||||||
sicslist setatt ch2phase units "degrees"
|
|
||||||
sicslist setatt ch3phase units "degrees"
|
|
||||||
sicslist setatt ch4phase units "degrees"
|
|
||||||
|
|||||||
Reference in New Issue
Block a user