Make sure that the command status transitions to IDLE if it was set to BUSY
This commit is contained in:
@@ -19,6 +19,12 @@ if [ catch {
|
|||||||
}
|
}
|
||||||
set path [sct]
|
set path [sct]
|
||||||
if {[hval $path/status] == "STOPPING"} {
|
if {[hval $path/status] == "STOPPING"} {
|
||||||
|
hset $path/driving "false"
|
||||||
|
hset $path/status "IDLE"
|
||||||
|
} elseif { ([hval $path/driving] == "false") && ([hval $path/status] == "BUSY") } {
|
||||||
|
hset $path/driving "starting"
|
||||||
|
} elseif { ([hval $path/driving] == "starting") && ([hval $path/status] == "BUSY") } {
|
||||||
|
hset $path/driving "false"
|
||||||
hset $path/status "IDLE"
|
hset $path/status "IDLE"
|
||||||
}
|
}
|
||||||
return idle
|
return idle
|
||||||
@@ -35,6 +41,7 @@ proc ::scobj::positmotor::reqVal {state motor} {
|
|||||||
# @brief Convert the target position to a motor position and drive the motor to the target.
|
# @brief Convert the target position to a motor position and drive the motor to the target.
|
||||||
proc ::scobj::positmotor::setVal {ID2valXfn motor table} {
|
proc ::scobj::positmotor::setVal {ID2valXfn motor table} {
|
||||||
set path [sct]
|
set path [sct]
|
||||||
|
hdelprop $path error_in_::scobj::positmotor::setVal
|
||||||
set pos [$ID2valXfn [sct target] $table]
|
set pos [$ID2valXfn [sct target] $table]
|
||||||
hset $path/status "BUSY"
|
hset $path/status "BUSY"
|
||||||
run $motor $pos
|
run $motor $pos
|
||||||
@@ -73,6 +80,8 @@ proc mkPosit {sct_controller name type motor klass table} {
|
|||||||
|
|
||||||
hfactory /sics/$name/status plain spy text
|
hfactory /sics/$name/status plain spy text
|
||||||
hset /sics/$name/status "IDLE"
|
hset /sics/$name/status "IDLE"
|
||||||
|
hfactory /sics/$name/driving plain spy text
|
||||||
|
hset /sics/$name/driving "false"
|
||||||
|
|
||||||
proc ${ns}::${motor}_MOTEND {} [subst -nocommands {
|
proc ${ns}::${motor}_MOTEND {} [subst -nocommands {
|
||||||
if { [hval /sics/$name/status] == "BUSY"} {
|
if { [hval /sics/$name/status] == "BUSY"} {
|
||||||
@@ -82,6 +91,12 @@ proc mkPosit {sct_controller name type motor klass table} {
|
|||||||
publish ${ns}::${motor}_MOTEND user
|
publish ${ns}::${motor}_MOTEND user
|
||||||
|
|
||||||
scriptcallback connect $motor MOTEND ${ns}::${motor}_MOTEND
|
scriptcallback connect $motor MOTEND ${ns}::${motor}_MOTEND
|
||||||
|
proc ${ns}::${motor}_MOTDRIVE {} [subst -nocommands {
|
||||||
|
hset /sics/$name/driving "true"
|
||||||
|
}]
|
||||||
|
publish ${ns}::${motor}_MOTDRIVE user
|
||||||
|
|
||||||
|
scriptcallback connect $motor MOTORDRIVE ${ns}::${motor}_MOTDRIVE
|
||||||
::scobj::hinitprops $name
|
::scobj::hinitprops $name
|
||||||
$sct_controller poll /sics/$name 2
|
$sct_controller poll /sics/$name 2
|
||||||
$sct_controller write /sics/$name
|
$sct_controller write /sics/$name
|
||||||
|
|||||||
Reference in New Issue
Block a user