SuperAPI AI Directory

cloudapi2-sei-osd

Coding & development

View repository

Updated 11-12 16:17

About this skill

DJI Cloud API 2 SEI/OSD real-time telemetry data integration assistant

What this Skill does

Helps integrator developers correctly integrate DJI Cloud API 2's SEI (frame-level position data) and OSD (device telemetry data), covering both server-side FHSDK data retrieval + frontend map visualization.

Core value: The most concentrated pain point for integrators is "how to get accurate, sufficiently high-frequency position data corresponding to every frame of video". This Skill explains the What/Why/How of SEI/OSD thoroughly.

When to trigger

  • Users want to obtain frame-level position data (SEI)
  • Users want to obtain device telemetry data (OSD)
  • Users ask about the difference between SEI vs OSD, frequency, prerequisites
  • Users want to visualize the camera frustum, FOV, video projection on Cesium/map
  • Users want to integrate LiveModule、subscribeArSeiInfo、subscribeFovSeiInfo
  • Users encounter the problem "OSD frequency is too low to align with video"
  • Users ask about back-calculating latitude/longitude from pixels, frustum center point
  • Users ask about DRC OSD configuration (osd_frequency 1~30Hz)
  • Users ask which generation of devices/firmware supports SEI

Do not trigger: General device management (→ cloudapi2-device-management), frontend PaaS component integration (→ cloudapi2-frontend-component), general SDK rules (→ cloudapi2-sdk-core)。

Workflow

Step 1: Determine the scenario

用户要什么?
├── 帧级位置/相机姿态/AR/视锥 → SEI 路径
├── 设备状态/位置/电量/速度   → OSD 路径(MQTT or DRC)
├── 前端地图可视化(Cesium)  → 前端 Demo 路径
├── 位置数据选型(不确定哪个)→ 先讲三层对比
└── 遇到 SEI 取不到/解析失败  → 排障路径

Step 2: Explain the three layers of position data

The user must first understand the three-layer selection(from references/training-guide.md):

Channel Frequency Prerequisites Typical use
MQTT OSD(common name; on the Java SDK side it is actually DroneOsdModule 's WebSocket push) 0.5Hz (once every 2s, fixed) Device online + SDK configured with notificationServerAddress(WebSocket notification channel),it is not that you need to connect an MQTT client Device status panel, coarse trajectory
DRC OSD Default 3Hz, configurable 1~30Hz Requires establishing a DRC link Control feedback, medium-to-high frequency trajectory
SEI ~30fps (present in every frame) Requires stream pulling (WebRTC) Video + position fusion(AR, frustum, pixel back-calculation)

⚠️ "MQTT OSD" is an internal common name for the device→cloud reporting link(on the dock side, dji-cloud-access uses the MQTT signaling channel and a hardcoded 2000ms timer for reporting), but when integrators consume this data with the Java SDK, they go through drone.getDroneOsdModule().listenXxx(), and the push channel is WebSocket (depending on the SDK configuration's notificationServerAddress and setWebSocketAuthHeaders()), do not assume you need to connect MQTT yourself.

Decision flow:

  • Need to align with the video frame → use SEI
  • Need medium-to-high frequency position but not pulling the stream → DRC OSD (configure osd_frequency)
  • Only need device status → MQTT OSD
  • Do not try to raise MQTT OSD to high frequency to align with the video — this path does not work

Step 3: Read the corresponding reference

Scenario Reference Documentation
Technical Architecture (Complete Overview of SEI vs OSD) references/sei-osd-architecture.md
Server-side FHSDK Data Retrieval (Java) references/server-side-guide.md
Frontend Cesium Map Visualization Demo references/frontend-visualization.md
Common Integrator Questions and Capability Comparison references/faq-and-capability.md
Training Content (Concept Explanation) references/training-guide.md
Summary of Integrator Pain Points (Requirement Background) references/isv-pain-points.md

Step 4: Output by Path

SEI Path (Server-side)

When generating code, follow the complete lifecycle of references/server-side-guide.md :

[1] 初始化 SDK
[2] getDroneInstance(sn) → Drone
[3] 开直播:listenLiveAvailableRange → getLiveStream → LiveModule → start
[4] 订阅 SEI:live.subscribeArSeiInfo(cb) / subscribeFovSeiInfo(cb)
[5] 回调中处理 ArSeiInfo / FovSeiInfo
[6] 退订:live.unSubscribeArSeiInfo(id) / unSubscribeFovSeiInfo(id) + live.stop()

⚠️ openDroneSeiMessageSend(ar_info_switch:1) is not a Java SDK method; it is a switch command issued internally by the frontend PaaS component (uranus-cockpit-app) through the device shadow REST API, and is not the same thing as the Java SDK's subscribeArSeiInfo/subscribeFovSeiInfo subscription process.Whether pure Java SDK users also need to trigger this switch themselves, or whether it is already enabled by default when pulling the stream, has not been confirmed by official documentation—when encountering "subscription succeeds but SEI data is all zeros / no callback received," this is one of the directions to investigate, but do not write it into the code as a fixed Java SDK step.

Note: SEI does not depend on the DRC link.disconnectDrcLink only needs to be called when DRC OSD is used.

OSD Path (Server-side)

MQTT OSD(Java SDK 实为 WebSocket):drone.getDroneOsdModule().listenAircraftXxx(cb)
  前提:SDK 配置已设置 notificationServerAddress,且已调用 setWebSocketAuthHeaders() 注入鉴权头
  (不是"无需额外前提"——未配置会导致 WebSocket 握手失败/401,监听回调收不到数据)
DRC OSD:drone.getDrcModule().connectDrcLink(cb) → drone.getCameraControlModule().listenDrcCameraMeasureTarget(payload, cb)

Frontend Visualization Path

Refer to references/frontend-visualization.md, core architecture:

后端 WebSocket 推送 SEI/OSD JSON
    ↓
前端 state.ts (reactive)
    ↓
Cesium 渲染:飞机模型 + 相机三轴 + 视锥线框 + 落地四边形 + 视频贴地投影

Step 5: Troubleshooting

SEI Common Issues:

  • Cannot get SEI → Must use WebRTC direct push; RTSP/Agora cannot get it
  • Browser limitation → Only Chrome/Edge supported (createEncodedStreams Chromium proprietary)
  • SEI data all zeros → First confirm whether the stream is pulled successfully and whether the subscription callback is triggered;openDroneSeiMessageSend/ar_info_switch:1 is a frontend PaaS component interface, not a Java SDK troubleshooting method, so do not ask users to call it
  • Model differences → M10E/M3T use UTF8 JSON, M4D/M4T use binary protocol

Core Constraints (critical level)

  1. SEI must use WebRTC: RTSP on-demand playback, Agora stream pulling, and self-built streaming media cannot get i-frame SEI
  2. listen/subscribe must be paired with cancel/unSubscribe: All subscriptions return a listenId, which must be released on exit
  3. LiveModule prerequisite: Before subscribing to SEI, you must first getLiveStream + start successfully start live streaming
  4. DRC prerequisite: DRC OSD requires first connectDrcLink success
  5. null guard:getDroneInstance(sn) / getLiveStream(liveInfo) may all return null
  6. Do not pursue high-frequency MQTT OSD: The frequency is fixed at 0.5Hz and cannot be adjusted; for high frequency, use DRC or SEI
  7. Model adaptation: The SEI parsing protocol differs by model (M10E/M3T use UTF8 JSON, M4D/M4T use binary protocol); for specific fields, refer to official documentation/actual protocol parsing results—there is no evidence supporting a unified CAM_COEFFICIENT angle conversion coefficient, so do not fabricate this constant in the code

SEI Data Structure Quick Reference

ArSeiInfo (camera attitude + position; actual getters are camelCase, not field names)

Getter Meaning Unit
getCameraYaw() / getCameraPitch() / getCameraRoll() Camera Euler angles degrees
getCameraPosX() / getCameraPosY() / getCameraPosZ() Camera offset relative to takeoff point millimeters (mm), not meters
getAltitude() Height millimeters (mm)

⚠️ Official ArSeiInfo has no ground-projection latitude/longitude/altitude fields(does not exist gnd_lat/gnd_lng/gnd_alt such getters). If ground-projection coordinates are needed, the application layer must perform pixel back-calculation using camera attitude + altitude; the SDK does not provide this directly.

FovSeiInfo (field-of-view information)

⚠️ The official documentation does not provide FovSeiInfo an exact list of getter names; the field meanings below are for reference,before generating code you must verify the actual getter names with the IDE/javap, do not copy the placeholder forms below:

Field meaning Description
Sensor size Assumed unit μm, actual getter must be verified
Focal length Assumed unit μm, actual getter must be verified

DRC OSD (fast channel)

Field Meaning
latitude/longitude/altitude Aircraft position
attitude_head Aircraft heading
gimbal_pitch/roll/yaw Gimbal attitude
speed_x/y/z Speed
home_distance Distance to Home

Authoritative reference

references/ The 6 documents under cover the complete knowledge system for SEI/OSD integration:

  • Technical architecture, server-side API, front-end visualization Demo, integrator FAQ, training content, requirement background

Known limitations of the reference documents (note when generating code)

The following are known design trade-offs in the teaching Demo code in references/; AI should improve on them when generating production code:

  1. DeviceContext's listenId field lacks volatile(server-side-guide.md): arSeiListenId etc. are ordinary int, written by the SDK callback thread and read by the application thread. Production code should use volatile int or AtomicInteger to guarantee cross-thread visibility.

  2. Handling when the SDK callback error is null(server-side-guide.md): Some SDK callbacks pass null error on success. In the Demo, if (error != null && error.isSuccess()) does not store the result in this case. Production code should instead use if (error == null || error.isSuccess())。

  3. subscribeSlowOsd silently ignores subscription failures(server-side-guide.md): putListenId in id < 0 it only skips storage, with no logging. Production code should log a WARN message.

  4. Cesium private API _computeNearFarPlanes(frontend-visualization.md): The Demo uses underscore-prefixed internal methods to compute frustum corners. Production projects should pin the Cesium version or switch to the public API (FrustumGeometry the computeNearFarPlanes)。

Shared specification

This Skill's constraints.yaml contains only SEI/OSD domain-specific rules; for general SDK constraints see skills/_shared/constraints-common.yaml(must also be followed when generating code). For cross-Skill routing rules see skills/_shared/skill-routing.md. When user intent is found to fall under another Skill's responsibility, switch according to the handoff protocol. For output format see skills/_shared/output-format.md. References are lazily loaded on demand; do not read all references/ at once.