示例#1
0
    """Debug output if verbose is set."""
    if opts.verbose:
        print(str_to_print)


def error(str_to_print):
    """Show errors."""
    global error_count
    error_count += 1
    print(str_to_print)


for vehicle_path in vehicle_paths:
    name = os.path.basename(os.path.dirname(vehicle_path))
    path = os.path.normpath(os.path.dirname(vehicle_path))
    vehicles.append(Vehicle(name, path))
    debug('Found vehicle type %s' % name)

for vehicle in vehicles:
    debug("===\n\n\nProcessing %s" % vehicle.name)

    f = open(vehicle.path + '/Parameters.' + extension)
    p_text = f.read()
    f.close()

    param_matches = prog_param.findall(p_text)
    group_matches = prog_groups.findall(p_text)

    debug(group_matches)
    for group_match in group_matches:
        l = Library(group_match[0])
示例#2
0
        print("At param %s" % current_param)
    print(str_to_print)


truename_map = {
    "Rover": "Rover",
    "ArduSub": "Sub",
    "ArduCopter": "Copter",
    "ArduPlane": "Plane",
    "AntennaTracker": "Tracker",
    "Aero4River": "River"
}
for vehicle_path in vehicle_paths:
    name = os.path.basename(os.path.dirname(vehicle_path))
    path = os.path.normpath(os.path.dirname(vehicle_path))
    vehicles.append(Vehicle(name, path, truename_map[name]))
    debug('Found vehicle type %s' % name)

if len(vehicles) > 1 or len(vehicles) == 0:
    print("Single vehicle only, please")
    sys.exit(1)

for vehicle in vehicles:
    debug("===\n\n\nProcessing %s" % vehicle.name)
    current_file = vehicle.path + '/Parameters.' + extension

    f = open(current_file)
    p_text = f.read()
    f.close()
    param_matches = prog_param.findall(p_text)
    group_matches = prog_groups.findall(p_text)
示例#3
0
    "Rover": "Rover",
    "ArduSub": "Sub",
    "ArduCopter": "Copter",
    "ArduPlane": "Plane",
    "AntennaTracker": "Tracker",
    "AP_Periph": "AP_Periph",
}
valid_truenames = frozenset(truename_map.values())
truename = truename_map.get(args.vehicle, args.vehicle)

vehicle_path = find_vehicle_parameter_filepath(args.vehicle)

basename = os.path.basename(os.path.dirname(vehicle_path))
path = os.path.normpath(os.path.dirname(vehicle_path))
reference = basename  # so links don't break we use ArduCopter
vehicle = Vehicle(truename, path, reference=reference)
debug('Found vehicle type %s' % vehicle.name)


def process_vehicle(vehicle):
    debug("===\n\n\nProcessing %s" % vehicle.name)
    current_file = vehicle.path + '/Parameters.cpp'

    f = open(current_file)
    p_text = f.read()
    f.close()
    group_matches = prog_groups.findall(p_text)

    debug(group_matches)
    for group_match in group_matches:
        lib = Library(group_match[0])