def __send_commands(self, drive_angle, drive_distance): left, right = self.__compute_speed(drive_angle, drive_distance) current_timestamp = time.time() scan_factor = logic.compute_data_trust(self.__scan.timestamp / 1000.0, current_timestamp) location_factor = logic.compute_data_trust(self.__locator.get_last_update_timestamp(), current_timestamp) left = left * scan_factor * location_factor right = right * scan_factor * location_factor left, right = int(left), int(right) self.__driver_proxy.send_motors_command(left, right, left, right)
def __send_commands(self, drive_angle, drive_distance): left, right = self.__compute_speed(drive_angle, drive_distance) current_timestamp = time.time() scan_factor = logic.compute_data_trust(self.__scan.timestamp / 1000.0, current_timestamp) location_factor = logic.compute_data_trust( self.__locator.get_last_update_timestamp(), current_timestamp) left = left * scan_factor * location_factor right = right * scan_factor * location_factor left, right = int(left), int(right) self.__driver_proxy.send_motors_command(left, right, left, right)
def __call__(self, speeds): motion = self.__motion if motion is not None: current_timestamp = time.time() apply_factor(speeds, logic.compute_data_trust(motion.timestamp / 1000.0, current_timestamp)) apply_factor(speeds, self.__acceleration_factor) apply_factor(speeds, self.__rotational_factor)
def __call__(self, speeds): scan = self.__scan if scan is not None: avoid(speeds, scan) if speeds.radius is not None and 0.0 < abs(speeds.radius) and \ abs(speeds.speed_left - speeds.speed_right) > 25.0: new_radius = compute_new_radius(speeds, scan) if abs(speeds.radius - new_radius) > 0.0: change_radius(speeds, new_radius) limit_speed(speeds, scan) current_timestamp = time.time() apply_factor(speeds, logic.compute_data_trust(scan.timestamp / 1000.0, current_timestamp)) apply_factor(speeds, self.__distance_factor)