def compute_other_speed(self, last_speeds=None):
        self.speed_left = logic.average(self.speed_front_left, self.speed_rear_left)
        self.speed_right = logic.average(self.speed_front_right, self.speed_rear_right)
        self.speed_front = logic.average(self.speed_front_left, self.speed_front_right)
        self.speed_rear = logic.average(self.speed_rear_left, self.speed_rear_right)

        self.linear_speed = logic.average(self.speed_left, self.speed_right,
                                          self.speed_front, self.speed_rear)

        self.radius = compute_radius(self.speed_left, self.speed_right)

        if last_speeds is not None:
            last_speeds.append(self)
            self.acceleration_forward = compute_acceleration(last_speeds)
        else:
            self.acceleration_forward = None

        if self.radius is not None and abs(self.radius) > 0.0:
            self.acceleration_side = math.pow(self.linear_speed, 2.0) / self.radius
        else:
            self.acceleration_side = None

        if self.radius is not None and abs(self.radius) > 0.0:
            self.rotational_speed = self.linear_speed / self.radius
        else:
            self.rotational_speed = None
 def measuring_loop(self):
     while self.__is_active:
         time.sleep(0.09)
         motors_speed = self.__driver_proxy.get_current_motors_speed()
         speed_left = logic.average(motors_speed.get_front_left_speed(),
                                    motors_speed.get_rear_left_speed())
         speed_right = logic.average(motors_speed.get_front_right_speed(),
                                     motors_speed.get_rear_right_speed())
         self.__locator.calculate_relative_location(speed_left, speed_right)
示例#3
0
 def measuring_loop(self):
     while self.__is_active:
         time.sleep(0.09)
         motors_speed = self.__driver_proxy.get_current_motors_speed()
         speed_left = logic.average(motors_speed.get_front_left_speed(),
                                    motors_speed.get_rear_left_speed())
         speed_right = logic.average(motors_speed.get_front_right_speed(),
                                     motors_speed.get_rear_right_speed())
         self.__locator.calculate_relative_location(speed_left, speed_right)