CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
Ardupilot

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.

GitHub Repository: Ardupilot/ardupilot
Path: blob/master/Tools/autotest/pysim/vehicleinfo.py
Views: 1799
1
class VehicleInfo(object):
2
3
def __init__(self):
4
"""
5
waf_target: option passed to waf's --target to create binary
6
default_params_filename: filename of default parameters file. Taken to be relative to autotest dir.
7
extra_mavlink_cmds: extra parameters that will be passed to mavproxy
8
"""
9
self.options = {
10
"ArduCopter": {
11
"default_frame": "quad",
12
"frames": {
13
# COPTER
14
"+": {
15
"waf_target": "bin/arducopter",
16
"default_params_filename": "default_params/copter.parm",
17
},
18
"quad": {
19
"model": "+",
20
"waf_target": "bin/arducopter",
21
"default_params_filename": "default_params/copter.parm",
22
},
23
"X": {
24
"waf_target": "bin/arducopter",
25
"default_params_filename": ["default_params/copter.parm",
26
"default_params/copter-X.parm"],
27
},
28
"bfx": {
29
"waf_target": "bin/arducopter",
30
"default_params_filename": ["default_params/copter.parm",
31
"default_params/copter-bfx.parm" ],
32
},
33
"djix": {
34
"waf_target": "bin/arducopter",
35
"default_params_filename": ["default_params/copter.parm",
36
"default_params/copter-djix.parm" ],
37
},
38
"cwx": {
39
"waf_target": "bin/arducopter",
40
"default_params_filename": ["default_params/copter.parm",
41
"default_params/copter-cwx.parm" ],
42
},
43
"hexa": {
44
"waf_target": "bin/arducopter",
45
"default_params_filename": ["default_params/copter.parm",
46
"default_params/copter-hexa.parm" ],
47
},
48
"hexax": {
49
"waf_target": "bin/arducopter",
50
"default_params_filename": ["default_params/copter.parm",
51
"default_params/copter-hexa.parm",
52
"default_params/copter-X.parm", ],
53
},
54
"hexa-cwx": {
55
"waf_target": "bin/arducopter",
56
"default_params_filename": [
57
"default_params/copter.parm",
58
"default_params/copter-hexa.parm",
59
"default_params/copter-hexa-cwx.parm"
60
],
61
},
62
"hexa-dji": {
63
"waf_target": "bin/arducopter",
64
"default_params_filename": [
65
"default_params/copter.parm",
66
"default_params/copter-hexa.parm",
67
"default_params/copter-hexa-dji.parm"
68
],
69
},
70
"octa-cwx": {
71
"waf_target": "bin/arducopter",
72
"default_params_filename": [
73
"default_params/copter.parm",
74
"default_params/copter-octa.parm",
75
"default_params/copter-octa-cwx.parm"
76
],
77
},
78
"octa-quad-cwx": {
79
"waf_target": "bin/arducopter",
80
"default_params_filename": [
81
"default_params/copter.parm",
82
"default_params/copter-octaquad.parm",
83
"default_params/copter-octaquad-cwx.parm"
84
],
85
},
86
"octa-quad": {
87
"waf_target": "bin/arducopter",
88
"default_params_filename": ["default_params/copter.parm",
89
"default_params/copter-octaquad.parm" ],
90
},
91
"octa": {
92
"waf_target": "bin/arducopter",
93
"default_params_filename": ["default_params/copter.parm",
94
"default_params/copter-octa.parm" ],
95
},
96
"octa-dji": {
97
"waf_target": "bin/arducopter",
98
"default_params_filename": [
99
"default_params/copter.parm",
100
"default_params/copter-octa.parm",
101
"default_params/copter-octa-dji.parm"
102
],
103
},
104
"deca": {
105
"waf_target": "bin/arducopter",
106
"default_params_filename": ["default_params/copter.parm",
107
"default_params/copter-deca.parm" ],
108
},
109
"deca-cwx": {
110
"waf_target": "bin/arducopter",
111
"default_params_filename": [
112
"default_params/copter.parm",
113
"default_params/copter-deca.parm",
114
"default_params/copter-deca-cwx.parm"
115
],
116
},
117
"tri": {
118
"waf_target": "bin/arducopter",
119
"default_params_filename": ["default_params/copter.parm",
120
"default_params/copter-tri.parm" ],
121
},
122
"y6": {
123
"waf_target": "bin/arducopter",
124
"default_params_filename": ["default_params/copter.parm",
125
"default_params/copter-y6.parm" ],
126
},
127
"dodeca-hexa": {
128
"waf_target": "bin/arducopter",
129
"default_params_filename": ["default_params/copter.parm",
130
"default_params/copter-dodecahexa.parm" ],
131
},
132
# SIM
133
"IrisRos": {
134
"waf_target": "bin/arducopter",
135
"default_params_filename": "default_params/copter.parm",
136
"external": True,
137
},
138
"gazebo-iris": {
139
"waf_target": "bin/arducopter",
140
"default_params_filename": ["default_params/copter.parm",
141
"default_params/gazebo-iris.parm"],
142
"external": True,
143
},
144
"airsim-copter": {
145
"waf_target": "bin/arducopter",
146
"default_params_filename": ["default_params/copter.parm",
147
"default_params/airsim-quadX.parm"],
148
"external": True,
149
},
150
# HELICOPTER
151
"heli": {
152
"waf_target": "bin/arducopter-heli",
153
"default_params_filename": "default_params/copter-heli.parm",
154
},
155
"heli-gas": {
156
"waf_target": "bin/arducopter-heli",
157
"default_params_filename": ["default_params/copter-heli.parm",
158
"default_params/copter-heli-gas.parm"],
159
},
160
"heli-dual": {
161
"waf_target": "bin/arducopter-heli",
162
"default_params_filename": ["default_params/copter-heli.parm",
163
"default_params/copter-heli-dual.parm"],
164
},
165
"heli-blade360": {
166
"waf_target": "bin/arducopter-heli",
167
"default_params_filename": ["default_params/copter-heli.parm",
168
],
169
},
170
"singlecopter": {
171
"waf_target": "bin/arducopter",
172
"default_params_filename": "default_params/copter-single.parm",
173
},
174
"coaxcopter": {
175
"waf_target": "bin/arducopter",
176
"default_params_filename": ["default_params/copter-single.parm",
177
"default_params/copter-coax.parm"],
178
},
179
"scrimmage-copter" : {
180
"waf_target": "bin/arducopter",
181
"default_params_filename": "default_params/copter.parm",
182
"external": True,
183
},
184
"calibration": {
185
"extra_mavlink_cmds": "module load sitl_calibration;",
186
"external": True, # lies! OTOH, hard to take off with this
187
},
188
"Callisto": {
189
"model": "octa-quad:@ROMFS/models/Callisto.json",
190
"waf_target": "bin/arducopter",
191
"default_params_filename": [
192
"default_params/copter.parm",
193
"default_params/copter-octaquad.parm",
194
"models/Callisto.param",
195
],
196
},
197
"quad-can": {
198
"waf_target": "bin/arducopter",
199
"default_params_filename": ["default_params/copter.parm", "default_params/quad-can.parm"],
200
"periph_params_filename": ["default_params/periph.parm", "default_params/quad-periph.parm"],
201
},
202
"freestyle": {
203
"model": "X:@ROMFS/models/freestyle.json",
204
"waf_target": "bin/arducopter",
205
"default_params_filename": [
206
"default_params/copter.parm",
207
"default_params/copter-X.parm",
208
"models/freestyle.param",
209
],
210
},
211
},
212
},
213
"Helicopter": {
214
"default_frame": "heli",
215
"frames": {
216
"heli": {
217
"waf_target": "bin/arducopter-heli",
218
"default_params_filename": "default_params/copter-heli.parm",
219
},
220
"heli-gas": {
221
"waf_target": "bin/arducopter-heli",
222
"default_params_filename": ["default_params/copter-heli.parm",
223
"default_params/copter-heli-gas.parm"],
224
},
225
"heli-dual": {
226
"waf_target": "bin/arducopter-heli",
227
"default_params_filename": ["default_params/copter-heli.parm",
228
"default_params/copter-heli-dual.parm"],
229
},
230
# "heli-compound": {
231
# "waf_target": "bin/arducopter-heli",
232
# "default_params_filename": ["default_params/copter-heli.parm",
233
# "default_params/copter-heli-compound.parm"],
234
# },
235
"heli-blade360": {
236
"waf_target": "bin/arducopter-heli",
237
"default_params_filename": ["default_params/copter-heli.parm",
238
],
239
},
240
},
241
},
242
"Blimp": {
243
"default_frame": "Blimp",
244
"frames": {
245
"Blimp": {
246
"waf_target": "bin/blimp",
247
"default_params_filename": "default_params/blimp.parm",
248
},
249
},
250
},
251
"ArduPlane": {
252
"default_frame": "plane",
253
"frames": {
254
# PLANE
255
"quadplane-tilttri": {
256
"waf_target": "bin/arduplane",
257
"default_params_filename": ["default_params/quadplane.parm",
258
"default_params/quadplane-tilttri.parm"],
259
},
260
"quadplane-tilttrivec": {
261
"waf_target": "bin/arduplane",
262
"default_params_filename": ["default_params/quadplane.parm",
263
"default_params/quadplane-tilttrivec.parm"],
264
},
265
"quadplane-tilthvec": {
266
"waf_target": "bin/arduplane",
267
"default_params_filename": ["models/plane.parm", "default_params/quadplane-tilthvec.parm"],
268
},
269
"quadplane-tri": {
270
"waf_target": "bin/arduplane",
271
"default_params_filename": ["default_params/quadplane.parm",
272
"default_params/quadplane-tri.parm"],
273
},
274
"quadplane-cl84" : {
275
"waf_target" : "bin/arduplane",
276
"default_params_filename": ["default_params/quadplane.parm",
277
"default_params/quadplane-cl84.parm"],
278
},
279
"quadplane": {
280
"waf_target": "bin/arduplane",
281
"default_params_filename": "default_params/quadplane.parm",
282
},
283
"quadplane-ice": {
284
"waf_target": "bin/arduplane",
285
"default_params_filename": ["default_params/quadplane.parm", "default_params/plane-ice.parm", "default_params/quadplane-ice.parm"],
286
},
287
"quadplane-can": {
288
"waf_target": "bin/arduplane",
289
"default_params_filename": ["default_params/quadplane.parm", "default_params/quadplane-can.parm"],
290
"periph_params_filename": ["default_params/periph.parm", "default_params/quadplane-periph.parm"],
291
},
292
"quadplane-tilt": {
293
"waf_target": "bin/arduplane",
294
"default_params_filename": ["default_params/quadplane.parm",
295
"default_params/quadplane-tilt.parm"],
296
},
297
"firefly": {
298
"waf_target": "bin/arduplane",
299
"default_params_filename": ["default_params/quadplane.parm",
300
"default_params/firefly.parm"]
301
},
302
"plane-elevon": {
303
"waf_target": "bin/arduplane",
304
"default_params_filename": ["models/plane.parm", "default_params/plane-elevons.parm"],
305
},
306
"plane-vtail": {
307
"waf_target": "bin/arduplane",
308
"default_params_filename": ["models/plane.parm", "default_params/plane-vtail.parm"],
309
},
310
"plane-tailsitter": {
311
"waf_target": "bin/arduplane",
312
"default_params_filename": "default_params/plane-tailsitter.parm",
313
},
314
"plane-jet": {
315
"waf_target": "bin/arduplane",
316
"default_params_filename": ["models/plane.parm", "default_params/plane-jet.parm"],
317
},
318
"plane-ice": {
319
"waf_target": "bin/arduplane",
320
"default_params_filename": ["models/plane.parm", "default_params/plane-ice.parm"],
321
},
322
"plane-3d": {
323
"waf_target": "bin/arduplane",
324
"default_params_filename": [], # defaults are loaded in SIM_Plane.cpp
325
},
326
"glider": {
327
"waf_target": "bin/arduplane",
328
"default_params_filename": "default_params/glider.parm",
329
},
330
"quadplane-copter_tailsitter": {
331
"waf_target": "bin/arduplane",
332
"default_params_filename": ["default_params/quadplane.parm","default_params/quadplane-copter_tailsitter.parm"],
333
},
334
"plane": {
335
"waf_target": "bin/arduplane",
336
"default_params_filename": "models/plane.parm",
337
},
338
"plane-dspoilers": {
339
"waf_target": "bin/arduplane",
340
"default_params_filename": ["models/plane.parm", "default_params/plane-dspoilers.parm"]
341
},
342
"plane-redundant": {
343
"waf_target": "bin/arduplane",
344
"default_params_filename": ["models/plane.parm", "default_params/plane-redundant.parm"]
345
},
346
"plane-soaring": {
347
"waf_target": "bin/arduplane",
348
"default_params_filename": ["models/plane.parm", "default_params/plane-soaring.parm"]
349
},
350
"gazebo-zephyr": {
351
"waf_target": "bin/arduplane",
352
"default_params_filename": "default_params/gazebo-zephyr.parm",
353
"external": True,
354
},
355
"last_letter": {
356
"waf_target": "bin/arduplane",
357
"default_params_filename": "models/plane.parm",
358
"external": True,
359
},
360
"CRRCSim": {
361
"waf_target": "bin/arduplane",
362
"default_params_filename": "models/plane.parm",
363
"external": True,
364
},
365
"jsbsim": {
366
"waf_target": "bin/arduplane",
367
"default_params_filename": "default_params/plane-jsbsim.parm",
368
"external": True,
369
},
370
"scrimmage-plane" : {
371
"waf_target": "bin/arduplane",
372
"default_params_filename": "models/plane.parm",
373
"external": True,
374
},
375
"calibration": {
376
"extra_mavlink_cmds": "module load sitl_calibration;",
377
"external": True, # lies! OTOH, hard to take off with this
378
},
379
"stratoblimp": {
380
"waf_target": "bin/arduplane",
381
"default_params_filename": "default_params/stratoblimp.parm",
382
},
383
},
384
},
385
"Rover": {
386
"default_frame": "rover",
387
"frames": {
388
# ROVER
389
"rover": {
390
"waf_target": "bin/ardurover",
391
"default_params_filename": "default_params/rover.parm",
392
},
393
"rover-skid": {
394
"waf_target": "bin/ardurover",
395
"default_params_filename": ["default_params/rover.parm",
396
"default_params/rover-skid.parm"],
397
},
398
"rover-omni3mecanum": {
399
"waf_target": "bin/ardurover",
400
"default_params_filename": ["default_params/rover.parm",
401
"default_params/rover-omni3mecanum.parm"],
402
},
403
"rover-vectored": {
404
"waf_target": "bin/ardurover",
405
"default_params_filename": ["default_params/rover.parm",
406
"default_params/rover-vectored.parm"],
407
},
408
"balancebot": {
409
"waf_target": "bin/ardurover",
410
"default_params_filename": ["default_params/rover.parm",
411
"default_params/rover-skid.parm",
412
"default_params/balancebot.parm"],
413
},
414
"motorboat": {
415
"waf_target": "bin/ardurover",
416
"default_params_filename": ["default_params/rover.parm",
417
"default_params/motorboat.parm"],
418
},
419
"motorboat-skid": {
420
"waf_target": "bin/ardurover",
421
"default_params_filename": ["default_params/rover.parm",
422
"default_params/motorboat.parm",
423
"default_params/rover-skid.parm"],
424
},
425
"sailboat": {
426
"waf_target": "bin/ardurover",
427
"default_params_filename": ["default_params/rover.parm",
428
"default_params/sailboat.parm"],
429
},
430
"sailboat-motor": {
431
"waf_target": "bin/ardurover",
432
"default_params_filename": ["default_params/rover.parm",
433
"default_params/sailboat-motor.parm"],
434
},
435
"gazebo-rover": {
436
"waf_target": "bin/ardurover",
437
"default_params_filename": ["default_params/rover.parm",
438
"default_params/rover-skid.parm"],
439
},
440
"airsim-rover": {
441
"waf_target": "bin/ardurover",
442
"default_params_filename": ["default_params/rover.parm",
443
"default_params/airsim-rover.parm"],
444
},
445
"calibration": {
446
"extra_mavlink_cmds": "module load sitl_calibration;",
447
},
448
},
449
},
450
"ArduSub": {
451
"default_frame": "vectored",
452
"frames": {
453
"vectored": {
454
"waf_target": "bin/ardusub",
455
"default_params_filename": "default_params/sub.parm",
456
},
457
"vectored_6dof": {
458
"waf_target": "bin/ardusub",
459
"default_params_filename": "default_params/sub-6dof.parm",
460
},
461
"gazebo-bluerov2": {
462
"waf_target": "bin/ardusub",
463
"default_params_filename": "default_params/sub.parm",
464
},
465
},
466
},
467
"AntennaTracker": {
468
"default_frame": "tracker",
469
"frames": {
470
"tracker": {
471
"waf_target": "bin/antennatracker",
472
},
473
},
474
},
475
"sitl_periph_universal": {
476
"frames": {
477
"universal": {
478
"configure_target": "sitl_periph_universal",
479
"waf_target": "bin/AP_Periph",
480
"default_params_filename": "default_params/periph.parm",
481
},
482
}
483
},
484
}
485
486
487
def default_frame(self, vehicle):
488
return self.options[vehicle]["default_frame"]
489
490
def default_waf_target(self, vehicle):
491
"""Returns a waf target based on vehicle type, which is often determined by which directory the user is in"""
492
default_frame = self.default_frame(vehicle)
493
return self.options[vehicle]["frames"][default_frame]["waf_target"]
494
495
def options_for_frame(self, frame, vehicle, opts):
496
"""Return informatiom about how to sitl for frame e.g. build-type==sitl"""
497
ret = None
498
frames = self.options[vehicle]["frames"]
499
if frame in frames:
500
ret = self.options[vehicle]["frames"][frame]
501
else:
502
for p in ["octa", "tri", "y6", "firefly", "heli", "gazebo", "last_letter", "jsbsim", "quadplane", "plane-elevon", "plane-vtail", "plane", "airsim"]:
503
if frame.startswith(p):
504
ret = self.options[vehicle]["frames"][p]
505
break
506
if ret is None:
507
if frame.endswith("-heli"):
508
ret = self.options[vehicle]["frames"]["heli"]
509
if ret is None:
510
print("WARNING: no config for frame (%s)" % frame)
511
ret = {}
512
513
if "model" not in ret:
514
ret["model"] = frame
515
516
if "sitl-port" not in ret:
517
ret["sitl-port"] = True
518
519
if opts.model is not None:
520
ret["model"] = opts.model
521
522
if (ret["model"].find("xplane") != -1 or ret["model"].find("flightaxis") != -1):
523
ret["sitl-port"] = False
524
525
526
if "waf_target" not in ret:
527
ret["waf_target"] = self.default_waf_target(vehicle)
528
529
if opts.build_target is not None:
530
ret["waf_target"] = opts.build_target
531
532
return ret
533
534
535
536
537