🚋Streaming
One strong advantage of using ROAR_PY is that it supports streaming standard RoarPySensor / RoarPyActor / RoarPyWorld objects over websocket or any other protocols that you wish to implement.
To support streaming for non-official implementations of the ROAR_PY interface, you simply need to add a few annotations to your implementation code and you can spin up a ROAR_PY remote server quickly. Let's get started!
Streaming requires data to be passed between remote server and clients, and therefore usually requires the control code to support multi-threading.
ROAR_PY makes this simple by not requiring your code to support multi-threading natively, but just asking you to annotate methods that can only be called one thread at a time with @roar_py_thread_sync.
To share a world with different clients, the server needs to know which actors belongs to which client, therefore you need to annotate methods that creates new actors / sensors with @roar_py_append_item and methods that removes actors / sensors with @roar_py_remove_item in any implementation of RoarPyWorld.
If you want to stream custom sensor datas, your custom data should be annotated with @serde, @dataclass, and @remote_support_sensor_data_register. Annotating with @serde and @dataclass tells the Python interpreter that the sensor data class is a data class that can be serialized, and @remote_support_sensor_data_register tells ROAR_PY's streaming service that this type of data is supported for streaming. The sensor data class should also extend RoarPyRemoteSupportedSensorData.
Last updated