sensor-fusion

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

sensor-fusion

sensor-fusion

Purpose

用途

This skill enables the fusion of IoT sensor data using algorithms like Kalman filters to enhance accuracy and reliability in real-time applications. It processes inputs from multiple sensors, applies fusion techniques, and outputs refined data streams for downstream use.
该技能支持使用Kalman滤波器等算法融合IoT传感器数据,以提升实时应用中的数据准确性和可靠性。它处理来自多个传感器的输入,应用融合技术,并输出经过优化的数据流供下游系统使用。

When to Use

使用场景

Use this skill when dealing with noisy or inconsistent sensor data, such as in autonomous vehicles for obstacle detection, smart home systems for environmental monitoring, or industrial IoT for predictive maintenance. Apply it in scenarios requiring real-time data smoothing, like merging GPS and accelerometer data, or when sensor redundancy improves decision-making.
当您处理存在噪声或不一致的传感器数据时,可使用该技能,例如自动驾驶汽车的障碍物检测、智能家居系统的环境监测,或工业IoT的预测性维护场景。适用于需要实时数据平滑的场景,比如合并GPS和加速度计数据,或者传感器冗余有助于提升决策质量的场景。

Key Capabilities

核心能力

  • Implements Kalman and Extended Kalman filters for state estimation and noise reduction.
  • Supports data fusion from up to 10 sensor types (e.g., temperature, humidity, motion) via JSON input streams.
  • Handles real-time processing with configurable update rates (e.g., 10-100 Hz).
  • Provides output in standardized formats like CSV or JSON for easy integration.
  • Includes adaptive thresholding to detect and ignore faulty sensor readings.
  • Offers visualization hooks for debugging fused data outputs.
  • 实现Kalman滤波器和扩展Kalman滤波器,用于状态估计和噪声降低。
  • 支持通过JSON输入流融合多达10种类型的传感器数据(如温度、湿度、运动传感器)。
  • 支持可配置更新速率(如10-100 Hz)的实时处理。
  • 提供CSV或JSON等标准化格式的输出,便于集成。
  • 包含自适应阈值功能,可检测并忽略故障传感器读数。
  • 提供可视化钩子,用于调试融合后的数据输出。

Usage Patterns

使用模式

To use this skill, first set the environment variable for authentication:
export OPENCLAW_API_KEY=your_api_key
. Then, invoke via CLI or API, providing sensor configurations in a JSON file. For CLI, pipe sensor data directly; for API, send POST requests with data payloads. Always specify the fusion algorithm and sensors in the command or request body to avoid defaults.
Example pattern 1: CLI command for fusing two sensors:
bash
claw sensor-fusion fuse --sensors temp,humidity --algorithm kalman --config config.json
Example pattern 2: API call in a script:
python
import requests
response = requests.post('https://api.openclaw.io/sensor-fusion', headers={'Authorization': f'Bearer {os.environ["OPENCLAW_API_KEY"]}'}, json={'sensors': ['temp', 'humidity'], 'algorithm': 'kalman'})
print(response.json())
要使用该技能,首先设置身份验证的环境变量:
export OPENCLAW_API_KEY=your_api_key
。然后通过CLI或API调用,在JSON文件中提供传感器配置。对于CLI,可直接管道传输传感器数据;对于API,发送包含数据载荷的POST请求。请务必在命令或请求体中指定融合算法和传感器类型,以避免使用默认值。
示例模式1:融合两个传感器的CLI命令:
bash
claw sensor-fusion fuse --sensors temp,humidity --algorithm kalman --config config.json
示例模式2:脚本中的API调用:
python
import requests
response = requests.post('https://api.openclaw.io/sensor-fusion', headers={'Authorization': f'Bearer {os.environ["OPENCLAW_API_KEY"]}'}, json={'sensors': ['temp', 'humidity'], 'algorithm': 'kalman'})
print(response.json())

Common Commands/API

常见命令/API

  • CLI:
    claw sensor-fusion fuse --sensors <list> --algorithm <name> --rate <Hz>
    : Fuses specified sensors with the given algorithm and update rate (e.g.,
    --rate 50
    for 50 Hz).
  • CLI:
    claw sensor-fusion simulate --data <file> --output results.csv
    : Simulates fusion on a sample data file and saves output.
  • API Endpoint: POST /api/sensor-fusion: Requires JSON body like
    {"sensors": ["temp", "pressure"], "algorithm": "ekf", "config": {"noise_variance": 0.01}}
    ; returns fused data array.
  • API Endpoint: GET /api/sensor-fusion/status: Checks fusion job status using query param
    job_id
    , e.g.,
    GET /api/sensor-fusion/status?job_id=123
    .
  • Config Format: JSON, e.g.,
    {"sensors": [{"name": "temp", "type": "analog", "weight": 0.5}], "algorithm": {"type": "kalman", "parameters": {"Q": 0.01, "R": 0.1}}}
    . Use
    $OPENCLAW_API_KEY
    in headers for all API calls.
  • CLI:
    claw sensor-fusion fuse --sensors <list> --algorithm <name> --rate <Hz>
    : 使用指定算法和更新速率融合指定传感器数据(例如
    --rate 50
    表示50 Hz)。
  • CLI:
    claw sensor-fusion simulate --data <file> --output results.csv
    : 对样本数据文件进行融合模拟,并将结果保存为文件。
  • API Endpoint: POST /api/sensor-fusion: 需要类似
    {"sensors": ["temp", "pressure"], "algorithm": "ekf", "config": {"noise_variance": 0.01}}
    的JSON请求体;返回融合后的数据数组。
  • API Endpoint: GET /api/sensor-fusion/status: 使用查询参数
    job_id
    检查融合任务状态,例如
    GET /api/sensor-fusion/status?job_id=123
  • Config Format: JSON, e.g.,
    {"sensors": [{"name": "temp", "type": "analog", "weight": 0.5}], "algorithm": {"type": "kalman", "parameters": {"Q": 0.01, "R": 0.1}}}
    . 所有API调用均需在请求头中使用
    $OPENCLAW_API_KEY

Integration Notes

集成说明

Integrate by importing the OpenClaw SDK in your project:
pip install openclaw
. Reference this skill in code with
from openclaw.skills import sensor_fusion
. Ensure sensor data is formatted as arrays of {timestamp, value} objects. For multi-skill workflows, chain with other IoT skills by passing outputs via shared variables, e.g., set
output_fused_data
as input for a downstream analytics skill. Handle dependencies like NumPy for matrix operations. Test integrations in a sandbox environment first, using mock sensor data to verify fusion accuracy.
通过在项目中导入OpenClaw SDK进行集成:
pip install openclaw
。在代码中通过
from openclaw.skills import sensor_fusion
引用该技能。确保传感器数据格式为包含{timestamp, value}对象的数组。在多技能工作流中,可通过共享变量将该技能的输出传递给其他IoT技能,例如将
output_fused_data
设置为下游分析技能的输入。处理NumPy等依赖项以支持矩阵运算。首先在沙箱环境中测试集成,使用模拟传感器数据验证融合准确性。

Error Handling

错误处理

Check for errors by parsing response codes: HTTP 400 for invalid sensor lists, 401 for authentication failures with
$OPENCLAW_API_KEY
. In CLI, errors like "Sensor not found" appear if --sensors flag is mismatched; use
--verbose
to debug. Handle algorithm-specific errors, e.g., if Kalman filter diverges, catch with try-except in code: ```python try: fused_data = sensor_fusion.fuse(data, algorithm='kalman') except ValueError as e: print(f"Error: {e} - Check sensor data format")
Implement
undefined
通过解析响应代码检查错误:HTTP 400表示传感器列表无效,401表示
$OPENCLAW_API_KEY
身份验证失败。在CLI中,如果
--sensors
参数不匹配,会出现“Sensor not found”等错误;使用
--verbose
参数进行调试。处理算法特定的错误,例如当Kalman滤波器发散时,在代码中使用try-except捕获:```python try: fused_data = sensor_fusion.fuse(data, algorithm='kalman') except ValueError as e: print(f"Error: {e} - Check sensor data format")
undefined

Graph Relationships

关联关系

  • Related to: iot-cluster (parent cluster for shared IoT functionalities)
  • Connected to: data-processing (for preprocessing sensor inputs)
  • Links with: machine-learning (for advanced algorithm training on fused data)
  • 所属集群:iot-cluster(共享IoT功能的父集群)
  • 关联技能:data-processing(用于预处理传感器输入)
  • 关联技能:machine-learning(用于基于融合数据的高级算法训练)