Example #1
0
def main():
    try:
        opts, args = getopt.getopt(sys.argv[1:], 'hs:', ['scene='])
    except getopt.GetoptError:
        printhelp()
        sys.exit(1)

    scene = None
    for opt, arg in opts:
        if opt == '-h':
            printhelp()
            sys.exit(1)
        elif opt in ('-s', '--scene'):
            scene = arg
        else:
            printhelp()
            sys.exit(1)

    if scene is None:
        printhelp()
        sys.exit(1)

    print('Scene:', scene)
    arena.init(BROKER, REALM, scene)
    print('Go to URL: https://xr.andrew.cmu.edu/?networkedTagSolver=true&scene=' + scene + '&fixedCamera=<username>')
    arena.add_topic(TOPIC, on_tag_detect)
    arena.handle_events()
Example #2
0
def arena_init():
    arena.init("arena.andrew.cmu.edu", "realm", "patrick_scene",
               scene_callback)

    temperature_text = arena.Object(objName="temperature_text",
                                    objType=arena.Shape.text,
                                    color=(255, 0, 0),
                                    location=(-1, 2, -3),
                                    text="Hello world! The temperature is: 0")
    humidity_text = arena.Object(objName="humidity_text",
                                 objType=arena.Shape.text,
                                 color=(255, 0, 0),
                                 location=(-1, 1, -3),
                                 text="Hello world! The humidity is: 0")
    start_serial(temperature_text, humidity_text)
    arena.handle_events()
Example #3
0
def main():
    try:
        opts, args = getopt.getopt(sys.argv[1:], 'hs:u:',
                                   ['scene=', 'userfile='])
    except getopt.GetoptError:
        printhelp()
        sys.exit(1)

    scene = None
    userfile = None
    for opt, arg in opts:
        if opt == '-h':
            printhelp()
            sys.exit(1)
        elif opt in ('-s', '--scene'):
            scene = arg
        elif opt in ('-u', '--userfile'):
            userfile = arg
        else:
            printhelp()
            sys.exit(1)
    if scene is None or userfile is None:
        printhelp()
        sys.exit(1)

    with open(userfile, 'r') as f:
        config = json.load(f, object_hook=dict_to_sns)

    arena.init(BROKER, REALM, scene)
    for user in config:
        arenanames[user.uwbname] = user.arenaname
        if user.static:
            users[user.client_id] = StaticUser(user)
        else:
            users[user.client_id] = SyncUser(user)
            print(
                "Go to URL: https://xr.andrew.cmu.edu/?networkedTagSolver=true&scene="
                + scene + "&fixedCamera=" + user.arenaname)

    scene.add_topic(TOPIC_DETECT, on_tag_detect)
    scene.add_topic(TOPIC_VIO, on_vio)
    scene.add_topic(TOPIC_UWB, on_uwb)
    arena.handle_events()
Example #4
0
def main():
    try:
        opts, args = getopt.getopt(sys.argv[1:], 'hs:', ['scene='])
    except getopt.GetoptError:
        printhelp()
        sys.exit(1)

    scene = None
    for opt, arg in opts:
        if opt == '-h':
            printhelp()
            sys.exit(1)
        elif opt in ('-s', '--scene'):
            scene = arg
        else:
            printhelp()
            sys.exit(1)
    if scene is None or userfile is None:
        printhelp()
        sys.exit(1)

    arena.init(BROKER, REALM, scene)
    print("Go to URL: https://xr.andrew.cmu.edu/?scene=" + scene)
    arena.handle_events()
Example #5
0
        counter = counter + 1
        grid[(x - 1)][(y - 1)] = counter % 2
        colstring = '#%02x%02x%02x' % color
        cubes[(x, y)].update(
            physics=arena.Physics.static,
            data=
            '{"impulse": {"on": "mouseup","force":"0 40 0","position":"10 1 1"},"material": {"color":"'
            + colstring + '", "transparent": false, "opacity": 1}}',
            clickable=True,
            location=(x, y, -3),
            scale=(0.6, 0.6, 0.6))

        if solved():
            print("solved")
            animate_win()
            draw_board()
        if stalemate():
            print("stalemate")
            animate_loss()
            draw_board()
    else:
        return


# start the fun shall we?

arena.init(HOST, REALM, SCENE, process_message, port=3003)
print("starting main loop")
draw_board()
arena.handle_events()