SICS-46
commands_common.tcl Added ::motor::go_home command to run motors to their home positions. hrpd,hipd,rsd,sans,reflectometer/commands.tcl Initilise ::motor::is_homing_list for the ::motor::go_hom command util/command.tcl Allow an empty parameter list server_config.tcl Call the "commands" initilisation function on server init motor_asim.c Added the "home" parameter so we can test the go_home command r2677 | ffr | 2008-08-14 15:00:18 +1000 (Thu, 14 Aug 2008) | 17 lines
This commit is contained in:
committed by
Douglas Clowes
parent
f7c357a56d
commit
348bd3aed1
@@ -2,6 +2,8 @@
|
||||
# @file Definition of common command node procs.
|
||||
|
||||
################################################################################
|
||||
namespace eval commands { }
|
||||
|
||||
# SCAN COMMANDS
|
||||
namespace eval scan {
|
||||
command hdb_bmonscan {
|
||||
@@ -80,3 +82,30 @@ namespace eval monitor {
|
||||
::monitor::count -set feedback status IDLE
|
||||
}
|
||||
################################################################################
|
||||
|
||||
proc ::commands::ic_initialize {} {
|
||||
# Generate the following commands,
|
||||
# ::motor::go_home
|
||||
namespace eval ::motor {
|
||||
set NS [uplevel namespace current]
|
||||
if {[info exists is_homing_list] == 0} {
|
||||
return -code error "ERROR: Instrument specific command config must set ${NS}::is_homing_list\n"
|
||||
}
|
||||
command go_home "text=$is_homing_list motors" {
|
||||
# Instrument specific command configurations must define
|
||||
# ::motor::is_homing_list, this is a possibly empty comma separated list
|
||||
# of motors which are safe to send to home
|
||||
variable is_homing_list
|
||||
|
||||
if {$motors == ""} {return}
|
||||
set motlist [split $motors ,]
|
||||
if {[setdiff $motlist [split $is_homing_list , ]] != ""} {
|
||||
return -code error "ERROR: You can only \"home\" a subset of $is_homing_list"
|
||||
}
|
||||
foreach motor $motlist {
|
||||
lappend runargs $motor [SplitReply [$motor home]]
|
||||
}
|
||||
eval "run $runargs"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1 +1,6 @@
|
||||
source $cfPath(commands)/commands_common.tcl
|
||||
|
||||
namespace eval motor {
|
||||
# is_homing_list = comma separated list of motors which are safe to send "home"
|
||||
variable is_homing_list ""
|
||||
}
|
||||
|
||||
@@ -1 +1,6 @@
|
||||
source $cfPath(commands)/commands_common.tcl
|
||||
|
||||
namespace eval motor {
|
||||
# is_homing_list = comma separated list of motors which are safe to send "home"
|
||||
variable is_homing_list ""
|
||||
}
|
||||
|
||||
@@ -1 +1,6 @@
|
||||
source $cfPath(commands)/commands_common.tcl
|
||||
|
||||
namespace eval motor {
|
||||
# is_homing_list = comma separated list of motors which are safe to send "home"
|
||||
variable is_homing_list ""
|
||||
}
|
||||
|
||||
@@ -1 +1,6 @@
|
||||
source $cfPath(commands)/commands_common.tcl
|
||||
|
||||
namespace eval motor {
|
||||
# is_homing_list = comma separated list of motors which are safe to send "home"
|
||||
variable is_homing_list ""
|
||||
}
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
source $cfPath(commands)/commands_common.tcl
|
||||
|
||||
namespace eval motor {
|
||||
# is_homing_list = comma separated list of motors which are safe to send "home"
|
||||
variable is_homing_list ""
|
||||
}
|
||||
|
||||
namespace eval sample {
|
||||
command select {int=0:8 sampid} {
|
||||
SampleNum $sampid
|
||||
@@ -72,3 +77,7 @@ namespace eval optics {
|
||||
::optics::guide -addfb text status
|
||||
::optics::guide -set feedback status IDLE
|
||||
}
|
||||
|
||||
proc ::commands::isc_initialize {} {
|
||||
::commands::ic_initialize
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# SICS common configuration
|
||||
|
||||
# $Revision: 1.38 $
|
||||
# $Date: 2008-07-18 04:33:38 $
|
||||
# $Revision: 1.39 $
|
||||
# $Date: 2008-08-14 05:00:18 $
|
||||
# Author: Ferdi Franceschini (ffr@ansto.gov.au)
|
||||
# Last revision by $Author: ffr $
|
||||
|
||||
@@ -138,7 +138,7 @@ sics_release [lindex $tmpstr [expr [llength $tmpstr] - 1]]
|
||||
sics_release lock
|
||||
|
||||
::utility::mkVar sics_revision_num Text internal
|
||||
set tmpstr [string map {"$" ""} {$Revision: 1.38 $}]
|
||||
set tmpstr [string map {"$" ""} {$Revision: 1.39 $}]
|
||||
sics_revision_num [lindex $tmpstr [expr [llength $tmpstr] - 1]]
|
||||
sics_revision_num lock
|
||||
|
||||
@@ -187,6 +187,7 @@ proc server_init {} {
|
||||
::counter::isc_initialize
|
||||
::histogram_memory::isc_initialize
|
||||
::scan::isc_initialize
|
||||
::commands::isc_initialize
|
||||
MakeStateMon hmscan
|
||||
sicslist setatt sics_suid privilege readonly
|
||||
sicslist setatt sics_suid klass data
|
||||
|
||||
@@ -19,6 +19,7 @@ proc command {acmdName arglist body} {
|
||||
unset ${cmdName}_feedback_list
|
||||
}
|
||||
# puts "cmdName: $cmdName"
|
||||
set params ""
|
||||
foreach {type_spec var} $arglist {
|
||||
lappend params $var
|
||||
foreach {type domain} [split $type_spec "="] {}
|
||||
|
||||
@@ -94,6 +94,7 @@ typedef struct ___MoDriv {
|
||||
float fPos; /* simulated current position */
|
||||
float fTarget; /* simulation target position including fault */
|
||||
float fDestination; /* requested final position */
|
||||
float home;
|
||||
int iStatus;
|
||||
char units[256]; /**< physical units for axis */
|
||||
char long_name[256]; /**< long name of motor */
|
||||
@@ -650,6 +651,15 @@ int SimAction(SConnection *pCon, SicsInterp *pSics, void *pData,
|
||||
}
|
||||
newZero = (currPos - newValue);
|
||||
return MotorSetPar(self->pMot, pCon, "softzero", newZero);
|
||||
} else if(strcasecmp("home", argv[1]) == 0) {
|
||||
if (argc > 2) {
|
||||
sscanf(argv[2], "%f", &(self->home));
|
||||
} else {
|
||||
char line[132];
|
||||
snprintf(line, 132, "%s.home = %f", argv[0], self->home);
|
||||
SCWrite(pCon, line, eValue);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
else if(strcasecmp("reset", argv[1]) == 0) { }
|
||||
else if(strcasecmp("state", argv[1]) == 0) { }
|
||||
|
||||
Reference in New Issue
Block a user