Changes to ROTATE in driver to match changes in Robots
r3063 | dcl | 2011-02-18 11:22:21 +1100 (Fri, 18 Feb 2011) | 1 line
This commit is contained in:
@@ -40,6 +40,23 @@ debug_log "setNam new data for $tc_root [sct] result=$data"
|
||||
return $nextState
|
||||
}
|
||||
|
||||
proc setRot {tc_root nextState cmd} {
|
||||
set data [string toupper [sct target]]
|
||||
if {$data != [sct oldval]} {
|
||||
sct oldval $data
|
||||
sct update $data
|
||||
sct utime readtime
|
||||
debug_log "setRot new data for $tc_root [sct] result=$data"
|
||||
if {$data > 0} {
|
||||
hset $tc_root/status "busy"
|
||||
sct send "ROTATE $data -1"
|
||||
} else {
|
||||
sct send "STOPROT"
|
||||
}
|
||||
}
|
||||
return $nextState
|
||||
}
|
||||
|
||||
proc chkWrite {tc_root} {
|
||||
set data [sct result]
|
||||
debug_log "chkWrite resp=$data sct=[sct] tc_root=$tc_root"
|
||||
@@ -82,8 +99,6 @@ debug_log "setPoint: sct=[sct] target=[sct target] writestatus=[sct writestatus]
|
||||
sct utime readtime
|
||||
debug_log "setPoint new data for $tc_root [sct] result=$par"
|
||||
}
|
||||
hset $tc_root/status "busy"
|
||||
sct print "status: busy"
|
||||
if { [sct target] == 1 } {
|
||||
if { [string toupper [hval $tc_root/Control/Target_Loc]] == "BEAM" } {
|
||||
set cmd "SampToBeam [hval $tc_root/Control/Pallet_Nam] [hval $tc_root/Control/Pallet_Idx]"
|
||||
@@ -120,6 +135,8 @@ debug_log "sct send $cmd"
|
||||
debug_log "error:$err_msg"
|
||||
return -code error "$err_msg"
|
||||
}
|
||||
hset $tc_root/status "busy"
|
||||
sct print "status: busy"
|
||||
hsetprop $tc_root/setpoint driving 1
|
||||
} catch_message ]
|
||||
if {$catch_status != 0} {
|
||||
@@ -198,8 +215,12 @@ debug_log "getState returns: $nextState"
|
||||
set my_driving [SplitReply [hgetprop $tc_root/setpoint driving]]
|
||||
if { $my_driving } {
|
||||
if { [string toupper [sct result]] == "IDLE" } {
|
||||
hset $tc_root/status "idle"
|
||||
hsetprop $tc_root/setpoint driving 0
|
||||
hset $tc_root/sensor/value [hval $tc_root/setpoint]
|
||||
if {[hval $tc_root/Control/Rotate] > 0} {
|
||||
hset $tc_root/Control/Rotate 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -236,10 +257,11 @@ debug_log "getState returns: $nextState"
|
||||
# NOTE: The drive adapter initially sets the writestatus to "start" and will
|
||||
# only call this when writestatus!="start"
|
||||
proc drivestatus {tc_root} {
|
||||
if {[sct driving]} {
|
||||
if {[hval $tc_root/status] == "busy"} {
|
||||
return busy
|
||||
} elseif {[sct driving]} {
|
||||
return busy
|
||||
} else {
|
||||
sct print "drivestatus: idle"
|
||||
return idle
|
||||
}
|
||||
}
|
||||
@@ -358,6 +380,7 @@ debug_log "Registering node $nodeName for write callback"
|
||||
Control Pallet_Nam 0 1 0 text user {} {} {} {setNam} {A,B}\
|
||||
Control Pallet_Idx 0 1 0 int user {} {} {} {} {}\
|
||||
Control Target_Loc 0 1 0 Text user {} {} {} {setNam} {Beam,Vacuum}\
|
||||
Control Rotate 0 1 0 int user {} {} {} {setRot} {}\
|
||||
}
|
||||
|
||||
hfactory $scobj_hpath/sensor plain spy none
|
||||
@@ -461,4 +484,4 @@ namespace import ::scobj::robot_pp::*
|
||||
|
||||
#add_robot robbie 137.157.201.213 502 5
|
||||
#add_robot robbie localhost 30509
|
||||
#add_robot robbie 137.157.201.26 6000
|
||||
add_robot robbie 137.157.201.26 6000
|
||||
|
||||
Reference in New Issue
Block a user