{"id":19963280,"url":"https://github.com/advrhumanoids/robot_monitoring","last_synced_at":"2025-05-03T22:32:01.429Z","repository":{"id":244377327,"uuid":"232301966","full_name":"ADVRHumanoids/robot_monitoring","owner":"ADVRHumanoids","description":"Packages such as UI tools and loggers for robot monitoring","archived":false,"fork":false,"pushed_at":"2024-11-05T11:01:41.000Z","size":7325,"stargazers_count":4,"open_issues_count":4,"forks_count":0,"subscribers_count":6,"default_branch":"xbot2","last_synced_at":"2024-11-05T12:34:38.303Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ADVRHumanoids.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-01-07T10:36:15.000Z","updated_at":"2024-06-14T10:08:23.000Z","dependencies_parsed_at":null,"dependency_job_id":"4fcde4b5-a209-4d9e-bb1b-0b8a0c1e4951","html_url":"https://github.com/ADVRHumanoids/robot_monitoring","commit_stats":null,"previous_names":["advrhumanoids/robot_monitoring"],"tags_count":25,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ADVRHumanoids%2Frobot_monitoring","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ADVRHumanoids%2Frobot_monitoring/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ADVRHumanoids%2Frobot_monitoring/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ADVRHumanoids%2Frobot_monitoring/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ADVRHumanoids","download_url":"https://codeload.github.com/ADVRHumanoids/robot_monitoring/tar.gz/refs/heads/xbot2","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224374651,"owners_count":17300691,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-13T02:15:29.623Z","updated_at":"2025-05-03T22:32:01.388Z","avatar_url":"https://github.com/ADVRHumanoids.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# xbot2 System Launch Guide (Using Kyon Simulation Example)\n\nThis document provides detailed instructions for launching the xbot2 system, focusing on the Kyon robot simulation example. It covers the core server/simulation components and the graphical user interface (GUI). The launch process relies heavily on ROS Noetic and the `concert_launcher` tool for managing processes.\n\n## Table of Contents\n\n1.  [Overall Flow](#overall-flow)\n2.  [Prerequisites](#prerequisites)\n3.  [Repository Structure (Kyon Example)](#repository-structure-kyon-example)\n4.  [Launch Process (Step-by-Step)](#launch-process-step-by-step)\n    * [Step 1: Launch Robot Model in Simulation Environment](#step-1-launch-robot-model-in-simulation-environment)\n    * [Step 2: Launch Core Server / Simulation](#step-2-launch-core-server--simulation)\n    * [Step 3: Launch GUI Server](#step-3-launch-gui-server)\n    * [Step 4: Launch GUI Client](#step-4-launch-gui-client)\n5.  [Component Roles \u0026 Interactions](#component-roles--interactions)\n6.  [Process Management](#process-management)\n7.  [Stopping the System](#stopping-the-system)\n8.  [GUI Interface Overview](#gui-interface-overview)\n\n## Overall Flow\n\nThe xbot2 system launch, demonstrated with the Kyon simulation, involves four main stages executed sequentially:\n\n1.  **Launch Robot Model in Simulation:** Start the robot model in the MuJoCo simulation environment.\n2.  **Start Core \u0026 Simulation:** Initiate the fundamental ROS nodes, simulation environment, and core xbot2 processes using a master launch script (`kyon_launcher.bash`). This script leverages `concert_launcher` to manage these background processes.\n3.  **Start GUI Server:** Launch the backend server (`xbot2_gui_server`) responsible for interfacing between the core system state and the user-facing GUI client. This server reads configuration files to understand the system's structure and potential states.\n4.  **Start GUI Client:** Run the graphical application (`xbot2_gui`) which connects to the GUI server to display information and potentially send commands.\n\n## Prerequisites\n\nYou can set up the xbot2 system in two ways: using Docker (recommended for quick setup) or installing components manually.\n\n### Docker Setup (Recommended for Server Components)\n\n**Docker (Comprehensive Solution):** Using Docker is the recommended approach for setting up the xbot2 system as it eliminates the need to install and configure numerous dependencies individually.\n\nThe provided Docker containers have **all dependencies pre-installed and configured**, including:\n* ROS Noetic\n* xbot2 framework\n* Required workspace structure\n* forest package manager\n* concert_launcher\n* Properly configured environment variables\n\nOne of the key advantages of using Docker is that you don't need to install any of these dependencies on your host system, as they are all contained within the Docker container.\n\nTo use the Docker setup:\n```bash\n# Clone the repository for Docker configuration\ngit clone https://github.com/ADVRHumanoids/kyon_config.git\ncd kyon_config/docker/kyon-cetc-focal-ros1\n\n# Build and run the Docker container\n./setup.sh\n```\n\nRefer to the Docker configuration within the `kyon_config` repository for detailed instructions: [kyon_config Docker](https://github.com/ADVRHumanoids/kyon_config/tree/master/docker/kyon-cetc-focal-ros1).\n\n**System Dependencies:** You could need to install various system dependencies also in the Container built:\n    \n    ```bash\n    # Terminal multiplexer required by concert_launcher\n    sudo apt-get update \u0026\u0026 sudo apt-get install -y tmux\n    \n    # XML processing library for configuration handling\n    python3 -m pip install lxml\n    \n    # Graphics libraries needed for visualization\n    sudo apt-get update \u0026\u0026 sudo apt-get install -y libglfw3-dev\n    \n    # Scientific computing library for numerical operations\n    pip install scipy\n\n### GUI Client Installation (Required for Both Approaches)\n\nThe xbot2 GUI client must be installed separately on your host system, regardless of which method you use for the server components:\n\n1. Visit the [robot_monitoring GitHub releases page](https://github.com/ADVRHumanoids/robot_monitoring/releases)\n2. Download the appropriate package for your system (e.g., \"Linux App\" which is around 250MB)\n3. Extract the downloaded package to a convenient location\n4. Install the required dependency for the GUI client:\n   ```bash\n   # Required by robot_monitoring GUI elements\n   sudo apt-get install libxcb-cursor0\n   ```\n\n### Manual Installation (Alternative for Server Components)\n\nIf you prefer not to use Docker, you can manually install all required components directly on your host system:\n\n1.  **ROS Noetic:** The example is built upon ROS Noetic.\n    * Installation: Follow the [Official ROS Noetic Installation Guide](http://wiki.ros.org/noetic/Installation).\n2.  **xbot2 Workspace (`xbot2_ws`):** The core components reside within a Catkin workspace, typically named `~/xbot2_ws`. This workspace must be built using `forest`. Refer to the `forest` repository for details: [https://github.com/ADVRHumanoids/forest](https://github.com/ADVRHumanoids/forest).\n3.  **Concert Launcher:** The `concert_launcher` Python package is required for managing processes. Refer to the `concert_launcher` repository for details: [https://github.com/ADVRHumanoids/concert_launcher](https://github.com/ADVRHumanoids/concert_launcher)\n    * Install via pip:\n        ```bash\n        pip install concert_launcher\n        ```\n4. **System Dependencies:** You'll need to install various system dependencies:\n    \n    ```bash\n    # Terminal multiplexer required by concert_launcher\n    sudo apt-get update \u0026\u0026 sudo apt-get install -y tmux\n    \n    # XML processing library for configuration handling\n    python3 -m pip install lxml\n    \n    # Graphics libraries needed for visualization\n    sudo apt-get update \u0026\u0026 sudo apt-get install -y libglfw3-dev\n    \n    # Scientific computing library for numerical operations\n    pip install scipy\n    ```\n\n## Repository Structure (Kyon Example)\n\nThis guide uses the `kyon` robot configuration as a reference example for launching xbot2 with its GUI in a MuJoCo simulation. The key repositories and components involved are structured as follows (assuming they are cloned within your `~/xbot2_ws/src`):\n\n* **`kyon_config`**: Contains Kyon-specific configuration files and the main launch script. **Could be required for the moment to copy the launcher folder with its configuration file from this repository: [https://github.com/ADVRHumanoids/iit-kyon-ros-pkg/tree/master/kyon_config/launcher](https://github.com/ADVRHumanoids/iit-kyon-ros-pkg/tree/master/kyon_config/launcher)**\n    * `launcher/kyon_launcher.bash`: The primary script for starting/managing the server/simulation.\n    * `launcher/launcher_config.yaml`: Defines processes managed by `concert_launcher` for the core system (used by `kyon_launcher.bash`).\n    * `launcher/gui_server_config_2.yaml`: Configuration for the `xbot2_gui_server`.\n    * `kyon_basic.yaml`: Core configuration file for `xbot2-core` specific to Kyon Repository: [https://github.com/ADVRHumanoids/kyon_config/tree/master/xbot2](https://github.com/ADVRHumanoids/kyon_config/tree/master/xbot2)\n* **`concert_launcher`**: The process manager tool. While typically installed via pip, understanding its configuration format might be helpful.\n    * Repository: [https://github.com/ADVRHumanoids/concert_launcher](https://github.com/ADVRHumanoids/concert_launcher)\n* **`xbot2_gui_server`**: The GUI backend application package. Source code might be located in `~/xbot2_ws/src/xbot2_gui_server/` or similar, depending on your `forest` setup.\n* **`robot_monitoring` (contains `xbot2_gui`)**: The package containing the GUI client application (`xbot2_gui`).\n    * Repository (proto branch mentioned): [https://github.com/ADVRHumanoids/robot_monitoring/tree/proto](https://github.com/ADVRHumanoids/robot_monitoring/tree/proto)\n\n## Launch Process (Step-by-Step)\n\n### Step 1: Launch Robot Model in Simulation Environment\n\nWhen working with a simulated robot, you must first launch the robot model in the simulation environment before starting the xbot2 system.\n\n1. **Open a Terminal:** Ensure your `xbot2_ws` is sourced (`source ~/xbot2_ws/devel/setup.bash`).\n2. **Launch the MuJoCo Simulation:** Execute the following command to start the Kyon robot model in MuJoCo:\n\n   ```bash\n   roslaunch kyon_mujoco kyon_world.launch arms:=false legs:=true\n   ```\n\n   This launches the Kyon robot in the MuJoCo physics simulation with legs enabled and arms disabled. You can adjust these parameters according to your needs.\n\n3. **Wait for Simulation to Initialize:** The MuJoCo window should appear showing the robot model. Wait until the simulation is fully initialized before proceeding to the next step.\n\n**Keep this terminal open.**\n\n### Step 2: Launch Core Server / Simulation\n\nThis step initializes the main backend processes, including ROS Master, RViz, and the xbot2 core/simulation.\n\n1.  **Open a New Terminal:** Ensure your `xbot2_ws` is sourced (`source ~/xbot2_ws/devel/setup.bash`).\n2.  **Run the Launcher Script:** Execute the `kyon_launcher.bash` script with the `sim` argument. Use the full path or ensure the script is executable and in your `PATH`.\n\n    ```bash\n    ~/xbot2_ws/src/kyon_config/launcher/kyon_launcher.bash sim\n    ```\n\n**What happens during this step?**\n\n* **Environment Setup:** The script sources the main ROS Noetic environment (`/opt/ros/noetic/setup.bash`) and your workspace setup file (`~/xbot2_ws/devel/setup.bash`).\n* **Dependency Check:** It verifies that the `concert_launcher` command is available.\n* **Configuration Export:** It sets the `CONCERT_LAUNCHER_DEFAULT_CONFIG` environment variable to point to `launcher_config.yaml` (relative to the script's location). This tells `concert_launcher` which process configuration file to use.\n* **Process Invocation (`sim` argument):**\n    * The `sim` argument triggers the command: `concert_launcher run sim_all`.\n    * `concert_launcher` reads the configuration file specified by `CONCERT_LAUNCHER_DEFAULT_CONFIG` (i.e., `launcher_config.yaml`).\n    * It finds the `sim_all` process group definition within that file.\n    * It identifies and resolves the dependencies for `sim_all`:\n        * `sim_all` depends on `xbot2_sim`.\n        * `xbot2_sim` depends on `roscore` and `rviz`.\n        * `rviz` depends on `roscore`.\n    * `concert_launcher` starts these processes in the correct dependency order:\n        1.  `roscore` (The ROS Master)\n        2.  `rviz` (ROS visualization tool)\n        3.  `xbot2_sim` (The core `xbot2-core` process, likely running the robot simulation using `kyon_config/kyon_basic.yaml`)\n    * Since `sim_all` is marked as `persistent: true` (or contains persistent processes), `concert_launcher` keeps monitoring these processes.\n\n**Important Note on Configuration:**  \nThe `launcher_config.yaml` file contains the configuration for various scenarios. For the MuJoCo simulation, the typical configuration looks like:\n\n```yaml\ncontext:\n  session: kyon_sim\n  params:\n    hw_type: sim\n\n# Simulation components\nroscore:\n  cmd: roscore\n  ready_check: rostopic list\n\n# mujoco_sim:\n#  cmd: roslaunch kyon_mujoco kyon_world.launch arms:=false legs:=true\n#  depends:\n#    - roscore\n\nrviz:\n  cmd: rviz\n  depends:\n     - roscore\n\nxbot2_sim:\n  cmd: xbot2-core --hw mj -C $(rospack find kyon_config)/kyon_basic.yaml\n  ready_check: timeout 5 rostopic echo /xbotcore/joint_states -n 1\n  depends:\n    - roscore\n    - rviz\n\nsim_all:\n  cmd: echo \"Starting full simulation environment\"\n  persistent: true\n  depends:\n    - xbot2_sim\n```\n\nNote that the `mujoco_sim` section is commented out since we're launching MuJoCo manually in Step 1. The `xbot2_sim` command uses `--hw mj` to connect to the MuJoCo simulation.\n\nIf you're using a real robot instead of a simulation, you would need to modify the `xbot2_sim` command to:\n\n```yaml\nxbot2_sim:\n  cmd: xbot2-core --hw dummy -C $(rospack find kyon_config)/kyon_basic.yaml\n  ready_check: timeout 5 rostopic echo /xbotcore/joint_states -n 1\n  depends:\n    - roscore\n    - rviz\n```\n\nYou should see output indicating that ROS core, RViz, and the simulation are starting. **Keep this terminal open.**\n\n### Step 3: Launch GUI Server\n\nThis step starts the backend service for the user interface.\n\n1.  **Open a *New* Terminal:** Ensure the ROS environment and your `xbot2_ws` are sourced in this terminal as well (run `source ~/xbot2_ws/devel/setup.bash`).\n2.  **Run the GUI Server:** Execute the `xbot2_gui_server` command, providing the path to its specific configuration file.\n\n    ```bash\n    xbot2_gui_server ~/xbot2_ws/src/kyon_config/launcher/gui_server_config_2.yaml\n    ```\n\n**What happens during this step?**\n\n* The `xbot2_gui_server` process starts.\n* It reads its specified configuration file (`gui_server_config_2.yaml`).\n* This configuration informs the server about:\n    * The dashboard layout and possible system `states` (`inactive`, `ready`, etc.).\n    * Crucially, it likely references `launcher_config.yaml` (via the `launcher_config` key). This tells the GUI server *which* `concert_launcher` configuration describes the underlying system processes started in Step 2.\n* The GUI server uses this information to monitor the status of processes defined in `launcher_config.yaml` (like `xbot2_sim`), possibly by interacting with ROS or `concert_launcher` itself.\n* It opens a network port (typically TCP/IP on localhost) to listen for connections from the GUI Client (`xbot2_gui`).\n\n**Keep this terminal open.**\n\n### Step 4: Launch GUI Client\n\nThis step runs the user-facing graphical interface.\n\n1.  **Open a *New* Terminal:** .\n2.  **Navigate to the Executable:** Change directory to where the `xbot2_gui` executable is located. .\n    ```bash\n    cd ~/xbot2_gui_client_x86_64/bin\n    ```\n3.  **Run the GUI Client:** Execute the client application.\n    ```bash\n    ./xbot2_gui\n    ```\n\n**What happens during this step?**\n\n* The `xbot2_gui` application (likely built from the `robot_monitoring` package) starts.\n* It attempts to connect to the `xbot2_gui_server` (launched in Step 3) over the network (e.g., `localhost:port`). The server address/port might be hardcoded, configurable via arguments, or discovered through ROS (less likely).\n* Once connected, it communicates with the server to:\n    * Receive status information about the xbot2 system (based on the states defined in the server config and the actual status of processes managed by `concert_launcher`).\n    * Display this information graphically.\n    * Allow user interaction (e.g., clicking buttons) which sends commands back to the GUI server. The server then translates these into actions (e.g., calling ROS services/topics or interacting with `concert_launcher`).\n\nThe GUI window should appear, showing the status of the launched system.\n\n## Component Roles \u0026 Interactions\n\n* **`kyon_launcher.bash`**:\n    * **Role:** Master script for initializing the core Kyon simulation system.\n    * **Interaction:** Sets up the environment, invokes `concert_launcher` with specific arguments (`sim`) and configuration (`launcher_config.yaml` via env var). Provides convenience commands (`status`, `kill`, `monitor`).\n* **`concert_launcher`**:\n    * **Role:** Process manager. Starts, stops, and monitors background processes based on a YAML configuration.\n    * **Interaction:** Reads `launcher_config.yaml`. Manages dependencies between processes (`roscore`, `rviz`, `xbot2_sim`). Executed by `kyon_launcher.bash`. Also potentially queried by `xbot2_gui_server` for process status.\n* **`kyon_config` (Package)**:\n    * **Role:** Provides essential configuration files (`*.yaml`) and launch scripts specific to the Kyon robot example. Centralizes setup parameters.\n    * **Interaction:** Supplies configuration to `xbot2-core` (`kyon_basic.yaml`), `concert_launcher` (`launcher_config.yaml`), and `xbot2_gui_server` (`gui_server_config_2.yaml`). Contains the `kyon_launcher.bash` script.\n* **`xbot2_gui_server`**:\n    * **Role:** Backend service for the GUI. Bridges the core system state (managed by `concert_launcher`/ROS) and the GUI client.\n    * **Interaction:** Reads its configuration (`gui_server_config_2.yaml`) and the `concert_launcher` configuration (`launcher_config.yaml`). Monitors/gathers information about processes started in Step 2. Listens for network connections from `xbot2_gui`.\n* **`xbot2_gui` (from `robot_monitoring` package)**:\n    * **Role:** Frontend graphical user interface. Displays system status and allows user interaction.\n    * **Interaction:** Connects to `xbot2_gui_server` over the network. Requests data and sends user commands back to the server.\n\n**Interaction Flow:**\n\n\nThe following diagram illustrates the typical interaction flow between the components during launch and operation:\n\n![xbot2 Launch Sequence Diagram](img/sequence_diagram_2.png)\n\n*(Brief textual summary if needed): A typical interaction flow involves the user interacting with `xbot2_gui`, which sends requests to `xbot2_gui_server`. The server queries the state of processes managed by `concert_launcher`  and returns the status to the GUI for display. Commands from the GUI are relayed by the server to `concert_launcher`.*\n\n## Process Management\n\nThe `kyon_launcher.bash` script wraps `concert_launcher` commands to manage the core/simulation processes started in Step 2:\n\n* **Check Status:** See the status of processes managed by this `concert_launcher` instance:\n    ```bash\n    ~/xbot2_ws/src/kyon_config/launcher/kyon_launcher.bash status\n    ```\n* **Monitor:** Attach an interactive monitoring console (if supported by `concert_launcher`):\n    ```bash\n    ~/xbot2_ws/src/kyon_config/launcher/kyon_launcher.bash monitor\n    ```\n* **Stop All Processes:** Terminate all processes managed by this `concert_launcher` instance:\n    ```bash\n    ~/xbot2_ws/src/kyon_config/launcher/kyon_launcher.bash kill\n    ```\n\n## Stopping the System\n\nFollow these steps to shut down the system cleanly:\n\n1.  **Close the GUI Client:** Close the `xbot2_gui` window or stop its process in Terminal 4 (usually `Ctrl+C`).\n2.  **Stop the GUI Server:** Stop the `xbot2_gui_server` process in Terminal 3 (usually `Ctrl+C`).\n3.  **Stop Core Server/Simulation:** Use the `kill` command provided by the launcher script in Terminal 2.\n    ```bash\n    ~/xbot2_ws/src/kyon_config/launcher/kyon_launcher.bash kill\n    ```\n    This instructs `concert_launcher` to terminate `roscore`, `rviz`, `xbot2_sim`, and any other managed processes gracefully.\n4.  **Stop the MuJoCo Simulation:** Return to Terminal 1 and stop the MuJoCo simulation (usually `Ctrl+C`).\n\n## GUI Interface Overview\n\n![xbot2 GUI Interface](img/xbot2_gui_interface.png)\n\nThe xbot2 GUI interface provides a unified control panel for managing and monitoring the robot system. After completing the four-step launch process, this interface appears, offering access to various system components:\n\n### Navigation Sidebar (Left)\n\nThe sidebar contains icons for different functional areas:\n- **Network**: Connection settings and status monitoring\n- **Process**: Process management (currently selected)\n- **Monitoring**: System diagnostics tools\n- **Plot**: Data visualization capabilities\n- **Joy**: Manual control interface\n- **Tuning**: Parameter adjustment tools\n\n### Operation Mode Section\n\nThis section controls the robot's high-level state.\n\n### Process Launcher Section\n\nThis panel displays the core processes that were launched via `concert_launcher`:\n\n- **roscore**: The ROS master node (running, indicated by play button)\n- **rviz**: Visualization tool (running, indicated by stop button)\n- **xbot2_sim**: The robot simulation (running, indicated by stop button)\n- **sim_all**: The process group containing all simulation components (running, indicated by play button)\n\nEach process has control elements:\n- Status indicator (play/stop button)\n- Settings icon (gear) for configuration\n- Dropdown menu (down arrow) for additional actions\n\nThe \"Custom command\" field allows entering manual commands to be executed through the system.\n\n### Plugin Launcher Section\n\nThis section manages the xbot2 plugins that provide specific robot functionalities:\n\n- **homing**: Plugin for joint initialization (ready to start)\n- **ros_control**: ROS control interface (running)\n- **ros_io**: ROS input/output communication plugin (running)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadvrhumanoids%2Frobot_monitoring","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fadvrhumanoids%2Frobot_monitoring","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadvrhumanoids%2Frobot_monitoring/lists"}