NOTE This article is Machine-Translated. If you have any questions about this article, please send an E-mail to DJI, we will correct it in time. DJI appreciates your support and attention.
In order to improve the safety of applications when controlling drones perform tasks, OSDK provides data broadcasting and data subscription functions. The application with broadcasting functions could broadcasting the information in real-time.The application with data subscription functions can obtain the data generated by the sensors on the drone and the flight status of the drone in real-time .
According to the actual flight status of the drone, various components and third-party sensors will generate a large amount of data information in real-time and pushed to other modules by the drone. The application with subscription could record the data user need.
Table1 Shows the topic that the data could be subscribed from the drone.
Table1. The Topic On The Drone
Item | Topic | Frequency (Hz) |
---|---|---|
Basic Content | Gesture Guaternion | 200 |
Hardware Sync | 400 | |
Home Point and Status | 50 | |
Remote Controller | 50 | |
Drone's Status | Flight Status | 50 |
Flight Mode | 50 | |
Landing Gear | 50 | |
ESC | 50 | |
Battery | 50 | |
Error code of the motor | 50 | |
Abnormal Flight | 50 | |
Drone's Speed | Flight speed | 200 |
Fusion Angular Velocity | 200 | |
Original Angular Velocity | 400 | |
Original Acceleration | 400 | |
Acceleration(Geodetic Coordinate) | 200 | |
Acceleration(Body Coordinate) | 200 | |
Sensor | ||
Barometer Height | 200 | |
Fusion Barometer Altitude | 200 | |
Barometer Altitude At The Home Point | 1 | |
Relative Height Of Fusion | 100 | |
Compass | 100 | |
VO Visual Position | 200 | |
Obstacle Avoidance | 100 | Gimbal |
Gimbal Atatus | 50 | |
Gimbal's Angle | 200 | |
Gimbal's Mode | 50 | Location |
GPS Signal Level | 50 | |
GPS Original Information | 5 | |
GPS Fusion Information | 50 | |
RTK Connection Status | 50 | |
RTK Original Information | 5 |
According to the actual flight conditions of the drone, various components and third-party sensors will generate a large amount of data information in real-time. The broadcast function of the OSDK can not only receive the data actively pushed by the drone to other modules, but also receive the data of third-party sensors. The Mobile APP developed based on MSDK, the Onboard Computer developed based on OSDK could receive the broadcast information of the drone and record broadcast information.
Applications with OSDK broadcast can broadcast the following information:
NOTE Due to the large bandwidth occupied by the broadcast and the OSDK wouldn't develop the broadcast function, so we recommended to use the Subscription function.
ACK::ErrorCode subscribeStatus; |
After initialized the message subscription function, the developer needs to specify the topic, frequency, package number, and data size.
bool enableTimestamp=false; bool pkgStatus=vehicle->subscribe->initPackageFromTopicList( pkgIndex, topicSize, topicList, enableTimestamp, freq); if (!(pkgStatus)) { return pkgStatus; } |
subscribeStatus=vehicle->subscribe->startPackage(pkgIndex, timeout); if (ACK::getError(subscribeStatus) != ACK::SUCCESS) { ACK::getErrorCodeMessage(subscribeStatus, __func__); |
Clear cache and stop subscription.
ACK::ErrorCode ack=vehicle->subscribe->removePackage(pkgIndex, timeout); |
Developers can choose a set of "topic" or "subscription data sets" and add them in the "subscription" package, and configure the corresponding subscription frequency. Users using the DJI Onboard API can configure five data packages, at the same time, a separate frequency can be set for each data package. OSDK provide a buffer(300 bytes), allowing users add more subscriptions to each package.
Figure 1. Topic Subscription