Link Search Menu Expand Document

arena-py API v0.9.6

arena.scene

Gives access to an ARENA scene. Can create and execute various user-defined functions/tasks.

Parameters
  • str host: Hostname of the ARENA webserver (required).
  • str realm: Reserved topic fork for future use (optional).
  • str namespace: Username of authenticated user or other namespace (automatic).
  • str scene: The name of the scene, without namespace (required).
Scene( host='arenaxr.org', realm='realm', network_latency_interval=10000, on_msg_callback=None, new_obj_callback=None, user_join_callback=None, user_left_callback=None, delete_obj_callback=None, end_program_callback=None, video=False, debug=False, cli_args=False, **kwargs)
telemetry
connected_evt
cmd_interpreter
def parse_cli(self, cli_args=False):

Reusable command-line options to give apps flexible options to avoid hard-coding locations.

def exit(self, arg=0):

Custom exit to push errors to telemetry

def on_connect(self, client, userdata, flags, rc):

Paho MQTT client on_connect callback

def on_message(self, client, userdata, msg):
def on_publish(self, client, userdata, mid):
async def process_message(self):
def callback_wrapper(self, func, arg, msg):

Checks for number of arguments for callback

def generate_custom_event(self, evt, action='clientEvent'):

Publishes an custom event. Could be user or library defined

def generate_click_event(self, obj, type='mousedown', **kwargs):

Publishes an click event

def manipulate_camera(self, cam, **kwargs):

Publishes a camera manipulation event

def look_at(self, cam, target):

Publishes a camera manipulation event

def teleport_to_landmark(self, cam, target):

Publishes a camera manipulation event

all_objects

Returns all the objects in a scene

def add_object(self, obj):

Public function to create an object

def add_objects(self, objs):

Public function to create multiple objects in a list

def update_object(self, obj, **kwargs):

Public function to update an object

def update_objects(self, objs, **kwargs):

Public function to update multiple objects in a list

def delete_object(self, obj):

Public function to delete an object

def delete_attributes(self, obj, attributes=None):

Public function to delete a list of 'attributes' as a string[], updating each to null

def run_animations(self, obj):

Runs all dispatched animations

def create_delayed_task(self, obj, anim):

Creates a delayed task to push the end state of an animation after the expected duration. Uses async sleep to avoid blocking.

Parameters
  • obj: arena object to update
  • anim: Animation to run
Returns

created async task

def get_persisted_obj(self, object_id):

Returns a dictionary for a persisted object.

If object is known by arena-py, return local object, not persisted

def get_persisted_objs(self):

Returns a dictionary of persisted objects.

If object is known by arena-py, return our local object, not persisted Silently fails/skip objects without object_id and object_type (except programs) Instantiates generic Object if object_type is given but unknown to arena-py

def get_persisted_scene_option(self):

Returns a dictionary for scene-options. [TODO] wrap the output as a BaseObject

def get_writable_scenes(self):

Request list of scene names for logged in user account that user has publish permission for. Returns: list of scenes.

def get_user_list(self):

Returns a list of users

def get_rcv_pub_queue_len(self):

Return QueueStats object with receive and publish queue length

def run_info_update(self, run_info):

Callback when program stats are updated; publish program object update

class Arena(Scene):

Another name for Scene.


Table of contents