def run(sdk_conn):
    robot = sdk_conn.wait_for_robot()

    global remote_control_cozmo
    remote_control_cozmo = RemoteControlCozmo(robot)

    # Turn on image receiving by the camera
    robot.camera.image_stream_enabled = True

    flask_helpers.run_flask(flask_app)
예제 #2
0
def run(sdk_conn):
    robot = sdk_conn.wait_for_robot()
    robot.world.image_annotator.add_annotator('robotState', RobotStateDisplay)
    robot.enable_device_imu(True, True, True)

    global remote_control_cozmo
    remote_control_cozmo = RemoteControlCozmo(robot)

    # Turn on image receiving by the camera
    robot.camera.image_stream_enabled = True

    flask_helpers.run_flask(flask_app)
예제 #3
0
def run():
    args = util.parse_command_args()

    with anki_vector.AsyncRobot(args.serial,
                                enable_face_detection=True,
                                enable_custom_object_detection=True) as robot:
        flask_app.remote_control_vector = RemoteControlVector(robot)
        flask_app.display_debug_annotations = DebugAnnotations.ENABLED_ALL.value

        robot.camera.init_camera_feed()
        zrobot.behavior.drive_off_charger()
        robot.camera.image_annotator.add_annotator('robotState',
                                                   RobotStateDisplay)

        flask_helpers.run_flask(flask_app)
def run(sdk_conn):
    robot = sdk_conn.wait_for_robot()
    robot.world.image_annotator.add_annotator('robotState', RobotStateDisplay)
    robot.enable_device_imu(True, True, True)

    global remote_control_cozmo, state_recorder
    remote_control_cozmo = RemoteControlCozmo(robot)
    state_recorder = RobotStateRecorder(remote_control_cozmo)
    # NOTE: Circular reference. But it should not be a problem because there is only one RC at a given time.
    remote_control_cozmo.use_state_recorder(state_recorder)

    # Turn on image receiving by the camera
    robot.camera.image_stream_enabled = True

    flask_helpers.run_flask(flask_app)
예제 #5
0
def run(sdk_conn):
    '''
        The run method runs once Cozmo is connected.
    '''

    global robot

    robot = sdk_conn.wait_for_robot()

    try:
        global anim_names
        for a in robot.conn.anim_names:
            anim_names += a + ','
        flask_helpers.run_flask(flask_app)

    except KeyboardInterrupt:
        print("")
        print("Exit requested by user")
예제 #6
0
def cozmo_program(_robot: cozmo.robot.Robot):
    global robot
    robot = _robot

    try:
        global animations
        global triggers
        global behaviors
        for a in robot.conn.anim_names:
            animations += a + ','
        animations = animations[:-1]
        for t in dir(cozmo.anim.Triggers):
            if '__' not in t:
                triggers += t + ','
        triggers = triggers[:-1]
        for b in dir(cozmo.behavior.BehaviorTypes):
            if '__' not in b:
                behaviors += b + ','
        behaviors = behaviors[:-1]
        logging.info('Attempting to open browser window at 127.0.0.1:5000')
        flask_helpers.run_flask(flask_app)

    except KeyboardInterrupt:
        print("\nExit requested by user")
예제 #7
0
def run(sdk_conn):
    # The run method runs once Cozmo is connected
    global robot

    robot = sdk_conn.wait_for_robot()
    flask_helpers.run_flask(flask_app)
예제 #8
0
    return ''


@flask_app.route('/return_move', methods=['POST'])
def return_move():
    # Returning move command currently being executed
    global counter
    return str(counter)


def run(sdk_conn):
    # The run method runs once Cozmo is connected
    global robot

    robot = sdk_conn.wait_for_robot()
    flask_helpers.run_flask(flask_app)


if cozmoEnabled:
    if __name__ == '__main__':
        cozmo.setup_basic_logging()
        cozmo.robot.Robot.drive_off_charger_on_connect = False
        try:
            cozmo.connect(run)
        except cozmo.ConnectionError as e:
            sys.exit("A connection error occurred: %s" % e)

else:
    print('Robot testing disabled')
    flask_helpers.run_flask(flask_app)