属性上报
<p>以下是无人机属性上报的详细文档描述:</p>
<h3>1. 功能描述</h3>
<p>无人机通过 WebSocket 向服务器上报其当前的属性信息,例如电池电量、飞行高度、GPS 坐标等。这些属性信息将根据物模型定义的格式进行上报。</p>
<h3>2. 无人机属性上报的消息结构</h3>
<p>以下是无人机属性上报的消息结构示例,采用 JSON 格式:</p>
<pre><code class="language-json">{
&quot;bid&quot;: &quot;17472895486572366&quot;, // 响应某次指令的标识符(业务ID)
&quot;data&quot;: {
&quot;properties&quot;: {
&quot;alt&quot;: 0.0, // 相对高度 (单位: 米)
&quot;asl&quot;: 0.0, // 海拔高度 (单位: 米)
&quot;armed&quot;: false, // 是否已解锁(飞控是否已解锁)
&quot;battery_current&quot;: 0.0, // 当前电流 (单位: 安)
&quot;battery_remaining&quot;: 0, // 电池剩余百分比 (单位: %)
&quot;battery_voltage&quot;: 0.0, // 当前电压 (单位: 伏)
&quot;cloud_status&quot;: false, // 是否连接至云端
&quot;fly_distance&quot;: 0.0, // 飞行距离 (单位: 米)
&quot;fly_time&quot;: 0, // 飞行时间 (单位: 毫秒)
&quot;front_avoid_distance&quot;: 0.0, // 前方避障距离 (单位: 米)
&quot;front_avoid_switch&quot;: false, // 前方避障是否启用
&quot;gimbal_mode&quot;: 2, // 云台控制模式 (0: Free, 1: FPV, 2: Yaw Follow 等)
&quot;gimbal_pitch&quot;: 0.0, // 云台 Pitch 角度 (单位: 度)
&quot;gimbal_roll&quot;: 0.0, // 云台 Roll 角度 (单位: 度)
&quot;gimbal_yaw&quot;: 0.0, // 云台 Yaw 角度 (单位: 度)
&quot;gohome_altitude&quot;: 0.0, // 返航高度设置值 (单位: 米)
&quot;hfov&quot;: 0.0, // 水平视场角 (单位: 度)
&quot;home_latitude&quot;: 0.0, // 返航点纬度
&quot;home_longitude&quot;: 0.0, // 返航点经度
&quot;horizontal_speed&quot;: 0.0, // 水平速度 (单位: 米/秒)
&quot;landed_state&quot;: false, // 是否处于降落状态
&quot;latitude&quot;: 0.0, // 当前纬度
&quot;lens_type&quot;: 0, // 镜头类型 (0: 普通, 1: 红外, 2: 变焦等)
&quot;longitude&quot;: 0.0, // 当前经度
&quot;lost_action&quot;: 0, // 失联动作 (0: 悬停, 1: 降落, 2: 返航)
&quot;main_current&quot;: 0.0, // 主电机电流 (单位: 安)
&quot;main_power&quot;: 0.0, // 主电机功率 (单位: 瓦)
&quot;main_rpm&quot;: 0, // 主电机转速 (单位: RPM)
&quot;main_temp&quot;: 0.0, // 主电机温度 (单位: ℃)
&quot;flight_mode&quot;: 1, // 飞行状态
&quot;params&quot;: {
&quot;avoid_enable&quot;: false, // 是否启用避障功能
&quot;avoid_margin&quot;: 0.0, // 避障边距 (单位: 米)
&quot;batt2_fs_low_act&quot;: 0, // 电池2低电压触发动作
&quot;batt2_low_volt&quot;: 0.0, // 电池2低电压阈值
&quot;batt_fs_low_act&quot;: 0, // 电池低电触发动作
&quot;batt_low_volt&quot;: 0.0, // 电池低电压阈值
&quot;fence_enable&quot;: false, // 是否启用围栏限制
&quot;fence_radius&quot;: 0.0, // 围栏半径 (单位: 米)
&quot;fs_gcs_enable&quot;: false, // 是否启用 GCS 通信丢失 failsafe
&quot;fs_options&quot;: 0, // failsafe 配置选项
&quot;gps_bds_status&quot;: false, // GPS/北斗是否正常
&quot;gps_type&quot;: 0, // GPS 类型 (0: 无, 1: GPS, 2: 北斗等)
&quot;product_id&quot;: 0, // 产品型号 ID
&quot;prx_type&quot;: 0, // 避障雷达类型
&quot;psc_posxy_p&quot;: 0.0, // 位置控制 PID 参数 P
&quot;rtl_alt&quot;: 0.0, // 返航高度 (单位: 米)
&quot;rtl_alt_final&quot;: 0.0, // 最终返航高度 (单位: 米)
&quot;sta_xy_amax&quot;: 0.0, // XY 最大加速度 (单位: m/s²)
&quot;sta_xy_vmax&quot;: 0.0, // XY 最大速度 (单位: m/s)
&quot;wpnav_accel&quot;: 0.0, // 航点加速度 (单位: m/s²)
&quot;wpnav_speed&quot;: 0.0, // 航点飞行速度 (单位: m/s)
&quot;wpnav_speed_dn&quot;: 0.0, // 下降速度 (单位: m/s)
&quot;wpnav_speed_up&quot;: 0.0 // 上升速度 (单位: m/s)
},
&quot;imu1&quot;: {
&quot;accel_norm&quot;: 1001.0, // IMU1 加速度模值 (单位: m/s²)
&quot;gyro_norm&quot;: 3.464101552963257, // IMU1 陀螺仪模值 (单位: rad/s)
&quot;mag_norm&quot;: 453.83477783203125 // IMU1 磁力计模值 (单位: μT)
},
&quot;imu2&quot;: {
&quot;accel_norm&quot;: 1001.0, // IMU2 加速度模值 (单位: m/s²)
&quot;gyro_norm&quot;: 3.464101552963257, // IMU2 陀螺仪模值 (单位: rad/s)
&quot;mag_norm&quot;: 453.83477783203125 // IMU2 磁力计模值 (单位: μT)
},
&quot;imu3&quot;: {
&quot;accel_norm&quot;: 1001.0, // IMU3 加速度模值 (单位: m/s²)
&quot;gyro_norm&quot;: 3.464101552963257, // IMU3 陀螺仪模值 (单位: rad/s)
&quot;mag_norm&quot;: 453.83477783203125 // IMU3 磁力计模值 (单位: μT)
},
&quot;compass_variance&quot;: 0.0, // 磁罗盘方差
&quot;ekf_variance&quot;: 0.0, // EKF 方差
&quot;vibration&quot;: 0.0, // 振动值
&quot;pitch&quot;: 0.0, // 飞行器 Pitch 姿态角 (单位: 度)
&quot;roll&quot;: 0.0, // 飞行器 Roll 姿态角 (单位: 度)
&quot;satellites_visible&quot;: 0, // 当前可见卫星数量
&quot;signal_strength&quot;: 0, // 信号强度 (0–5)
&quot;sn&quot;: &quot;000000&quot;, // 飞行器序列号
&quot;tail_current&quot;: 0.0, // 尾电机电流 (单位: 安)
&quot;tail_power&quot;: 0.0, // 尾电机功率 (单位: 瓦)
&quot;tail_rpm&quot;: 0, // 尾电机转速 (单位: RPM)
&quot;tail_temp&quot;: 0.0, // 尾电机温度 (单位: ℃)
&quot;vertical_speed&quot;: 0.0, // 垂直速度 (单位: 米/秒)
&quot;vfov&quot;: 0.0, // 垂直视场角 (单位: 度)
&quot;video_source&quot;: 2, // 当前视频源 (0: FPV, 1: 云台, 2: 其他)
&quot;yaw&quot;: 0.0, // 飞行器航向角 Yaw (单位: 度)
&quot;zoom_factor&quot;: 0.0 // 当前变焦倍数
}
},
&quot;method&quot;: &quot;reportProperties&quot;, // 上报类型:属性上报
&quot;tid&quot;: &quot;1747289548657-6957&quot;, // 请求的唯一事务 ID
&quot;timestamp&quot;: 1747289548657 // 时间戳(单位: 毫秒)
}</code></pre>
<p>以下是 flight_mode 枚举的详细定义说明:</p>
<table>
<thead>
<tr>
<th>枚举值 (Value)</th>
<th>枚举名称 (Enum Name)</th>
<th>描述 (Description)</th>
</tr>
</thead>
<tbody>
<tr>
<td>0</td>
<td>NotConnected</td>
<td>飞行器未连接</td>
</tr>
<tr>
<td>1</td>
<td>Standby</td>
<td>起飞准备完成</td>
</tr>
<tr>
<td>2</td>
<td>Manual</td>
<td>手动飞行</td>
</tr>
<tr>
<td>3</td>
<td>AltitudeHold</td>
<td>高度保持</td>
</tr>
<tr>
<td>4</td>
<td>PositionHold</td>
<td>定点悬停</td>
</tr>
<tr>
<td>5</td>
<td>AutoMission</td>
<td>航线飞行</td>
</tr>
<tr>
<td>6</td>
<td>RTL</td>
<td>返航</td>
</tr>
<tr>
<td>7</td>
<td>Land</td>
<td>降落</td>
</tr>
<tr>
<td>8</td>
<td>Failsafe</td>
<td>失联</td>
</tr>
<tr>
<td>17</td>
<td>Brake</td>
<td>急停</td>
</tr>
<tr>
<td>99</td>
<td>Unknown</td>
<td>未知模式</td>
</tr>
</tbody>
</table>