自訂訊息 Schema
RIVO 允許您透過 JSON Schema 擴充 API 介面。這讓機器人能夠下傳自訂格式的數據,而無需修改伺服器程式碼。
7.1 Schema 目錄結構
所有的 Schema 檔案都存放在 custom_msg/ 目錄下。清單檔案(Manifest)決定了哪些 Schema 會被載入。
custom_msg/
├── _manifest.txt # 啟用的 Schema 清單
├── control_input.json
└── sensor_reading.json # 您自訂的 Schema
7.2 清單檔案 (Manifest)
_manifest.txt 範例:
# 內建
control_input.json
# 自訂
sensor_reading.json
7.3 新增 Schema
- 建立一個 JSON 檔案(符合 JSON Schema Draft-07 格式)。
- 將檔案名稱新增至
_manifest.txt中。 - 重啟 RIVO Server。
新的 API 終端將自動對應至 /api/v1/robots/{id}/<schema_id>。