forked from FLAGDroneracing/flag_planner
-
Notifications
You must be signed in to change notification settings - Fork 0
/
x.xml.snippets.xml
98 lines (90 loc) · 1.79 KB
/
x.xml.snippets.xml
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
<snippets>
<snippet name="1st_derivative">
<global>prevX = 0
prevY = 0
is_first = true</global>
<function>if (is_first) then
is_first = false
prevX = time
prevY = value
end
dx = time - prevX
dy = value - prevY
prevX = time
prevY = value
return dy/dx</function>
<linkedSource></linkedSource>
</snippet>
<snippet name="average_two_curves">
<global></global>
<function>return (value+v1)/2</function>
<linkedSource></linkedSource>
</snippet>
<snippet name="xxxxxx">
<global></global>
<function>return (v2*v2+v1*v1)</function>
<linkedSource></linkedSource>
</snippet>
<snippet name="integral">
<global>prevX = 0
integral = 0
is_first = true</global>
<function>if (is_first) then
is_first = false
prevX = time
end
dx = time - prevX
prevX = time
integral = integral + value*dx
return integral</function>
<linkedSource></linkedSource>
</snippet>
<snippet name="rad_to_deg">
<global></global>
<function>return value*180/3.1417</function>
<linkedSource></linkedSource>
</snippet>
<snippet name="remove_offset">
<global>is_first = true
first_value = 0</global>
<function>if (is_first) then
is_first = false
first_value = value
end
return value - first_value</function>
<linkedSource></linkedSource>
</snippet>
<snippet name="sqrt">
<global>
left = 0
right = 0
mid = 0
last = 0
is_first = true</global>
<function>
left = 0
right = 0
mid = 0
last = 0
is_first = true
n = (v2*v2+v1*v1)
right = n
if(n==1) then
return 1
end
if (is_first) then
if(mid > n / mid) then
right = mid
else
left = mid
end
last = mid
mid = left + (right - left)/2
if((mid - last)*(mid - last)>0.000001) then
is_first = false
end
end
return mid</function>
<linkedSource></linkedSource>
</snippet>
</snippets>