-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmocap.tcl
90 lines (63 loc) · 1.71 KB
/
mocap.tcl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
if { [info exists _MOCAP.TCL] == 0 } {
set _MOCAP.TCL 1
source connectSpace.tcl
set home $env(HOME)
set mocapPath /workspace/mocapBin/Linux/
lm mocap on space path $home$mocapPath
proc getPositionMocap { position } {
upvar $position pos
set format "status = OK\n"
append format "Position.status = %d\n"
append format "Position.padding = %d\n"
append format "Position.x = %f\n"
append format "Position.y = %f\n"
append format "Position.theta = %f\n"
scan [mocap::EstimatedPositionPositionPosterRead] $format status padding xRob yRob theta
while { $status != 0 } {
after 200
scan [mocap::EstimatedPositionPositionPosterRead] $format status padding xRob yRob theta
puts "Bad getPositionMocap Read"
}
set pos(status) $status
set pos(xRob) $xRob
set pos(yRob) $yRob
set pos(theta) $theta
}
proc getPositionMocapTreatError { position } {
upvar $position pos
set format "status = OK\n"
append format "Position.status = %d\n"
append format "Position.padding = %d\n"
append format "Position.x = %f\n"
append format "Position.y = %f\n"
append format "Position.theta = %f\n"
scan [mocap::EstimatedPositionPositionPosterRead] $format status padding xRob yRob theta
set pos(status) $status
set pos(xRob) $xRob
set pos(yRob) $yRob
set pos(theta) $theta
}
proc initMocapCalib {} {
global pi
mocap::Init
mocap::ClearCalib
for {set i 0} {$i < 3} {incr i} {
turn [expr {2*$pi/3}]
mocap::SetCalibPoint
}
move 0.3
mocap::SetCalibPoint
move -0.3
mocap::ReadMarkers -ack
after 100
}
proc initMocapFile {} {
puts "initing Mocap"
mocap::Init
puts "Start Reading Markers"
mocap::ReadMarkers -ack
puts "Wait a Little bit to read firts marker"
after 200
}
#ifndef
}