proc test {} {
global some k ::counter
set ::counter 0
wm title . ExecLog
set w .tcl
if {![jsLayout $w bigbox -title "Setup"]} {
frame $w.top -borderwidth 10
pack $w.top -side top -fill x
button $w.top.quit -text Quit -command exit
set but [button $w.top.run -text "Run it" -command joint]
pack $w.top.quit $w.top.run -side right
label $w.top.l -text Command: -padx 0
entry $w.top.cmd -width 20 -relief sunken -textvariable ::command
pack $w.top.l -side left
pack $w.top.cmd -side left -fill x -expand true
bind $w.top.cmd <Return> joint
focus $w.top.cmd
}
}
proc joint {} {
global ::command but at1 bt1 ct1 at2 bt2 ct2 ::counter
if {$::command == "start"} {
set matb [new_jMatrix]
set mat [new_jMatrix]
set matrixList [jMatrix_getList $mat]
set x1 [lindex [jMatrix_getList $mat] 12]
set y1 [lindex [jMatrix_getList $mat] 13]
set z1 [lindex [jMatrix_getList $mat] 14]
set matrixList [jMatrix_getList $matb]
set x2 [lindex [jMatrix_getList $matb] 12]
set y2 [lindex [jMatrix_getList $matb] 13]
set z2 [lindex [jMatrix_getList $matb] 14]
set ::at1($::counter) $x1
set ::bt1($::counter) $y1
set ::ct1($::counter) $z1
set ::at2($::counter) $x2
set ::bt2($::counter) $y2
set ::ct2($::counter) $z2
set data [float_array jntPtr] ;
jcJoint_getAngles $jntPtr $data 0;
set ::array_thumb($::counter) [float_get $data 0]
puts "$::at2($::counter)"
incr ::counter
} else {
set ::counter 0
incr ::counter
set fileid [open y:/$::command w+]
while {$::counter <= 500} {
puts $fileid "$::at1($::counter) $::bt1($::counter) $::ct1($::counter) $::at2($::counter) $::bt2($::counter) $::ct2($::counter) ";
}
while {$::counter <= 500} {
puts $fileid "$::array_thumb($::counter)"
}
close $fileid
}
}