2017-05-24 04:18:24 -03:00
|
|
|
class VehicleInfo(object):
|
|
|
|
|
|
|
|
def __init__(self):
|
|
|
|
"""
|
|
|
|
make_target: option passed to make to create binaries. Usually sitl, and "-debug" may be appended if -D is passed to sim_vehicle.py
|
|
|
|
default_params_filename: filename of default parameters file. Taken to be relative to autotest dir.
|
|
|
|
extra_mavlink_cmds: extra parameters that will be passed to mavproxy
|
|
|
|
"""
|
|
|
|
self.options = {
|
|
|
|
"ArduCopter": {
|
|
|
|
"default_frame": "quad",
|
|
|
|
"frames": {
|
|
|
|
# COPTER
|
|
|
|
"+": {
|
|
|
|
"waf_target": "bin/arducopter",
|
|
|
|
"default_params_filename": "default_params/copter.parm",
|
|
|
|
},
|
|
|
|
"quad": {
|
|
|
|
"model": "+",
|
|
|
|
"waf_target": "bin/arducopter",
|
|
|
|
"default_params_filename": "default_params/copter.parm",
|
|
|
|
},
|
|
|
|
"X": {
|
|
|
|
"waf_target": "bin/arducopter",
|
|
|
|
"default_params_filename": "default_params/copter.parm",
|
|
|
|
# this param set FRAME doesn't actually work because mavproxy
|
|
|
|
# won't set a parameter unless it knows of it, and the
|
|
|
|
# param fetch happens asynchronously
|
|
|
|
"extra_mavlink_cmds": "param fetch frame; param set FRAME 1;",
|
|
|
|
},
|
|
|
|
"hexa": {
|
|
|
|
"make_target": "sitl",
|
|
|
|
"waf_target": "bin/arducopter",
|
|
|
|
"default_params_filename": ["default_params/copter.parm",
|
|
|
|
"default_params/copter-hexa.parm" ],
|
|
|
|
},
|
|
|
|
"octa-quad": {
|
|
|
|
"make_target": "sitl",
|
|
|
|
"waf_target": "bin/arducopter",
|
|
|
|
"default_params_filename": ["default_params/copter.parm",
|
|
|
|
"default_params/copter-octaquad.parm" ],
|
|
|
|
},
|
|
|
|
"octa": {
|
|
|
|
"make_target": "sitl",
|
|
|
|
"waf_target": "bin/arducopter",
|
|
|
|
"default_params_filename": ["default_params/copter.parm",
|
|
|
|
"default_params/copter-octa.parm" ],
|
|
|
|
},
|
|
|
|
"tri": {
|
|
|
|
"make_target": "sitl",
|
|
|
|
"waf_target": "bin/arducopter",
|
|
|
|
"default_params_filename": ["default_params/copter.parm",
|
|
|
|
"default_params/copter-tri.parm" ],
|
|
|
|
},
|
|
|
|
"y6": {
|
|
|
|
"make_target": "sitl",
|
|
|
|
"waf_target": "bin/arducopter",
|
|
|
|
"default_params_filename": ["default_params/copter.parm",
|
|
|
|
"default_params/copter-y6.parm" ],
|
|
|
|
},
|
2017-05-27 01:52:30 -03:00
|
|
|
"dodeca-hexa": {
|
|
|
|
"make_target": "sitl",
|
|
|
|
"waf_target": "bin/arducopter",
|
|
|
|
"default_params_filename": ["default_params/copter.parm",
|
|
|
|
"default_params/copter-dodecahexa.parm" ],
|
|
|
|
},
|
2017-05-24 04:18:24 -03:00
|
|
|
# SIM
|
|
|
|
"IrisRos": {
|
|
|
|
"waf_target": "bin/arducopter",
|
|
|
|
"default_params_filename": "default_params/copter.parm",
|
|
|
|
},
|
|
|
|
"gazebo-iris": {
|
|
|
|
"waf_target": "bin/arducopter",
|
|
|
|
"default_params_filename": ["default_params/copter.parm",
|
|
|
|
"default_params/gazebo-iris.parm"],
|
|
|
|
},
|
|
|
|
# HELICOPTER
|
|
|
|
"heli": {
|
|
|
|
"make_target": "sitl-heli",
|
|
|
|
"waf_target": "bin/arducopter-heli",
|
|
|
|
"default_params_filename": "default_params/copter-heli.parm",
|
|
|
|
},
|
|
|
|
"heli-dual": {
|
|
|
|
"make_target": "sitl-heli-dual",
|
|
|
|
"waf_target": "bin/arducopter-heli",
|
2017-05-26 22:03:57 -03:00
|
|
|
"default_params_filename": ["default_params/copter-heli.parm",
|
|
|
|
"default_params/copter-heli-dual.parm"],
|
2017-05-24 04:18:24 -03:00
|
|
|
},
|
|
|
|
"heli-compound": {
|
|
|
|
"make_target": "sitl-heli-compound",
|
|
|
|
"waf_target": "bin/arducopter-heli",
|
|
|
|
},
|
|
|
|
"singlecopter": {
|
|
|
|
"make_target": "sitl",
|
|
|
|
"waf_target": "bin/arducopter",
|
|
|
|
"default_params_filename": "default_params/copter-single.parm",
|
|
|
|
},
|
|
|
|
"coaxcopter": {
|
|
|
|
"make_target": "sitl",
|
|
|
|
"waf_target": "bin/arducopter",
|
2017-05-28 07:39:29 -03:00
|
|
|
"default_params_filename": ["default_params/copter-single.parm",
|
|
|
|
"default_params/copter-coax.parm"],
|
2017-05-24 04:18:24 -03:00
|
|
|
},
|
|
|
|
"calibration": {
|
|
|
|
"extra_mavlink_cmds": "module load sitl_calibration;",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
"ArduPlane": {
|
2017-11-06 00:44:26 -04:00
|
|
|
"default_frame": "plane",
|
2017-05-24 04:18:24 -03:00
|
|
|
"frames": {
|
|
|
|
# PLANE
|
|
|
|
"quadplane-tilttri": {
|
|
|
|
"make_target": "sitl",
|
|
|
|
"waf_target": "bin/arduplane",
|
|
|
|
"default_params_filename": "default_params/quadplane-tilttri.parm",
|
|
|
|
},
|
|
|
|
"quadplane-tilttrivec": {
|
|
|
|
"make_target": "sitl",
|
|
|
|
"waf_target": "bin/arduplane",
|
|
|
|
"default_params_filename": "default_params/quadplane-tilttrivec.parm",
|
|
|
|
},
|
2017-08-20 16:12:06 -03:00
|
|
|
"quadplane-tilthvec": {
|
|
|
|
"make_target": "sitl",
|
|
|
|
"waf_target": "bin/arduplane",
|
|
|
|
"default_params_filename": ["default_params/plane.parm", "default_params/quadplane-tilthvec.parm"],
|
|
|
|
},
|
2017-05-24 04:18:24 -03:00
|
|
|
"quadplane-tri": {
|
|
|
|
"make_target": "sitl",
|
|
|
|
"waf_target": "bin/arduplane",
|
|
|
|
"default_params_filename": "default_params/quadplane-tri.parm",
|
|
|
|
},
|
|
|
|
"quadplane-cl84" : {
|
|
|
|
"make_target" : "sitl",
|
|
|
|
"waf_target" : "bin/arduplane",
|
|
|
|
"default_params_filename": "default_params/quadplane-cl84.parm",
|
|
|
|
},
|
|
|
|
"quadplane": {
|
|
|
|
"waf_target": "bin/arduplane",
|
|
|
|
"default_params_filename": "default_params/quadplane.parm",
|
|
|
|
},
|
2017-08-19 20:36:45 -03:00
|
|
|
"firefly": {
|
|
|
|
"waf_target": "bin/arduplane",
|
|
|
|
"default_params_filename": "default_params/firefly.parm",
|
|
|
|
},
|
2017-05-24 04:18:24 -03:00
|
|
|
"plane-elevon": {
|
|
|
|
"waf_target": "bin/arduplane",
|
2017-07-01 03:03:04 -03:00
|
|
|
"default_params_filename": ["default_params/plane.parm", "default_params/plane-elevons.parm"],
|
2017-05-24 04:18:24 -03:00
|
|
|
},
|
|
|
|
"plane-vtail": {
|
|
|
|
"waf_target": "bin/arduplane",
|
2017-07-01 03:03:04 -03:00
|
|
|
"default_params_filename": ["default_params/plane.parm", "default_params/plane-vtail.parm"],
|
2017-05-24 04:18:24 -03:00
|
|
|
},
|
|
|
|
"plane-tailsitter": {
|
|
|
|
"waf_target": "bin/arduplane",
|
|
|
|
"default_params_filename": "default_params/plane-tailsitter.parm",
|
|
|
|
},
|
|
|
|
"plane": {
|
|
|
|
"waf_target": "bin/arduplane",
|
|
|
|
"default_params_filename": "default_params/plane.parm",
|
|
|
|
},
|
2017-07-01 03:03:04 -03:00
|
|
|
"plane-dspoilers": {
|
|
|
|
"waf_target": "bin/arduplane",
|
|
|
|
"default_params_filename": ["default_params/plane.parm", "default_params/plane-dspoilers.parm"]
|
|
|
|
},
|
2017-05-24 04:18:24 -03:00
|
|
|
"gazebo-zephyr": {
|
|
|
|
"waf_target": "bin/arduplane",
|
|
|
|
"default_params_filename": "default_params/gazebo-zephyr.parm",
|
|
|
|
},
|
|
|
|
"last_letter": {
|
|
|
|
"waf_target": "bin/arduplane",
|
|
|
|
},
|
|
|
|
"CRRCSim": {
|
|
|
|
"waf_target": "bin/arduplane",
|
|
|
|
},
|
|
|
|
"jsbsim": {
|
|
|
|
"waf_target": "bin/arduplane",
|
|
|
|
"default_params_filename": "default_params/plane-jsbsim.parm",
|
|
|
|
},
|
|
|
|
"calibration": {
|
|
|
|
"extra_mavlink_cmds": "module load sitl_calibration;",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
"APMrover2": {
|
|
|
|
"default_frame": "rover",
|
|
|
|
"frames": {
|
|
|
|
# ROVER
|
|
|
|
"rover": {
|
|
|
|
"waf_target": "bin/ardurover",
|
|
|
|
"default_params_filename": "default_params/rover.parm",
|
|
|
|
},
|
|
|
|
"rover-skid": {
|
|
|
|
"waf_target": "bin/ardurover",
|
2017-05-26 22:13:40 -03:00
|
|
|
"default_params_filename": ["default_params/rover.parm",
|
|
|
|
"default_params/rover-skid.parm"],
|
2017-05-24 04:18:24 -03:00
|
|
|
},
|
2018-05-18 06:59:32 -03:00
|
|
|
"balancebot": {
|
|
|
|
"waf_target": "bin/ardurover",
|
|
|
|
"default_params_filename": ["default_params/rover.parm",
|
|
|
|
"default_params/rover-skid.parm",
|
|
|
|
"default_params/balancebot.parm"],
|
|
|
|
},
|
2017-05-24 04:18:24 -03:00
|
|
|
"gazebo-rover": {
|
|
|
|
"waf_target": "bin/ardurover",
|
2017-05-26 22:13:40 -03:00
|
|
|
"default_params_filename": ["default_params/rover.parm",
|
|
|
|
"default_params/rover-skid.parm"],
|
2017-05-24 04:18:24 -03:00
|
|
|
},
|
|
|
|
"calibration": {
|
|
|
|
"extra_mavlink_cmds": "module load sitl_calibration;",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
"ArduSub": {
|
|
|
|
"default_frame": "vectored",
|
|
|
|
"frames": {
|
|
|
|
"vectored": {
|
|
|
|
"waf_target": "bin/ardusub",
|
|
|
|
"default_params_filename": "default_params/sub.parm",
|
|
|
|
},
|
2017-12-04 10:38:20 -04:00
|
|
|
"gazebo-bluerov2": {
|
|
|
|
"waf_target": "bin/ardusub",
|
|
|
|
"default_params_filename": "default_params/sub.parm",
|
|
|
|
},
|
2017-05-24 04:18:24 -03:00
|
|
|
},
|
|
|
|
},
|
|
|
|
"AntennaTracker": {
|
|
|
|
"default_frame": "tracker",
|
|
|
|
"frames": {
|
|
|
|
"tracker": {
|
|
|
|
"waf_target": "bin/antennatracker",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-05-24 04:55:03 -03:00
|
|
|
def default_frame(self, vehicle):
|
|
|
|
return self.options[vehicle]["default_frame"]
|
|
|
|
|
2017-05-24 04:18:24 -03:00
|
|
|
def default_waf_target(self, vehicle):
|
|
|
|
"""Returns a waf target based on vehicle type, which is often determined by which directory the user is in"""
|
2017-05-24 04:55:03 -03:00
|
|
|
default_frame = self.default_frame(vehicle)
|
2017-05-24 04:18:24 -03:00
|
|
|
return self.options[vehicle]["frames"][default_frame]["waf_target"]
|
|
|
|
|
|
|
|
def options_for_frame(self, frame, vehicle, opts):
|
|
|
|
"""Return informatiom about how to sitl for frame e.g. build-type==sitl"""
|
|
|
|
ret = None
|
|
|
|
frames = self.options[vehicle]["frames"]
|
|
|
|
if frame in frames:
|
|
|
|
ret = self.options[vehicle]["frames"][frame]
|
|
|
|
else:
|
|
|
|
for p in ["octa", "tri", "y6", "firefly", "heli", "gazebo", "last_letter", "jsbsim", "quadplane", "plane-elevon", "plane-vtail", "plane"]:
|
|
|
|
if frame.startswith(p):
|
|
|
|
ret = self.options[vehicle]["frames"][p]
|
|
|
|
break
|
|
|
|
if ret is None:
|
|
|
|
if frame.endswith("-heli"):
|
|
|
|
ret = self.options[vehicle]["frames"]["heli"]
|
|
|
|
if ret is None:
|
2017-06-02 03:53:55 -03:00
|
|
|
print("WARNING: no config for frame (%s)" % frame)
|
2017-05-24 04:18:24 -03:00
|
|
|
ret = {}
|
|
|
|
|
|
|
|
if "model" not in ret:
|
|
|
|
ret["model"] = frame
|
|
|
|
|
|
|
|
if "sitl-port" not in ret:
|
|
|
|
ret["sitl-port"] = True
|
|
|
|
|
|
|
|
if opts.model is not None:
|
|
|
|
ret["model"] = opts.model
|
|
|
|
|
|
|
|
if (ret["model"].find("xplane") != -1 or ret["model"].find("flightaxis") != -1):
|
|
|
|
ret["sitl-port"] = False
|
|
|
|
|
|
|
|
if "make_target" not in ret:
|
|
|
|
ret["make_target"] = "sitl"
|
|
|
|
|
|
|
|
if "waf_target" not in ret:
|
2017-06-02 03:53:55 -03:00
|
|
|
ret["waf_target"] = self.default_waf_target(vehicle)
|
2017-05-24 04:18:24 -03:00
|
|
|
|
|
|
|
if opts.build_target is not None:
|
|
|
|
ret["make_target"] = opts.build_target
|
|
|
|
ret["waf_target"] = opts.build_target
|
|
|
|
|
|
|
|
return ret
|
|
|
|
|
|
|
|
|
|
|
|
|