# Server-Class Installation ## Required packages and repositories (software developed by the laboratory) 1. [x_logger](https://github.com/ohara-lab-su/x_logger.git): Log management. 2. [ese774_frame](https://github.com/ohara-lab-su/ese774_frame.git): Framework for communication with the COBOTTA control server (ESE774 implementation). 3. [cobotta2](https://github.com/ohara-lab-su/cobotta2.git): COBOTTA control server software using ORiN2. 4. [cobotta2_client](https://github.com/shimane-dev/cobotta2_client.git): Example client programs. 5. [cobotta_joypad](https://github.com/ohara-lab-su/cobotta2_joypad.git): Joypad control with high-speed gRPC communication. ## x_logger [x_logger](https://github.com/ohara-lab-su/x_logger.git): Log management. Extract `x_logger.zip` and move to the extracted directory before running: ``` pip install x_logger ``` ## ese774_frame [ese774_frame](https://github.com/ohara-lab-su/ese774_frame.git): Communication framework for the COBOTTA control server. Extract `fastapi_frame.zip` and change to the extracted directory before running: ``` pip install ese774_frame ``` ## cobotta2 [cobotta2](https://github.com/ohara-lab-su/cobotta2.git): COBOTTA control server using ORiN2. Install the control package: ``` pip install cobotta2 ``` ## Starting the server directly from Python ```python #!/usr/bin/env python from cobotta2.config import Config from cobotta2.cobotta_ctrl_state import CobottaState from cobotta2.server_fastapi import CobottaRouterState from cobotta2.server_fastapi import cobotta_state_api_spec from ese774_frame.api_server import FastApiServer from x_logger.x_logger import XLogger if __name__ == "__main__": Config.load_yaml("config_cobotta2_state.yaml") logger = XLogger( log_level="debug", logger_name=Config.SERVER_LOGGER_NAME, log_mode="rotate", # log_mode="file", 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=CobottaState, # Control class router_cls=CobottaRouterState, # Router implemented through inheritance config=Config, api_spec=cobotta_state_api_spec, device_kwargs={ "cobotta_ip": Config.COBOTTA_IP }, # Constructor arguments for the COBOTTA control class logger=logger, logger_name=Config.SERVER_LOGGER_NAME, lifespan_msg_prefix="COBOTTA", ) server.run(host=Config.SERVER_IP, port=Config.SERVER_PORT) ``` ### Testing with a local client ### Testing communication through FastAPI ## Creating directories for server logs and services - Create the server log directory. - Create the server application directory. ## Registering cobotta-server as a Windows service ## Registering aandd-server as a Windows service --- ## Author - Kengo NAKADA