def __init__(self, serial_port, front, rear, p=0x10000, i=0x10000, d=0x0, qpps=10000): self.__serial_port = serial_port self.__front, self.__rear = front, rear self.__roboclaw_read_lock = threading.RLock() self.__roboclaw_write_lock = threading.RLock() self.__timeout_lock = threading.Lock() self.__motors_stop_timer_enabled = False self.__reset_time, self.__motors_stop_time = 0.0, 0.0 self.__reset_gpio = open(RESET_GPIO_PATH, mode='ab') self.__led1_gpio = open(LED1_GPIO_PATH, mode='ab') self.__led2_gpio = open(LED2_GPIO_PATH, mode='ab') self.__p_const = p self.__i_const = i self.__d_const = d self.__qpps_const = qpps self.__driving_allowed = True self.__is_active = True self.__logger = logging.getLogger(LOGGER_NAME) runtime.add_shutdown_hook(self.terminate) self.__serial_port.flush() self.__setup() self.__green_led(True) self.__red_led(False)
def __init__(self, roboclaw_driver, hokuyo_proxy, ninedof_proxy): self.__roboclaw_driver = roboclaw_driver self.__scan_analyzer = logic.ScanAnalyzer() self.__motion_analyzer = drive_support_logic.MotionAnalyzer() self.__measured_speeds_analyzer = drive_support_logic.SpeedsAnalyzer() self.__user_speeds_analyzer = drive_support_logic.SpeedsAnalyzer() self.__distance_limiter = drive_support_logic.DistanceLimiter() self.__motion_limiter = drive_support_logic.MotionLimiter() self.__measured_speeds = None self.__user_speeds = None self.__is_active = True self.__hokuyo_proxy = hokuyo_proxy self.__ninedof_proxy = ninedof_proxy self.__hokuyo_listener = ScanHandler(self) self.__ninedof_listener = MotionHandler(self) hokuyo_proxy.subscribe(self.__hokuyo_listener) ninedof_proxy.subscribe(self.__ninedof_listener) self.__logger = logging.getLogger(LOGGER_NAME) runtime.add_shutdown_hook(self.terminate)
def __init__(self, message_handler, pipe_in, pipe_out): self.__message_handler = message_handler self.__pipe_in, self.__pipe_out = pipe_in, pipe_out self.__is_alive = True self.__write_lock = threading.Lock() self.__logger = logging.getLogger(LOGGER_NAME) runtime.add_shutdown_hook(self.terminate)
def __init__(self, port): self.__port = port self.__port_lock = threading.RLock() self.__scan = (0, [], []) self.__last_get_scan = 0.0 self.__is_active = True self.__scanning_enabled = False runtime.add_shutdown_hook(self.terminate)
def __init__(self, driver_proxy, location_proxy): self.__driver_proxy = driver_proxy self.__location_proxy = location_proxy self.__next_targets, self.__visited_targets = [], [] self.__current_location, self.__next_targets_timestamp = None, 0.0 self.__targets_lock = threading.Condition() self.__is_active = True self.__driving_allowed = False self.__old_left, self.__old_right = 0.0, 0.0 self.__logger = logging.getLogger(LOGGER_NAME) runtime.add_shutdown_hook(self.stop)
def __init__(self, scanner, motor_speed=0, high_sensitive=False, multi_scanning_allowed=False): self.__scanner = scanner self.__hokuyo_lock = threading.RLock() self.__scan = ([], [], 0) self.__motor_speed = motor_speed self.__high_sensitive = high_sensitive self.__multi_scanning_allowed = multi_scanning_allowed self.__is_active = True self.__logger = logging.getLogger(LOGGER_NAME) runtime.add_shutdown_hook(self.terminate) self.__reset()
def __init__(self, hostname, port=DEFAULT_PORT, name=None): """ Instantiates AmberClient object. """ self.__logger = logging.getLogger(LOGGER_NAME) self.__proxy = None self.__hostname, self.__port = hostname, port self.__socket_sendto_lock = threading.Lock() self.__socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) self.__socket.setblocking(False) self.__socket.settimeout(0.5) self.__alive = True self.__receiving_thread = threading.Thread(target=self.message_receiving_loop, name="receiving-thread-%s" % str(name)) self.__receiving_thread.start() runtime.add_shutdown_hook(self.terminate_client)
def __init__(self, device_type, device_id, amber_client): """ Generic proxy constructor. Must be invoked from subclasses. """ self.device_type, self.device_id = device_type, device_id self.__amber_client = amber_client amber_client.register_proxy(self) self.__syn_num = 0 self.__syn_num_lock = threading.Lock() self.__future_objs = {} self.__future_objs_lock = threading.Lock() self.__listeners = [] self.__listeners_lock = threading.Lock() self.__logger = logging.getLogger(LOGGER_NAME) runtime.add_shutdown_hook(self.terminate_proxy)
def __init__(self, driver_proxy, location_proxy, hokuyo_proxy): self.__driver_proxy = driver_proxy self.__location_proxy = location_proxy self.__hokuyo_proxy = hokuyo_proxy self.__scan_analyzer = logic.ScanAnalyzer() self.__hokuyo_listener = ScanHandler(self) hokuyo_proxy.subscribe(self.__hokuyo_listener) self.__scan = None self.__next_targets, self.__visited_targets = [], [] self.__current_location, self.__next_targets_timestamp = None, 0.0 self.__targets_lock = threading.Condition() self.__is_active = True self.__driving_allowed = False self.__locator = drive_to_point_logic.Locator() self.__speeds_filter = logic.LowPassFilter(0.5, 0.0, 0.0) self.__logger = logging.getLogger(LOGGER_NAME) runtime.add_shutdown_hook(self.stop)
def __init__(self, port, rc_address=128): self.__port = port self.__rc_address = rc_address runtime.add_shutdown_hook(self.terminate)
def __init__(self, port): self.__port = port self.__port_lock = threading.RLock() runtime.add_shutdown_hook(self.terminate)