Update to drive the rest of the way
r3696 | dcl | 2012-08-08 13:36:40 +1000 (Wed, 08 Aug 2012) | 1 line
This commit is contained in:
@@ -347,18 +347,21 @@ namespace eval ::scobj::cybaman {
|
||||
set par "[sct target]"
|
||||
set channel [string toupper [string range [basename [sct]] end-1 end]]
|
||||
if { "$channel" == "GA" } {
|
||||
# and move by maximum 90 degree steps
|
||||
# and move by maximum 179 degree steps
|
||||
set here [hval [pathname [sct]]/act_pos_GA]
|
||||
if { $par > $here } {
|
||||
if { ($par - $here) > 90.0 } {
|
||||
set par [expr $here + 90.0]
|
||||
if { ($par - $here) > 179.0 } {
|
||||
set par [expr $here + 179.0]
|
||||
}
|
||||
} elseif { $par < $here } {
|
||||
if { ($par - $here) < -90.0 } {
|
||||
set par [expr $here - 90.0]
|
||||
if { ($par - $here) < -179.0 } {
|
||||
set par [expr $here - 179.0]
|
||||
}
|
||||
}
|
||||
sct print "Setting GA to $par (was [sct target])"
|
||||
if { $par != [sct target] } {
|
||||
debug_log "Setting GA to $par (cur = $here, target = [sct target])"
|
||||
sct print "Setting GA to $par (cur = $here, target = [sct target])"
|
||||
}
|
||||
# change [-180,180] to [0,360]
|
||||
if { $par < 0 } {
|
||||
set data "[expr {round(10000 * ( 360.0 + $par ))}]"
|
||||
@@ -767,11 +770,12 @@ debug_log "chkWrite new data for $tc_root [sct] result=$data"
|
||||
# still moving
|
||||
} elseif { "$current_state" == 1 } {
|
||||
# has become idle
|
||||
if { [hgetpropval $tc_root/display/set_pos_GA target] != [hval $tc_root/display/set_pos_GA] } {
|
||||
sct print "we should take another bite"
|
||||
# hset $tc_root/Display/set_pos_GA [hgetpropval /display/set_pos_GA target]
|
||||
#}
|
||||
if { [hval $tc_root/display/act_pos_GA] == [hval $tc_root/display/set_pos_GA] &&
|
||||
if { [hval $tc_root/display/set_pos_GA] != [hgetpropval $tc_root/display/set_pos_GA target] } {
|
||||
broadcast "we should take another bite [hval $tc_root/display/set_pos_GA] != [hgetpropval $tc_root/display/set_pos_GA target]"
|
||||
debug_log "we should take another bite [hval $tc_root/display/set_pos_GA] != [hgetpropval $tc_root/display/set_pos_GA target]"
|
||||
hset $tc_root/Display/set_pos_GA [hgetpropval $tc_root/display/set_pos_GA target]
|
||||
hset $tc_root/Display/visstart 1
|
||||
} elseif { [hval $tc_root/display/act_pos_GA] == [hval $tc_root/display/set_pos_GA] &&
|
||||
[hval $tc_root/display/act_pos_GB] == [hval $tc_root/display/set_pos_GB] &&
|
||||
[hval $tc_root/display/act_pos_GC] == [hval $tc_root/display/set_pos_GC] } {
|
||||
hsetprop $tc_root/device_state my_state "STATE_IDLE"
|
||||
@@ -780,6 +784,8 @@ debug_log "chkWrite new data for $tc_root [sct] result=$data"
|
||||
hsetprop $tc_root/GC/Setpoint driving 0
|
||||
debug_log "drive_state: [sct] IDLE"
|
||||
hset $tc_root/drive_state "IDLE"
|
||||
} else {
|
||||
hset $tc_root/Display/visstart 1
|
||||
}
|
||||
set nextState "idle"
|
||||
} else {
|
||||
@@ -891,6 +897,7 @@ debug_log "checktol $tc_root $currtime $timecheck"
|
||||
return "hwfault"
|
||||
}
|
||||
if {[sct driving]} {
|
||||
debug_log "drivestatus: [sct] busy"
|
||||
return "busy"
|
||||
} else {
|
||||
debug_log "drivestatus: [sct] idle"
|
||||
@@ -1036,7 +1043,7 @@ debug_log "Creating node $nodeName"
|
||||
Display opmode 0 0 0 int user {opmode} {rdValue} {} {} {}\
|
||||
Display prognumber 1 0 0 int user {mainProgNumber} {rdValue} {} {} {}\
|
||||
Display reset 1 1 0 int user {visin_ctrlR} {rdValue} {visin_ctrlR} {wrValue} {}\
|
||||
Display set_pos_GA 1 1 0 float user {p101} {rdAngle} {p101} {wrAngle} {-180:180}\
|
||||
Display set_pos_GA 1 1 0 float user {p101} {rdAngle} {p101} {wrAngle} {-179:180}\
|
||||
Display set_pos_GB 1 1 0 float user {p102} {rdAngle} {p102} {wrAngle} {-180:180}\
|
||||
Display set_pos_GC 1 1 0 float user {p103} {rdAngle} {p103} {wrAngle} {-180:180}\
|
||||
Display feed_rate 1 1 0 int user {p104} {rdValue} {p104} {wrValue} {0:99999}\
|
||||
@@ -1047,7 +1054,7 @@ debug_log "Creating node $nodeName"
|
||||
Display vise_stop 0 1 0 int user {vise_stop} {rdValue} {vise_stop} {wrValue} {}\
|
||||
Display Value 1 0 0 int internal {mainProgNumber} {rdValue} {} {} {}\
|
||||
{} Setpoint 0 1 1 int user {} {} {} {setPoint} {}\
|
||||
GA Setpoint 0 1 1 float user {} {} {} {setPt} {-180:180}\
|
||||
GA Setpoint 0 1 1 float user {} {} {} {setPt} {-179:180}\
|
||||
GA Value 1 0 0 float user {} {rdV.rdN} {} {} {}\
|
||||
GB Setpoint 0 1 1 float user {} {} {} {setPt} {-180:180}\
|
||||
GB Value 1 0 0 float user {} {rdV.rdN} {} {} {}\
|
||||
|
||||
Reference in New Issue
Block a user