跳转到内容

详细的软件配置和系统设置指南。

┌─────────────────────────────────────────┐
│ 应用层 (Application Layer) │
│ ┌──────────┐ ┌──────────┐ │
│ │ Web控制台 │ │ 移动应用 │ │
│ └─────┬────┘ └────┬─────┘ │
├────────┼─────────────┼──────────────────┤
│ 服务层 (Service Layer) │
│ ┌─────▼──────────────▼─────┐ │
│ │ API Gateway │ │
│ └──────┬───────────┬─────────┘ │
│ ┌──────▼───┐ ┌────▼────┐ │
│ │任务管理 │ │数据服务 │ │
│ └──────────┘ └─────────┘ │
├─────────────────────────────────────────┤
│ 核心层 (Core Layer) │
│ ┌──────────┐ ┌──────────┐ │
│ │导航控制 │ │传感器融合 │ │
│ └──────────┘ └──────────┘ │
├─────────────────────────────────────────┤
│ 驱动层 (Driver Layer) │
│ ┌──────────┐ ┌──────────┐ │
│ │硬件驱动 │ │通信驱动 │ │
│ └──────────┘ └──────────┘ │
└─────────────────────────────────────────┘

位置: ~/.jhusv/config.yaml

# 系统基础配置
system:
name: "my-usv"
version: "1.0.0"
log_level: "INFO" # DEBUG, INFO, WARNING, ERROR
data_path: "~/jhusv/data"
# 网络配置
network:
api:
host: "0.0.0.0"
port: 8080
ssl: false
websocket:
port: 8081
max_connections: 10
mqtt:
broker: "mqtt.jhusv.com"
port: 1883
use_tls: true
# 数据库配置
database:
type: "sqlite" # sqlite, postgresql, mysql
path: "~/jhusv/data/db.sqlite"
# host: "localhost" # for postgresql/mysql
# port: 5432
# username: "jhusv"
# password: "password"
# 日志配置
logging:
file: "~/jhusv/logs/system.log"
max_size: "100MB"
backup_count: 10
format: "%(asctime)s - %(name)s - %(levelname)s - %(message)s"

位置: ~/.jhusv/devices/[device_id].yaml

device:
id: "USV-2024-001"
model: "JH-USV-300"
name: "海洋勘探者1号"
# 硬件规格
specs:
length: 3.0 # 米
width: 1.2
max_speed: 10 # 节
max_payload: 50 # kg
battery_capacity: 20000 # mAh
# 导航配置
navigation:
mode: "auto" # auto, manual, waypoint
gps:
type: "RTK" # Standard, RTK
update_rate: 10 # Hz
min_satellites: 6
imu:
update_rate: 200 # Hz
calibration_interval: 86400 # 秒
control:
pid_p: 1.0
pid_i: 0.1
pid_d: 0.05
max_turn_rate: 30 # 度/秒
# 传感器配置
sensors:
water_quality:
enabled: true
sample_rate: 1 # Hz
parameters: ["ph", "do", "temp", "conductivity"]
camera:
enabled: true
resolution: [1920, 1080]
fps: 30
encoding: "h264"
sonar:
enabled: false
range: 100 # 米
resolution: 0.1 # 米
# 安全配置
safety:
geofence:
enabled: true
type: "polygon" # polygon, circle
coordinates:
- [31.2304, 121.4737]
- [31.2354, 121.4787]
- [31.2404, 121.4837]
- [31.2354, 121.4887]
limits:
max_distance: 5000 # 米
max_depth: 50 # 米 (如适用)
min_battery: 20 # %
emergency:
low_battery_action: "return_home"
lost_connection_timeout: 60 # 秒
lost_connection_action: "hold_position"
Terminal window
jhusv web start

访问: http://localhost:8080

  1. 实时监控

    • 地图显示
    • 实时数据
    • 视频流
  2. 任务管理

    • 创建任务
    • 任务调度
    • 历史记录
  3. 数据分析

    • 数据可视化
    • 报表生成
    • 数据导出
  4. 系统设置

    • 设备管理
    • 用户管理
    • 系统配置

配置文件: ~/.jhusv/web/config.json

{
"theme": {
"primaryColor": "#00D9FF",
"darkMode": true,
"language": "zh"
},
"map": {
"provider": "google",
"defaultZoom": 15,
"defaultCenter": [31.2304, 121.4737]
},
"dashboard": {
"refreshInterval": 1000,
"widgets": [
"map",
"status",
"sensors",
"battery"
]
}
}

端点: http://localhost:8080/api/v1

认证配置:

api:
authentication:
type: "jwt" # jwt, basic, apikey
secret: "your-secret-key"
expiration: 86400 # 秒
rate_limit:
enabled: true
requests_per_minute: 60

端点: ws://localhost:8081

websocket:
authentication: true
heartbeat_interval: 30 # 秒
max_message_size: 1048576 # 字节
storage:
local:
path: "~/jhusv/data"
# 数据保留策略
retention:
logs: 30 # 天
telemetry: 90
sensor_data: 180
videos: 30
# 自动清理
auto_cleanup: true
cleanup_schedule: "0 2 * * *" # 每天凌晨2点
storage:
cloud:
enabled: true
provider: "aws" # aws, aliyun, tencent
aws:
region: "us-west-2"
bucket: "jhusv-data"
access_key: "YOUR_ACCESS_KEY"
secret_key: "YOUR_SECRET_KEY"
sync:
auto: true
interval: 3600 # 秒
compress: true
Terminal window
jhusv plugin install <plugin-name>

位置: ~/.jhusv/plugins/[plugin-name]/config.yaml

示例 - 自动避障插件:

plugin:
name: "auto-avoidance"
version: "1.0.0"
enabled: true
settings:
detection_range: 30 # 米
reaction_time: 2 # 秒
avoidance_distance: 15 # 米
algorithm: "potential_field"
Terminal window
jhusv firmware check
Terminal window
jhusv firmware update

:::warning 注意 固件更新期间请勿断开连接或关闭电源。 :::

Terminal window
jhusv firmware rollback
Terminal window
# 备份所有配置
jhusv backup create --output ~/backup.tar.gz
# 仅备份特定配置
jhusv backup create --config --output ~/config-backup.tar.gz
Terminal window
jhusv backup restore ~/backup.tar.gz
backup:
auto:
enabled: true
schedule: "0 3 * * *" # 每天凌晨3点
destination: "~/jhusv/backups"
retention: 7 # 保留天数
performance:
# CPU 使用
max_cpu_percent: 80
# 内存使用
max_memory_mb: 2048
# 网络优化
network:
tcp_nodelay: true
send_buffer: 524288
recv_buffer: 524288
# 日志优化
logging:
async: true
buffer_size: 10000
database:
connection_pool:
min_size: 2
max_size: 10
timeout: 30
query:
cache_enabled: true
cache_size: 1000
security:
users:
admin:
password_hash: "..."
role: "admin"
operator:
password_hash: "..."
role: "operator"
password_policy:
min_length: 8
require_special_char: true
require_number: true
expiration_days: 90
ssl:
enabled: true
cert_file: "/path/to/cert.pem"
key_file: "/path/to/key.pem"
ca_file: "/path/to/ca.pem"