How to use the pypot.robot.sensor.Sensor.__init__ function in pypot

To help you get started, we’ve selected a few pypot examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github poppy-project / pypot / pypot / sensor / depth / sonar.py View on Github external
def __init__(self, name, i2c_pin, address, sync_freq=50.0):
        Sensor.__init__(self, name)

        self._d = numpy.nan

        self._sonar = Sonar(i2c_pin, [address])

        self._controller = StoppableLoopThread(sync_freq, update=self.update)
        self._controller.start()
github poppy-project / pypot / pypot / sensor / power_control / power.py View on Github external
def __init__(self, name, device_list):
        Sensor.__init__(self, name)
        self.normal = {'normalOpen': 0,
                       'normalClose': 1}
        # devicelist is formated like
        # 'device name': [pinNumber, normal ('normalOpen' or 'normalClose')]
        self._device_list = device_list
        self._status_list = {}
        GPIO.setmode(GPIO.BCM)
        GPIO.setwarnings(False)

        for item in self._device_list:
            GPIO.setup(self._device_list[item][0], GPIO.OUT)
            GPIO.output(self._device_list[item][0], GPIO.HIGH)
            if self._device_list[item][1] == 'normalOpen':
                self._status_list[item] = 'disable'
            else:
                self._status_list[item] = 'enable'
github poppy-project / pypot / pypot / sensor / imagefeature / marker.py View on Github external
def __init__(self, marker):
        Sensor.__init__(self, 'marker_{}'.format(marker.id))

        self.position = marker.normalized_center
        self.id = marker.id

        self._marker = marker
github poppy-project / pypot / pypot / robot / sensor.py View on Github external
def __init__(self, name):
        Sensor.__init__(self, name)

        self._pos = zeros(3)
        self._ori = zeros(3)
github poppy-project / pypot / pypot / sensor / camera / abstractcam.py View on Github external
def __init__(self, name, resolution, fps):
        Sensor.__init__(self, name)

        self._res, self._fps = resolution, fps
        self._last_frame = self._grab_and_process()

        self.running = True
        self._processing = Thread(target=self._process_loop)
        self._processing.daemon = True
        self._processing.start()
github poppy-project / pypot / pypot / vrep / controller.py View on Github external
def __init__(self, name):
        Sensor.__init__(self, name)

        self._colliding = False
github poppy-project / pypot / pypot / sensor / humidity / humidity.py View on Github external
def __init__(self, name,
                 sensor_type, gpio_number,
                 humidity_offset, temperature_offset,
                 refresh_freq=1.0):
        Sensor.__init__(self, name)

        sensor_args = {'DHT11': Adafruit_DHT.DHT11,
                       'DHT22': Adafruit_DHT.DHT22,
                       'AM2302': Adafruit_DHT.AM2302}

        # Sensor should be set to DHT11, DHT22, or AM2302.
        if sensor_type not in sensor_args:
            raise ValueError('sensor_type must be one of                {}'.format(sensor_args.keys()))

        self._sensor, self._pin = sensor_args[sensor_type], gpio_number

        self._humidity_offset = humidity_offset
        self._temperature_offset = temperature_offset

        self._humidity = 0
        self._temperature = 0