def forward(): print('robot_controller, forward, robot_debug =', robot_debug) if not robot_debug: gopigo_client.set_speed(robot_speed) gopigo_client.stop() gopigo_client.fwd() time.sleep(robot_wait) gopigo_client.stop()
def right(): print('robot_controller, right, robot_debug =', robot_debug) if not robot_debug: gopigo_client.set_speed(robot_speed) gopigo_client.stop() gopigo_client.right_rot() time.sleep(robot_wait) gopigo_client.stop()
def backward(duration=LONG_DURATION): print('robot_controller, backward, robot_debug =', robot_debug) if not robot_debug: gopigo_client.set_speed(robot_speed) gopigo_client.stop() gopigo_client.bwd() pause(duration) gopigo_client.stop()
def right_rot(duration=SHORT_DURATION): print('robot_controller, right_rot, robot_debug =', robot_debug) if not robot_debug: gopigo_client.set_speed(robot_speed) gopigo_client.stop() gopigo_client.right_rot() pause(duration) gopigo_client.stop()
def right(duration=0.5): print('robot_controller, right, robot_debug =', robot_debug) if not robot_debug: gopigo_client.set_speed(robot_speed) gopigo_client.stop() gopigo_client.right() pause(duration) gopigo_client.stop()
def right_rot(duration=0.5): print('robot_controller, right_rot, robot_debug =', robot_debug) if not robot_debug: gopigo_client.set_speed(robot_speed) gopigo_client.stop() gopigo_client.right_rot() pause(duration) gopigo_client.stop()
def backward(duration=0.5): print('robot_controller, backward, robot_debug =', robot_debug) if not robot_debug: gopigo_client.set_speed(robot_speed) gopigo_client.stop() gopigo_client.bwd() pause(duration) gopigo_client.stop()
def forward(duration=LONG_DURATION): print('robot_controller, forward, robot_debug =', robot_debug) if not robot_debug: gopigo_client.set_speed(robot_speed) gopigo_client.set_left_speed(robot_speed + 5) gopigo_client.stop() gopigo_client.fwd() pause(duration) gopigo_client.stop()
def forward(duration=0.5): print('robot_controller, forward, robot_debug =', robot_debug) if not robot_debug: gopigo_client.set_speed(robot_speed) gopigo_client.set_left_speed(robot_speed+5) gopigo_client.stop() gopigo_client.fwd() pause(duration) gopigo_client.stop()
def stop(): print('robot_controller, stop, robot_debug =', robot_debug) if not robot_debug: gopigo_client.set_speed(robot_speed) gopigo_client.stop()
def message(self, pubnub, message): try: action = message.message.lower() if 'forward' in action: gopigo_client.fwd() time.sleep(self.CRAB_DURATION) gopigo_client.stop() elif 'backward' in action: gopigo_client.bwd() time.sleep(self.CRAB_DURATION) gopigo_client.stop() elif 'rotate' in action: if 'left' in action: gopigo_client.left_rot() time.sleep(self.TURN_DURATION) gopigo_client.stop() elif 'right in action': gopigo_client.right_rot() time.sleep(self.TURN_DURATION) gopigo_client.stop() elif 'left' in action: gopigo_client.left() time.sleep(self.TURN_DURATION) gopigo_client.stop() elif 'right' in action: gopigo_client.right() time.sleep(self.TURN_DURATION) gopigo_client.stop() elif 'dance' in action: gopigo_client.right() time.sleep(self.TURN_DURATION) gopigo_client.left_rot() time.sleep(self.TURN_DURATION) gopigo_client.right_rot() time.sleep(self.TURN_DURATION) gopigo_client.fwd() time.sleep(self.TURN_DURATION) gopigo_client.right() time.sleep(self.TURN_DURATION) gopigo_client.bwd() time.sleep(self.TURN_DURATION) gopigo_client.stop() elif 'stop' in action: gopigo_client.stop() elif 'blink' in action: for i in range(5): gopigo_client.led_on(0) gopigo_client.led_off(1) time.sleep(self.BLINK_DURATION) gopigo_client.led_off(0) gopigo_client.led_on(1) time.sleep(self.BLINK_DURATION) gopigo_client.led_off(0) gopigo_client.led_off(1) elif 'faster' in action: gopigo_client.set_speed(self.FAST_SPEED) elif 'slower' in action: gopigo_client.set_speed(self.SLOW_SPEED) else: pass log_it(self.get_status(action)) except IndexError: pass # do nothing except Exception as e: print("problem: %s" % str(e))
def stop(duration=0.5): print('robot_controller, stop, robot_debug =', robot_debug) if not robot_debug: gopigo_client.set_speed(robot_speed) gopigo_client.stop() pause(duration)