def __init__(self): logging.info("Initializing...") self._stop = False self.controller = XboxController() self.input_thread = InputThread(self.controller, self._handle_input) self.cli = pycozmo.Client() self.speed = 0.0 # -1.0 - 1.0 self.steering = 0.0 # -1.0 - 1.0 self.speed_left = 0.0 # 0 - 1.0 self.speed_right = 0.0 # 0 - 1.0 self.lift = True
def replay(fspec): pkts = load_engine_pkts(fspec) pycozmo.setup_basic_logging(log_level="DEBUG", protocol_log_level="DEBUG") cli = pycozmo.Client() cli.start() cli.connect() cli.wait_for_robot() for i, pkt in enumerate(pkts): input() print("{}".format(i)) cli.send(pkt) cli.disconnect() time.sleep(1)
def replay(self, fspec): self.load_engine_pkts(fspec) pycozmo.setup_basic_logging(log_level="DEBUG", protocol_log_level="DEBUG") cli = pycozmo.Client(protocol_log_messages=self.log_messages) cli.start() cli.connect() cli.wait_for_robot() try: for i, v in enumerate(self.pkts): # if i < 1113: # continue ts, pkt = v if self.packet_id_filter.filter(pkt.id): continue input() print("{}, time={:.06f}".format(i, ts - self.first_ts)) cli.conn.send(pkt) except KeyboardInterrupt: pass cli.disconnect() time.sleep(1)
def __init__(self): logging.info("Initializing...") self._stop = False self.cli = pycozmo.Client() self.speed_left = 0.0 # 0 - 1.0 self.speed_right = 0.0 # 0 - 1.0
import pycozmo cli = pycozmo.Client() cli.start() cli.connect() cli.wait_for_robot() cli.drive_wheels(lwheel_speed=50.0, rwheel_speed=50.0, duration=2.0) cli.disconnect() cli.stop()