update for Lyrebird deployment
r3105 | jgn | 2011-04-20 08:48:12 +1000 (Wed, 20 Apr 2011) | 1 line
This commit is contained in:
committed by
Douglas Clowes
parent
9acffeb772
commit
8b1d0103f4
@@ -0,0 +1,66 @@
|
||||
#---------------------------------------------------------------
|
||||
# This is a second generation simulation motor.
|
||||
#
|
||||
# copyright: see file COPYRIGHT
|
||||
#
|
||||
# Mark Koennecke, December 2008
|
||||
#----------------------------------------------------------------
|
||||
proc simhardset {motname newval} {
|
||||
hset /sics/$motname/starttime [clock sec]
|
||||
}
|
||||
#--------------------------------------------------------------
|
||||
proc simhardget {motname} {
|
||||
set stat [hval /sics/$motname/status]
|
||||
set val [hval /sics/$motname/targetposition]
|
||||
if {[string first run $stat] >= 0 \
|
||||
|| [string first error $stat] >= 0 } {
|
||||
return [expr $val -.777]
|
||||
} else {
|
||||
return $val
|
||||
}
|
||||
}
|
||||
#-------------------------------------------------------------
|
||||
proc simhardfaultget {motname} {
|
||||
set val [hval /sics/$motname/targetposition]
|
||||
return [expr $val - .5]
|
||||
}
|
||||
#--------------------------------------------------------------
|
||||
proc simstatusget {motname} {
|
||||
set start [hval /sics/$motname/starttime]
|
||||
if {$start < 0} {
|
||||
return error
|
||||
}
|
||||
set delay [hval /sics/$motname/delay]
|
||||
if {[clock sec] > $start + $delay} {
|
||||
return idle
|
||||
} else {
|
||||
return run
|
||||
}
|
||||
}
|
||||
#-------------------------------------------------------------
|
||||
proc simstatusfault {motname } {
|
||||
clientput "ERROR: I am feeling faulty!"
|
||||
return error
|
||||
}
|
||||
#--------------------------------------------------------------
|
||||
proc simhalt {motname} {
|
||||
hset /sics/$motname/starttime -100
|
||||
}
|
||||
#---------------------------------------------------------------
|
||||
proc MakeSecSim {name lower upper delay} {
|
||||
MakeSecMotor $name
|
||||
hfactory /sics/$name/delay plain user text
|
||||
hfactory /sics/$name/starttime plain user int
|
||||
hset /sics/$name/delay $delay
|
||||
hdel /sics/$name/hardposition
|
||||
hfactory /sics/$name/hardposition script "simhardget $name" "simhardset $name" float
|
||||
# hfactory /sics/$name/hardposition script "simhardfaultget $name" "simhardset $name" float
|
||||
hdel /sics/$name/status
|
||||
hfactory /sics/$name/status script "simstatusget $name" "hdbReadOnly b" text
|
||||
# hfactory /sics/$name/status script "simstatusfault $name" "hdbReadOnly b" text
|
||||
$name makescriptfunc halt "simhalt $name" user
|
||||
hupdate /sics/$name/hardupperlim $upper
|
||||
hupdate /sics/$name/softupperlim $upper
|
||||
hupdate /sics/$name/hardlowerlim $lower
|
||||
hupdate /sics/$name/softlowerlim $lower
|
||||
}
|
||||
Reference in New Issue
Block a user