-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathguideTest
137 lines (98 loc) · 1.52 KB
/
guideTest
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
array "markX" 14
array "markY" 14
array "markTh" 14
pi = 3.1415926
%test
markX[0]=0.0
markX[1]=0.0
markX[2]=4.0
markX[3]=4.0
markX[4]=0.0
markX[5]=0.0
markX[6]=4.0
markX[7]=4.0
markX[8]=0.0
markX[9]=4.0
markX[10]=0.5
markX[11]=3.5
markX[12]=2.0
markX[13]=2.0
markY[0]=1.5
markY[1]=1.5
markY[2]=1.5
markY[3]=1.5
markY[4]=3.5
markY[5]=3.5
markY[6]=3.5
markY[7]=3.5
markY[8]=4.5
markY[9]=4.5
markY[10]=5.0
markY[11]=5.0
markY[12]=4.0
markY[13]=4.0
markTh[0]=3.14
markTh[1]=0
markTh[2]=3.14
markTh[3]=0
markTh[4]=3.14
markTh[5]=0
markTh[6]=3.14
markTh[7]=0
markTh[8]=0
markTh[9]=3.14
markTh[10]=-1.57
markTh[11]=-1.57
markTh[12]=3.14
markTh[13]=0
set "$odox" 0.5
set "$odoy" 0.5
set "$odoth" 0
eval $odox
eval $odoy
turn 90
fwd 1.5
turn 90
label "findGuidemark"
wait 1
startx = $odox
starty = $odoy
endx = markX[$fiducialid]
endy = markY[$fiducialid]
stringcat "findroute startx= "startx" starty = "starty" endx = "endx" endy = "endy""
laser "$string"
wait 1
n = $l4
label "move2next"
stringcat "getpoint p=" n-1
laser "$string"
wait 1
x = $l5
y = $l6
theta = $l7
eval x
eval y
n = n-1
X = $odox - x
Y = $odoy - y
eval X
eval Y
distance = sqrt(X*X+Y*Y)
gamma = atan2(Y,X)
eval gamma
eval $odoth
alpha = (-$odoth+gamma)-pi
turn alpha "rad"
ignoreobstacles
fwd distance
%drive X Y theta "rad" : ($targetdist <0.05)
beta = (theta-$odoth)*180/pi
%turn beta
eval n
if (n>=0) "move2next"
label "look4mark"
eval $fiducialid
if ($fiducialid != -1) "findGuidemark"
turn -90
if ($fiducialid == -1) "look4mark"
eval $fiducialid