예제 #1
0
def check_vehicle_sensor_entry(s):
    if not isinstance(s, dict):
        raise BadConfig(s, 'I expect this to be a dictionary, not %s' % 
                        describe_type(s))
    if 'pose' in s:
        check_valid_pose_spec(s['pose'])

    alternatives = [('sensor', dict), ('id_sensor', str)]
    check_has_exactly_one(s, alternatives)
    if 'sensor' in s:
        wrap_check(s, 'checking "sensor" entry',
                   check_valid_sensor_config, s['sensor'])
예제 #2
0
def check_valid_simulation_config(x):
    vehicles_alt = [('vehicle', dict), ('id_vehicle', str)]
    check_has_exactly_one(x, vehicles_alt)

    if 'vehicle' in x:
        wrap_check(x, 'checking "vehicle" field',
                   check_valid_vehicle_config, x['vehicle'])

    world_alt = [('world', dict), ('id_world', str)]
    check_has_exactly_one(x, world_alt)

    if 'world' in x:
        wrap_check(x, 'checking "world" field',
                   check_valid_world_config, x['world'])
예제 #3
0
def check_valid_simulation_config(x):
    vehicles_alt = [('vehicle', dict), ('id_vehicle', str)]
    check_has_exactly_one(x, vehicles_alt)

    if 'vehicle' in x:
        wrap_check(x, 'checking "vehicle" field', check_valid_vehicle_config,
                   x['vehicle'])

    world_alt = [('world', dict), ('id_world', str)]
    check_has_exactly_one(x, world_alt)

    if 'world' in x:
        wrap_check(x, 'checking "world" field', check_valid_world_config,
                   x['world'])
예제 #4
0
def check_valid_vehicle_config(x):
    if not isinstance(x, dict):
        raise ValueError('Must be a dictionary.')
    necessary = [('id', str),
                  ('sensors', list),
                  ('radius', (float, int))]
    check_necessary(x, necessary)

    dynamics_alt = [('dynamics', dict), ('id_dynamics', str)]
    check_has_exactly_one(x, dynamics_alt)

    if 'dynamics' in x:
        wrap_check(x, 'checking "dynamics" field',
                   check_valid_dynamics_config, x['dynamics'])

    for i, s in enumerate(x['sensors']):
        wrap_check(x, 'checking #%d sensors entry' % i,
                   check_vehicle_sensor_entry, s)