SICS-821: You can now use the "whenall" keyword to forbid a move based on the positions of a set of motors.

This commit is contained in:
Ferdi Franceschini
2014-11-05 12:52:32 +11:00
parent 4dbaa0f73d
commit a375c6ce20

View File

@ -93,6 +93,7 @@ proc ::anticollider::genveto {veto_rules} {
lappend condlist $mot $range
}
lappend veto_region($vp(for)) [list $vp(forbid) @and $condlist]
unset condlist
} elseif [info exists vp(when)] {
lappend veto_region($vp(for)) [list $vp(forbid) $vp(when) $vp(in)]
} else {
@ -132,12 +133,12 @@ proc ::anticollider::veto_region_acscript {args} {
foreach row $veto_region($regmot) {
if { [lindex $row 1] == "@and"} {
set forbid [lindex $row 0]
set veto 0
set veto 1
foreach {mot range} [lindex $row 2] {
set pos [SplitReply [$mot]]
foreach {lower upper} [join $range] {
if {$pos >= $lower && $pos <= $upper} {
set veto 1
if {$pos < $lower || $pos > $upper} {
set veto 0
break
}
}
@ -147,7 +148,10 @@ proc ::anticollider::veto_region_acscript {args} {
} else {
foreach {min max} $forbid {}
if {$min <= $target && $target <= $max} {
error "ERROR:The range ($forbid) is forbidden for $regmot when [lindex $row 2]"
foreach {mot range} [lindex $row 2] {
lappend msg [list $mot in $range]
}
error "ERROR:The range ($forbid) is forbidden for $regmot when [join $msg { and }]"
}
}
} else {
@ -212,15 +216,13 @@ proc ::anticollider::init {} {
lappend ::anticollider::scripts ::anticollider::veto_region_acscript
proc ::anticollider::acscript {args} {
set catch_status [ catch {
if {[::anticollider::enable $args] == "false"} {
return
} else {
foreach {regmot target} $args {
anticollision add 0 $regmot $target
}
foreach {regmot target} $args {
anticollision add 0 $regmot $target
}
foreach script $::anticollider::scripts {
$script {*}$args
if {[::anticollider::enable $args] == "true"} {
foreach script $::anticollider::scripts {
$script {*}$args
}
}
} message ]
handle_acscript_exception $catch_status $message