# Quick Start 誰かがインストールしていて、誰かが設定していれば、運が良ければ動く ## サーバー起動(直接) python のプログラムを直接動かして、サーバー起動 **examples** 以下の ```cobotta1_server1_ctrl.py``` を使う ```python import sys import os from cobotta2 import Config, CobottaCtrl from cobotta2.server_fastapi import CobottaRouterCtrl from cobotta2.server_fastapi import cobotta_ctrl_api_spec from ese774_frame import FastApiServer from x_logger import XLogger if __name__ == "__main__": Config.load_yaml("config_cobotta1_server1.yaml") logger = XLogger( log_level="debug", logger_name=Config.SERVER_LOGGER_NAME, log_mode="rotate", log_name=f"c:/opt/log/{Config.SERVER_LOGGER_NAME}.log", ) logger.info(f"COBOTTA IP = {Config.COBOTTA_IP}") logger.info(f"SERVER IP = {Config.SERVER_IP}") logger.info(f"SERVER PORT = {Config.SERVER_PORT}") server = FastApiServer( device_cls=CobottaCtrl, # 制御クラス router_cls=CobottaRouterCtrl, # routerクラス config=Config, api_spec=cobotta_ctrl_api_spec, device_kwargs={ "cobotta_ip": Config.COBOTTA_IP }, # COBOTTA制御Classのコンストラクタ引数) logger=logger, logger_name=Config.SERVER_LOGGER_NAME, # LOGGER_NAME lifespan_msg_prefix="COBOTTA", ) server.run(host=Config.SERVER_IP, port=Config.SERVER_PORT) ``` サーバー起動 ```shell pytho ./cobotta1_server1_ctrl.py ``` --- ## 作者 - Kengo NAKADA