-
Notifications
You must be signed in to change notification settings - Fork 0
/
shiplanding_formula.tbt
262 lines (252 loc) · 10.3 KB
/
shiplanding_formula.tbt
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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
// SPDX-FileCopyrightText: 2023 German Aerospace Center (DLR)
// SPDX-License-Identifier: Apache-2.0
Deg45_HeightAboveShip = 20.0;
Deg45_DistanceToShip = 30.0;
Deg45_AngleToShip = 135.0;
Deg45_AboveTouchdown = 20.0;
Lateral_HeightAboveShip = 20.0;
Lateral_DistanceToShip = 20.0;
Lateral_AngleToShip = 90.0;
Lateral_AboveTouchdown = 20.0;
Oblique_HeightAboveShip = 20.0;
Oblique_DistanceToShip = 30.0;
Oblique_AngleToShip = 135.0;
Oblique_AngleOblique = 45.0;
Oblique_AboveTouchdown = 20.0;
Straight_HeightAboveShip = 20.0;
Straight_DistanceToShip = 20.0;
Straight_AngleToShip = 180.0;
Straight_AboveTouchdown = 20.0;
In_Position_Pos_Slack = 2.5;
In_Position_HeadingAligned_Slack = 1.0;
In_Position_HeadingOblique_Slack = 1.0;
In_Position_Velocity_Slack = 2.0;
Move_to_Touchdown_Slack = 2.5;
Descend_Slack = 1.0;
-> (
? (
-> (
'move_to_position_45deg'
<> in_pos(uas_x, uas_y, uas_z, ship_x, ship_y, ship_z, ship_heading)
[
In_Position_Pos_Slack -
!sqrt(
(ship_x + Deg45_DistanceToShip * !cos(!degToRad(Deg45_AngleToShip) + ship_heading) - uas_x)^2 +
(ship_y + Deg45_DistanceToShip * !sin(!degToRad(Deg45_AngleToShip) + ship_heading) - uas_y)^2 +
(ship_z + Deg45_HeightAboveShip - uas_z)^2
)
]
,
'stay_in_position'
[0..5]
in_pos(uas_x, uas_y, uas_z, ship_x, ship_y, ship_z, ship_heading)
[
In_Position_Pos_Slack -
!sqrt(
(ship_x + Deg45_DistanceToShip * !cos(!degToRad(Deg45_AngleToShip) + ship_heading) - uas_x)^2 +
(ship_y + Deg45_DistanceToShip * !sin(!degToRad(Deg45_AngleToShip) + ship_heading) - uas_y)^2 +
(ship_z + Deg45_HeightAboveShip - uas_z)^2
)
]
&
heading_aligned(uas_heading, ship_heading)
[
In_Position_HeadingAligned_Slack - !abs(!radToDeg(uas_heading - ship_heading))
]
&
velocity_aligned(uas_u, uas_v, uas_w, ship_u, ship_v, ship_w)
[
In_Position_Velocity_Slack -
!abs(!sqrt( uas_u^2 + uas_v^2 + uas_w^2) - !sqrt( ship_u^2 + ship_v^2 + ship_w^2))
]
,
'move_to_touchdown'
<>
move_td(uas_x, uas_y, uas_z, ship_x, ship_y, ship_z)
[
Move_to_Touchdown_Slack -
!sqrt(
(uas_x - ship_x)^2 +
(uas_y - ship_y)^2 +
(uas_z - (ship_z + Deg45_AboveTouchdown))^2
)
]
&
heading_aligned(uas_heading, ship_heading)
[
In_Position_HeadingAligned_Slack - !abs(!radToDeg(uas_heading - ship_heading))
]
)
,
-> (
'move_to_position_oblique'
<> in_pos(uas_x, uas_y, uas_z, ship_x, ship_y, ship_z, ship_heading)
[
In_Position_Pos_Slack -
!sqrt(
(ship_x + Oblique_DistanceToShip * !cos(!degToRad(Oblique_AngleToShip) + ship_heading) - uas_x)^2 +
(ship_y + Oblique_DistanceToShip * !sin(!degToRad(Oblique_AngleToShip) + ship_heading) - uas_y)^2 +
(ship_z + Oblique_HeightAboveShip - uas_z)^2
)
]
,
'stay_in_position'
[0..5]
in_pos(uas_x, uas_y, uas_z, ship_x, ship_y, ship_z, ship_heading)
[
In_Position_Pos_Slack -
!sqrt(
(ship_x + Oblique_DistanceToShip * !cos(!degToRad(Oblique_AngleToShip) + ship_heading) - uas_x)^2 +
(ship_y + Oblique_DistanceToShip * !sin(!degToRad(Oblique_AngleToShip) + ship_heading) - uas_y)^2 +
(ship_z + Oblique_HeightAboveShip - uas_z)^2
)
]
&
heading_obliqued(uas_heading, ship_heading)
[
In_Position_HeadingOblique_Slack - !abs( !abs(!radToDeg(uas_heading - ship_heading)) - Oblique_AngleOblique )
]
&
velocity_aligned(uas_u, uas_v, uas_w, ship_u, ship_v, ship_w)
[
In_Position_Velocity_Slack -
!abs(!sqrt( uas_u^2 + uas_v^2 + uas_w^2) - !sqrt( ship_u^2 + ship_v^2 + ship_w^2))
]
,
'move_to_touchdown'
<>
move_td(uas_x, uas_y, uas_z, ship_x, ship_y, ship_z)
[
Move_to_Touchdown_Slack -
!sqrt(
(uas_x - ship_x)^2 +
(uas_y - ship_y)^2 +
(uas_z - (ship_z + Oblique_AboveTouchdown))^2
)
]
&
heading_obliqued(uas_heading, ship_heading)
[
In_Position_HeadingOblique_Slack - !abs( !abs(!radToDeg(uas_heading - ship_heading)) - Oblique_AngleOblique )
]
)
,
-> (
'move_to_position_lateral'
<> in_pos(uas_x, uas_y, uas_z, ship_x, ship_y, ship_z, ship_heading)
[
In_Position_Pos_Slack -
!sqrt(
(ship_x + Lateral_DistanceToShip * !cos(!degToRad(Lateral_AngleToShip) + ship_heading) - uas_x)^2 +
(ship_y + Lateral_DistanceToShip * !sin(!degToRad(Lateral_AngleToShip) + ship_heading) - uas_y)^2 +
(ship_z + Lateral_HeightAboveShip - uas_z)^2
)
]
,
'stay_in_position'
[0..5]
in_pos(uas_x, uas_y, uas_z, ship_x, ship_y, ship_z, ship_heading)
[
In_Position_Pos_Slack -
!sqrt(
(ship_x + Lateral_DistanceToShip * !cos(!degToRad(Lateral_AngleToShip) + ship_heading) - uas_x)^2 +
(ship_y + Lateral_DistanceToShip * !sin(!degToRad(Lateral_AngleToShip) + ship_heading) - uas_y)^2 +
(ship_z + Lateral_HeightAboveShip - uas_z)^2
)
]
&
heading_aligned(uas_heading, ship_heading)
[
In_Position_HeadingAligned_Slack - !abs(!radToDeg(uas_heading - ship_heading))
]
&
velocity_aligned(uas_u, uas_v, uas_w, ship_u, ship_v, ship_w)
[
In_Position_Velocity_Slack -
!abs(!sqrt( uas_u^2 + uas_v^2 + uas_w^2) - !sqrt( ship_u^2 + ship_v^2 + ship_w^2))
]
,
'move_to_touchdown'
<>
move_td(uas_x, uas_y, uas_z, ship_x, ship_y, ship_z)
[
Move_to_Touchdown_Slack -
!sqrt(
(uas_x - ship_x)^2 +
(uas_y - ship_y)^2 +
(uas_z - (ship_z + Lateral_AboveTouchdown))^2
)
]
&
heading_aligned(uas_heading, ship_heading)
[
In_Position_HeadingAligned_Slack - !abs(!radToDeg(uas_heading - ship_heading))
]
)
,
-> (
'move_to_position_straight'
<> in_pos(uas_x, uas_y, uas_z, ship_x, ship_y, ship_z, ship_heading)
[
In_Position_Pos_Slack -
!sqrt(
(ship_x + Straight_DistanceToShip * !cos(!degToRad(Straight_AngleToShip) + ship_heading) - uas_x)^2 +
(ship_y + Straight_DistanceToShip * !sin(!degToRad(Straight_AngleToShip) + ship_heading) - uas_y)^2 +
(ship_z + Straight_HeightAboveShip - uas_z)^2
)
]
,
'stay_in_position'
[0..5]
in_pos(uas_x, uas_y, uas_z, ship_x, ship_y, ship_z, ship_heading)
[
In_Position_Pos_Slack -
!sqrt(
(ship_x + Straight_DistanceToShip * !cos(!degToRad(Straight_AngleToShip) + ship_heading) - uas_x)^2 +
(ship_y + Straight_DistanceToShip * !sin(!degToRad(Straight_AngleToShip) + ship_heading) - uas_y)^2 +
(ship_z + Straight_HeightAboveShip - uas_z)^2
)
]
&
heading_aligned(uas_heading, ship_heading)
[
In_Position_HeadingAligned_Slack - !abs(!radToDeg(uas_heading - ship_heading))
]
&
velocity_aligned(uas_u, uas_v, uas_w, ship_u, ship_v, ship_w)
[
In_Position_Velocity_Slack -
!abs(!sqrt( uas_u^2 + uas_v^2 + uas_w^2) - !sqrt( ship_u^2 + ship_v^2 + ship_w^2))
]
,
'move_to_touchdown'
<>
move_td(uas_x, uas_y, uas_z, ship_x, ship_y, ship_z)
[
Move_to_Touchdown_Slack -
!sqrt(
(uas_x - ship_x)^2 +
(uas_y - ship_y)^2 +
(uas_z - (ship_z + Straight_AboveTouchdown))^2
)
]
&
heading_aligned(uas_heading, ship_heading)
[
In_Position_HeadingAligned_Slack - !abs(!radToDeg(uas_heading - ship_heading))
]
)
)
,
'descend'
<>
descend(uas_x, uas_y, uas_z, ship_x, ship_y, ship_z)
[
Descend_Slack -
!sqrt(
(uas_x - ship_x)^2 +
(uas_y - ship_y)^2 +
(uas_z - ship_z )^2
)
]
)