arflow
The ARFlow Python Server
The ARFlow Python server collects streaming data from your ARFlow clients. The server is designed to be easily extensible and can be integrated with your own research prototype. Data is streamed to the rerun
logger and saved to a pickle
file at the end of a session, which can be visualized later using the ARFlow Player.
Installation
The ARFlow server can be simply installed via pip
:
pip install arflow
Examples
Next, you may integrate ARFlow with your own research prototype via the Python API:
"""A simple example of extending the ARFlow server."""
import arflow
class CustomService(arflow.ARFlowService):
def on_frame_received(self, frame: arflow.DataFrameRequest):
"""Called when a frame is received."""
print("Frame received!")
def main():
arflow.create_server(CustomService, port=8500, path_to_save="./")
if __name__ == "__main__":
main()
Save the above code to a file, e.g., simple_server.py
, and run it:
python3 simple_server.py
Once you have your server running, you can start your ARFlow clients and connect them to the server. The server will start collecting data from the clients and save it to a pickle
file at the end of the session.
You can visualize the data using the ARFlow Player:
"""A simple example of replaying saved ARFlow data."""
import arflow
from .simple_server import CustomService
def main():
"""Run the example."""
player = arflow.ARFlowPlayer(
CustomService, frame_data_path="FRAME_DATA_PATH.pkl"
)
player.run()
if __name__ == "__main__":
main()
Save the above code to a file, e.g., simple_replay.py
, replace FRAME_DATA_PATH
with the path to your saved pickle
file, and run it:
python3 simple_replay.py
For more examples, check out the examples directory.
Contributing
We welcome contributions to ARFlow! Please refer to the CONTRIBUTING.md
file for more information.
1""" 2.. include:: ../README.md 3""" 4 5from arflow.core import * # noqa 6from arflow.replay import * # noqa 7from arflow.serve import * # noqa 8from arflow.service_pb2 import * # noqa 9 10# https://pdoc.dev/docs/pdoc.html#exclude-submodules-from-being-documented 11__all__ = [ # noqa 12 "core", # noqa 13 "replay", # noqa 14 "serve", # noqa 15]
Run a simple ARFlow server.