Quick Start

If someone has already installed and configured the software, it may run without further setup.

Starting the server directly

Run the Python program directly to start the server. Use cobotta1_server1_ctrl.py under examples.

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,  # Control class
        router_cls=CobottaRouterCtrl,  # Router class
        config=Config,
        api_spec=cobotta_ctrl_api_spec,
        device_kwargs={"cobotta_ip": Config.COBOTTA_IP},
        logger=logger,
        logger_name=Config.SERVER_LOGGER_NAME,
        lifespan_msg_prefix="COBOTTA",
    )
    server.run(host=Config.SERVER_IP, port=Config.SERVER_PORT)

Start the server:

pytho ./cobotta1_server1_ctrl.py

Author

  • Kengo NAKADA