Exemple #1
0
    def __init__(self, directions, invalid=10, min_range=0.2, max_range=10,
                 noise=None):
        ''' 
            :param directions: array of orientations
            :param invalid: value for invalid data (i.e., out of range) 
        '''
        self.invalid = invalid
        self.min_range = min_range
        self.max_range = max_range

        self.noise_spec = noise
        self.noise = (None if self.noise_spec is None else
                          instantiate_spec(self.noise_spec))

        spec = {
            'desc': 'Range-finder',
            'shape': [len(directions)],
            'format': 'C',
            'range': [0, +1],
            'extra': {'directions': np.array(directions).tolist(),
                      'noise': noise,
                      'invalid': float(invalid),
                      'max_range': float(max_range),
                      'min_range': float(min_range)}
        }
        VehicleSensor.__init__(self, spec)
        MyRaytracer.__init__(self, directions)
Exemple #2
0
    def __init__(self,
                 directions,
                 invalid=10,
                 min_range=0.2,
                 max_range=10,
                 noise=None):
        ''' 
            :param directions: array of orientations
            :param invalid: value for invalid data (i.e., out of range) 
        '''
        self.invalid = invalid
        self.min_range = min_range
        self.max_range = max_range

        self.noise_spec = noise
        self.noise = (None if self.noise_spec is None else instantiate_spec(
            self.noise_spec))

        spec = {
            'desc': 'Range-finder',
            'shape': [len(directions)],
            'format': 'C',
            'range': [0, +1],
            'extra': {
                'directions': np.array(directions).tolist(),
                'noise': noise,
                'invalid': float(invalid),
                'max_range': float(max_range),
                'min_range': float(min_range)
            }
        }
        VehicleSensor.__init__(self, spec)
        MyRaytracer.__init__(self, directions)
Exemple #3
0
 def __init__(self, num_sensels):
     spec = {
         'desc': 'Random sensor',
         'shape': [num_sensels],
         'format': 'C',
         'range': [0, +1],
         'extra': {}
     }
     VehicleSensor.__init__(self, spec)
     self.num_sensels = num_sensels
 def __init__(self, num_sensels):
     spec = {
         'desc': 'Random sensor',
         'shape': [num_sensels],
         'format': 'C',
         'range': [0, +1],
         'extra': {}
     }
     VehicleSensor.__init__(self, spec)
     self.num_sensels = num_sensels
    def __init__(self, directions, noise=None, invalid=0.5):
        self.invalid = invalid

        self.noise_spec = noise
        self.noise = (None if self.noise_spec is None else
                          instantiate_spec(self.noise_spec))

        spec = {
            'desc': 'Photoreceptors',
            'shape': [len(directions)],
            'format': 'C',
            'range': [0, +1],
            'extra': {'directions': directions.tolist(),
                      'invalid': invalid,
                      'sono': 'qui',
                      'noise': self.noise_spec}
        }
        VehicleSensor.__init__(self, spec)

        TexturedRaytracer.__init__(self, directions)
Exemple #6
0
    def __init__(self, directions, noise=None, invalid=0.5):
        self.invalid = invalid

        self.noise_spec = noise
        self.noise = (None if self.noise_spec is None else instantiate_spec(
            self.noise_spec))

        spec = {
            'desc': 'Photoreceptors',
            'shape': [len(directions)],
            'format': 'C',
            'range': [0, +1],
            'extra': {
                'directions': directions.tolist(),
                'invalid': invalid,
                'sono': 'qui',
                'noise': self.noise_spec
            }
        }
        VehicleSensor.__init__(self, spec)

        TexturedRaytracer.__init__(self, directions)
Exemple #7
0
    def __init__(self, positions,
                 min_value=0, max_value=1, normalize=False, noise=None,
                 shape=None):
        '''
            :param positions: 2D positions of the sensels 
        '''

        if normalize:
            logger.warning('normalize=True is deprecated')
            
        if shape is None:
            shape = [len(positions)]

        self.num_sensels = len(positions)
        self.positions = np.array(positions)
        self.min_value = min_value
        self.max_value = max_value
        self.normalize = normalize

        self.noise_spec = noise
        self.noise = (None if self.noise_spec is None else
                          instantiate_spec(self.noise_spec))

        boot_spec = {
            'desc': 'Field sampler',
            'shape': shape,
            'format': 'C',
            'range': [float(self.min_value), float(self.max_value)],
            'extra': {'positions': self.positions.tolist(),
                      'normalize': bool(normalize),
                      'max_value': float(max_value),
                      'min_value': float(min_value),
                      'noise': self.noise_spec}
        }

        VehicleSensor.__init__(self, boot_spec)

        self.primitives = None
    def __init__(self, directions, spatial_sigma_deg, upsample=10,
                 noise=None, invalid=0.5):
        self.invalid = invalid

        self.noise_spec = noise
        self.noise = (None if self.noise_spec is None else
                          instantiate_spec(self.noise_spec))

        spatial_sigma_rad = np.deg2rad(spatial_sigma_deg)
        self.delta = np.linspace(-3, 3, upsample) * spatial_sigma_rad

        directions2 = []
        for d in directions:
            for s in self.delta:
                directions2.append(d + s)

        self.directions_o = np.array(directions)

        def kernel(x):
            return np.exp(-(x ** 2))

        self.coeff = kernel(self.delta)
        self.coeff = self.coeff / np.sum(self.coeff)

        spec = {
            'desc': 'Photoreceptors',
            'shape': [len(directions)],
            'format': 'C',
            'range': [0, +1],
            'extra': {'directions': self.directions_o.tolist(),
                      'noise': self.noise_spec,
                      'delta': self.delta.tolist(),
                      'coeff': self.coeff.tolist(),
                      'spatial_sigma_deg': spatial_sigma_deg},
        }

        VehicleSensor.__init__(self, spec)
        TexturedRaytracer.__init__(self, np.array(directions2))