def test_values_good(self):
        queue = Queue(1000)
        stop_flag = Value('i', False)
        rangefinder = UltrasonicRangeFinder(GPIO_ULTRASONIC_TRIGGER, GPIO_ULTRASONIC_ECHO)

        # this should give us around 50 measurements
        t = threading.Timer(0.50, self.stop_range_finder, args=(stop_flag,))
        t.start()

        # this will loop until the timer kicks in
        rangefinder.measure(queue, stop_flag, 0)

        # last value in queue should be equal to current distance approximation
        last_distance = None
        count = 0
        while not queue.empty():
            count += 1
            last_distance = queue.get_nowait()
            self.assertGreater(last_distance.value, 0.03)
            self.assertIsNotNone(last_distance.speed)

        self.assertGreaterEqual(count, 9)
        self.assertEqual(rangefinder.distance, last_distance.value)
        self.assertAlmostEqual(rangefinder.speed, 0, delta=0.5)
def _range_finder_process(gpio_trigger, gpio_echo, queue, stop_flag):

    rangefinder = UltrasonicRangeFinder(gpio_trigger, gpio_echo)
    rangefinder.measure(queue, stop_flag, time_between_measurements)