Link Search Menu Expand Document

arena-py API v1.0.1

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).
  • int network_latency_interval: Interval (in ms) to run network graph latency update. Default value is 10000 (10 secs). Ignore this parameter.
  • func on_msg_callback: Called on all MQTT messages received. Default = None.
  • func new_obj_callback: Called on object 'create' MQTT messages received. Default = None.
  • func user_join_callback: Called on user id 'new' MQTT messages received. Default = None.
  • func user_left_callback: Called on user id 'leave' MQTT messages received. Default = None.
  • func delete_obj_callback: Called on object 'delete' MQTT messages received. Default = None.
  • func end_program_callback: Called on MQTT disconnect. Default = None.
  • bool video: If true, request permissions for video conference. Default = False.
  • bool debug: If true, print a log of all publish messages from this client. Default = False.
  • bool cli_args: If true, require CLI standardized parameters. Default = False.
  • bool headless: If true, force limited input device auth flow. Default = False.
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, headless=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=None):

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_message_private(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: arena.objects.arena_object.Object, 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: arena.objects.arena_object.Object, **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: arena.objects.arena_object.Object, attributes=None):

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

def run_animations(self, obj: arena.objects.arena_object.Object):

Runs all dispatched animations

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