FastAPI server

dobot.server_fastapi.server passes DobotCtrl to ese774_frame.FastApiServer. It uses neither a device-specific router nor Pydantic request models. api_spec=None and router_cls=None select automatic dispatch through the framework’s standard DeviceRouter.

from ese774_frame import FastApiServer
from dobot.config import Config
from dobot.dobot_ctrl import DobotCtrl

server = FastApiServer(
    device_cls=DobotCtrl,
    router_cls=None,
    config=Config,
    api_spec=None,
    object_name="dobot",
    device_kwargs={"dobot_ip": Config.DOBOT_IP,
                   "instance_name": Config.INSTANCE_NAME},
)
server.run(host=Config.SERVER_IP, port=Config.SERVER_PORT)

The packaged server also passes logger and lifespan settings. Launch it from an environment where the package is installed:

python -m dobot.server_fastapi.server

The server attempts to connect to the physical robot when it constructs DobotCtrl. Defaults are Config.SERVER_IP=127.0.0.1, SERVER_PORT=8000, and DOBOT_IP=192.168.1.6. Configure network access controls before exposing the server remotely.