From bac0d160262ba6a4a8c6364695fd1c1a1f37cc39 Mon Sep 17 00:00:00 2001 From: stz Date: Tue, 9 Jun 2026 19:40:47 +0800 Subject: [PATCH] chore(config): make sample configs Keystone templates - Render recorder WebSocket RPC URLs from register context - Render transfer identity and fleet WebSocket URL from register context - Document using the ROS recorder and transfer samples as Keystone templates --- apps/axon_config/README.md | 10 ++++++++++ apps/axon_recorder/config/README.md | 18 ++++++++++++++---- .../config/default_config_ros1.yaml | 14 +++++++++----- .../config/default_config_ros2.yaml | 14 +++++++++----- apps/axon_transfer/README.md | 4 ++++ apps/axon_transfer/config/transfer_config.yaml | 10 +++++++--- 6 files changed, 53 insertions(+), 17 deletions(-) diff --git a/apps/axon_config/README.md b/apps/axon_config/README.md index 2745a0ee..feea893e 100644 --- a/apps/axon_config/README.md +++ b/apps/axon_config/README.md @@ -75,6 +75,16 @@ Nested JSON values can also be addressed with dotted names, for example `{{ endpoints.transfer_ws_url }}`. Unknown placeholders fail the command and leave existing rendered configs unchanged. +The repository samples are Keystone-ready starting points: + +- `apps/axon_recorder/config/default_config_ros1.yaml` -> Keystone `recorder.yaml` +- `apps/axon_recorder/config/default_config_ros2.yaml` -> Keystone `recorder.yaml` +- `apps/axon_transfer/config/transfer_config.yaml` -> Keystone `transfer.yaml` + +For a new robot type, edit the recorder `subscriptions` list for the ROS profile and adjust +the transfer S3 destination if needed. The registration identity and WebSocket URLs are +filled by `axon-config` after the device registers. + ## Refreshing Configs Use `refresh` after a device has already been registered and `/etc/axon/device.json` diff --git a/apps/axon_recorder/config/README.md b/apps/axon_recorder/config/README.md index 5e73451c..759ea52e 100644 --- a/apps/axon_recorder/config/README.md +++ b/apps/axon_recorder/config/README.md @@ -1,24 +1,34 @@ # Axon Recorder Configuration Files -This directory contains configuration files for the Axon recorder. +This directory contains configuration files for the Axon recorder. The ROS1 and ROS2 +samples are also Keystone-ready `recorder.yaml` templates for `axon_config register`. ## Configuration Files ### ROS1 Configuration - **[default_config_ros1.yaml](default_config_ros1.yaml)** - Default configuration for ROS1 (Noetic) - Sets `profile: ros1` + - Sets `rpc.mode: ws_client` and fills the RPC URL during registration - Use with ROS1 plugin: `libaxon_ros1_plugin.so` ### ROS2 Configuration - **[default_config_ros2.yaml](default_config_ros2.yaml)** - Default configuration for ROS2 (Humble/Jazzy/Rolling) - Sets `profile: ros2` + - Sets `rpc.mode: ws_client` and fills the RPC URL during registration - Use with ROS2 plugin: `libaxon_ros2_plugin.so` ## Usage -### Method 1: Plugin path in config file (Recommended) +### Method 1: Keystone Template Workflow -Set the `plugin.path` in the config file: +Edit the `subscriptions` list for the robot type, then upload the file to Keystone as +`recorder.yaml`. `axon_config register` renders the WebSocket RPC URL and writes the final +config to `/etc/axon/recorder.yaml`. + +### Method 2: Plugin path in config file + +Set the `plugin.path` in the config file. For local-only runs without Keystone, also change +`rpc.mode` to `http_server` or replace `rpc.ws_client.url` with a concrete WebSocket URL: ```bash # ROS1 @@ -28,7 +38,7 @@ Set the `plugin.path` in the config file: ./axon_recorder --config config/default_config_ros2.yaml ``` -### Method 2: Plugin path via command line +### Method 3: Plugin path via command line ```bash # ROS1 diff --git a/apps/axon_recorder/config/default_config_ros1.yaml b/apps/axon_recorder/config/default_config_ros1.yaml index 3a252d41..a9552bf2 100644 --- a/apps/axon_recorder/config/default_config_ros1.yaml +++ b/apps/axon_recorder/config/default_config_ros1.yaml @@ -1,5 +1,8 @@ # Axon Recorder Configuration for ROS1 (Noetic) -# Usage: ./axon_recorder --config config/default_config_ros1.yaml +# This sample is also suitable as a Keystone recorder.yaml template. After +# axon_config register renders it, the recorder connects back to Keystone in +# WebSocket RPC client mode. For local-only panel workflows, change rpc.mode +# to http_server and use a concrete rpc.ws_client.url when needed. # ============================================================================ # Plugin Configuration @@ -44,6 +47,7 @@ dataset: # ============================================================================ # Subscription Configuration # ============================================================================ +# Edit this section for each robot type before uploading the template to Keystone. # High-frequency subscriptions (IMU, camera): Use larger batches (100-5000) # Low-frequency subscriptions (status, diagnostics): Use small batches (1-10) # Control signals: Use batch_size=1 for immediate persistence @@ -196,16 +200,16 @@ http_server: # RPC Mode Configuration # ============================================================================ # Unified configuration for HTTP server and WebSocket client modes -# mode: "http_server" (default) or "ws_client" +# mode: "ws_client" for Keystone-rendered templates, or "http_server" for local panel control # - http_server: Start HTTP RPC server on local port (for axon_panel) # - ws_client: Connect as WebSocket client to keystone server (for fleet management) rpc: - mode: http_server + mode: ws_client # WebSocket client configuration (only used when mode: ws_client) ws_client: - # WebSocket server URL (e.g., ws://keystone:8090/rpc or wss://keystone:8090/rpc) - url: ws://localhost:8090/rpc + # Filled by axon_config register from the Keystone registration context. + url: "{{ recorder_rpc_url }}" # Optional JWT token for authentication during handshake auth_token: "" diff --git a/apps/axon_recorder/config/default_config_ros2.yaml b/apps/axon_recorder/config/default_config_ros2.yaml index d0f4b1e5..9414c749 100644 --- a/apps/axon_recorder/config/default_config_ros2.yaml +++ b/apps/axon_recorder/config/default_config_ros2.yaml @@ -1,5 +1,8 @@ # Axon Recorder Configuration for ROS2 (Humble/Jazzy/Rolling) -# Usage: ./axon_recorder --config config/default_config_ros2.yaml +# This sample is also suitable as a Keystone recorder.yaml template. After +# axon_config register renders it, the recorder connects back to Keystone in +# WebSocket RPC client mode. For local-only panel workflows, change rpc.mode +# to http_server and use a concrete rpc.ws_client.url when needed. # ============================================================================ # Plugin Configuration @@ -46,6 +49,7 @@ dataset: # ============================================================================ # Subscription Configuration # ============================================================================ +# Edit this section for each robot type before uploading the template to Keystone. # High-frequency subscriptions (IMU, camera): Use larger batches (100-5000) # Low-frequency subscriptions (status, diagnostics): Use small batches (1-10) # Control signals: Use batch_size=1 for immediate persistence @@ -223,16 +227,16 @@ http_server: # RPC Mode Configuration # ============================================================================ # Unified configuration for HTTP server and WebSocket client modes -# mode: "http_server" (default) or "ws_client" +# mode: "ws_client" for Keystone-rendered templates, or "http_server" for local panel control # - http_server: Start HTTP RPC server on local port (for axon_panel) # - ws_client: Connect as WebSocket client to keystone server (for fleet management) rpc: - mode: http_server + mode: ws_client # WebSocket client configuration (only used when mode: ws_client) ws_client: - # WebSocket server URL (e.g., ws://keystone:8090/rpc or wss://keystone:8090/rpc) - url: ws://localhost:8090/rpc + # Filled by axon_config register from the Keystone registration context. + url: "{{ recorder_rpc_url }}" # Optional JWT token for authentication during handshake auth_token: "" diff --git a/apps/axon_transfer/README.md b/apps/axon_transfer/README.md index fc358133..56ee8cf1 100644 --- a/apps/axon_transfer/README.md +++ b/apps/axon_transfer/README.md @@ -4,6 +4,10 @@ recording directory, persists upload state in SQLite, uploads MCAP files to S3-compatible storage, and reports operator-facing status over the fleet WebSocket. +`config/transfer_config.yaml` is also a Keystone-ready `transfer.yaml` template. `axon_config` +renders the device identity and fleet WebSocket base URL after registration; edit the S3 destination +and scanner settings per deployment before uploading it to Keystone. + ## Completion Contract The scanner supports two completion modes: diff --git a/apps/axon_transfer/config/transfer_config.yaml b/apps/axon_transfer/config/transfer_config.yaml index c3d3b135..cb6eb137 100644 --- a/apps/axon_transfer/config/transfer_config.yaml +++ b/apps/axon_transfer/config/transfer_config.yaml @@ -1,13 +1,17 @@ # Axon Transfer Configuration # S3 transfer daemon for fleet management +# This sample is suitable as a Keystone transfer.yaml template. axon_config +# register renders the identity and WebSocket fields from the registration +# context before writing /etc/axon/transfer.yaml. # Device identification -device_id: "robot_01" -factory_id: "factory_a" +device_id: "{{ device_id }}" +factory_id: "{{ factory_id }}" # WebSocket client configuration ws: - url: "ws://fleet.factory-a.local:8090/transfer" + # axon-transfer appends / to this base URL at runtime. + url: "{{ transfer_ws_url }}" ping_interval_ms: 30000 ping_timeout_ms: 10000 reconnect: