Telemetry API through asynchronous "Broadcast"-style messages. More...

#include <dji_broadcast.hpp>

Public Types

enum  FREQ {
  FREQ_0HZ = 0,
  FREQ_1HZ = 1,
  FREQ_10HZ = 2,
  FREQ_50HZ = 3,
  FREQ_100HZ = 4,
  FREQ_200HZ = 6,
  FREQ_400HZ = 7,
  FREQ_HOLD = 5
}
 
enum  DATA_ENABLE_FLAG {
  HAS_TIME = 0x0001,
  HAS_Q = 0x0002,
  HAS_A = 0x0004,
  HAS_V = 0x0008,
  HAS_W = 0x0010,
  HAS_POS = 0x0020,
  HAS_MAG = 0x0040,
  HAS_RC = 0x0080,
  HAS_GIMBAL = 0x0100,
  HAS_STATUS = 0x0200,
  HAS_BATTERY = 0x0400,
  HAS_DEVICE = 0x0800,
  A3_HAS_GPS = 0x0040,
  A3_HAS_RTK = 0x0080,
  A3_HAS_MAG = 0x0100,
  A3_HAS_RC = 0x0200,
  A3_HAS_GIMBAL = 0x0400,
  A3_HAS_STATUS = 0x0800,
  A3_HAS_BATTERY = 0x1000,
  A3_HAS_DEVICE = 0x2000,
  A3_HAS_COMPASS = 0x4000
}
 

Public Member Functions

 DataBroadcast (Vehicle *vehicle=0)
 
Telemetry::TimeStamp getTimeStamp ()
 
Telemetry::SyncStamp getSyncStamp ()
 
Telemetry::Quaternion getQuaternion ()
 
Telemetry::Vector3f getAcceleration ()
 
Telemetry::Vector3f getVelocity ()
 
Telemetry::Vector3f getAngularRate ()
 
Telemetry::VelocityInfo getVelocityInfo ()
 
Telemetry::GlobalPosition getGlobalPosition ()
 
Telemetry::RelativePosition getRelativePosition ()
 
Telemetry::GPSInfo getGPSInfo ()
 
Telemetry::RTK getRTKInfo ()
 
Telemetry::Mag getMag ()
 
Telemetry::RC getRC ()
 
Telemetry::Gimbal getGimbal ()
 
Telemetry::Status getStatus ()
 
Telemetry::Battery getBatteryInfo ()
 
Telemetry::SDKInfo getSDKInfo ()
 
Telemetry::Compass getCompassData ()
 
void setBroadcastFreq (uint8_t *dataLenIs16, VehicleCallBack callback=0, UserData userData=0)
 
ACK::ErrorCode setBroadcastFreq (uint8_t *dataLenIs16, int wait_timeout)
 
void setBroadcastFreqDefaults ()
 
ACK::ErrorCode setBroadcastFreqDefaults (int timeout)
 
void setBroadcastFreqToZero ()
 
uint16_t getPassFlag ()
 
Vehicle * getVehicle () const
 
void setVehicle (Vehicle *vehiclePtr)
 
void setVersionDefaults (uint8_t *frequencyBuffer)
 
void setFreqDefaultsM100_31 (uint8_t *frequencyBuffer)
 
void setFreqDefaults (uint8_t *frequencyBuffer)
 
void setUserBroadcastCallback (VehicleCallBack callback, UserData userData)
 
void setBroadcastLength (uint16_t length)
 
uint16_t getBroadcastLength ()
 

Static Public Member Functions

static void unpackCallback (Vehicle *vehicle, RecvContainer recvFrame, UserData userData)
 
static void setFrequencyCallback (Vehicle *vehicle, RecvContainer recvFrame, UserData userData)
 

Public Attributes

VehicleCallBackHandler unpackHandler
 

Detailed Description

Telemetry API through asynchronous "Broadcast"-style messages.

Broadcast telemetry is sent by the FC as push data - whenever an OES connects to the API port on FC, broadcast telemetry starts pushing data to the OES.

Frequencies can be set through DJI Assistant 2 or through these APIs.

Note
Broadcast-style telemetry is an old feature, and will not see many updates.

Member Function Documentation

◆ getAcceleration()

Telemetry::Vector3f DataBroadcast::getAcceleration ( )

Get acceleration from local cache

Supported Platforms : M210V2, M300
Note
This getter function is only available with Broadcast, not with Subscribe telemetry

The acceleration may be in body or ground frame, fused or raw, based on settings on DJI Assistant 2's SDK page.

Returns
Telemetry::Vector3f data structure with the newest value.

◆ getAngularRate()

Telemetry::Vector3f DataBroadcast::getAngularRate ( )

Get Angular Rates from local cache

Supported Platforms : M210V2, M300
Note
This getter function is only available with Broadcast, not with Subscribe telemetry

The angular rates may be in body or ground frame, fused or raw, based on settings on DJI Assistant 2's SDK page.

Returns
Telemetry::Vector3f data structure with the newest value.

◆ getBatteryInfo()

Telemetry::Battery DataBroadcast::getBatteryInfo ( )

Get Battery Info from local cache

Supported Platforms : M210V2, M300
Note
This getter function is only available with Broadcast, not with Subscribe telemetry
Returns
Telemetry::Battery data structure with the newest value.

◆ getCompassData()

Telemetry::Compass DataBroadcast::getCompassData ( )

Get Compass status info from local cache

Supported Platforms : M210V2, M300
Note
This getter function is only available with Broadcast, not with Subscribe telemetry
Returns
Telemetry::Compass data structure with the newest value.

◆ getGimbal()

Telemetry::Gimbal DataBroadcast::getGimbal ( )

Get Gimbal data from local cache

Supported Platforms : M210V2, M300
Note
This getter function is only available with Broadcast, not with Subscribe telemetry

Data Accuracy: 0.1 deg in all axes

Returns
Telemetry::Gimbal data structure with the newest value.

◆ getGlobalPosition()

Telemetry::GlobalPosition DataBroadcast::getGlobalPosition ( )

Get Globalc Position (LLA and metadata) from local cache

Supported Platforms : M210V2, M300
Note
This getter function is only available with Broadcast, not with Subscribe telemetry

Data accuracy:

Axis Unit Position Sensor Accuracy
x, y m GPS <3m with open sky without multipath
z m GPS <5m with open sky without multipath
x, y m RTK around 2cm with fine alignment and fix condition
z m RTK around 3cm with fine alignment and fix condition

The returned Lat/Lon values are in rad.

Returns
Telemetry::GlobalPosition data structure with the newest value.

◆ getGPSInfo()

Telemetry::GPSInfo DataBroadcast::getGPSInfo ( )

Get GPS Info from local cache

Supported Platforms : M210V2, M300
Note
This getter function is only available with Broadcast, not with Subscribe telemetry

This feature provides detailed GPS info. Available on A3/N3/M600. You need to enable it separately on DJI Assistant 2's SDK page.

Returns
Telemetry::GPSInfo data structure with the newest value.

◆ getMag()

Telemetry::Mag DataBroadcast::getMag ( )

Get Magnetometer data from local cache

Supported Platforms : M210V2, M300
Note
This getter function is only available with Broadcast, not with Subscribe telemetry

The returned value is calibrated mag data, 1000 < |mag| < 2000 for normal operation

Returns
Telemetry::Mag data structure with the newest value.

◆ getPassFlag()

uint16_t DataBroadcast::getPassFlag ( )

getter function for passFlag

Supported Platforms : M210V2, M300
Returns
uint16_t passFlag

◆ getQuaternion()

Telemetry::Quaternion DataBroadcast::getQuaternion ( )

Get quaternion data from local cache

Supported Platforms : M210V2, M300
Note
This getter function is only available with Broadcast, not with Subscribe telemetry
Returns
Telemetry::Quaternion data structure with the newest value.

Data accuracy:

Angle Unit Accuracy Notes
pitch, roll deg <1 in non-ahrs mode
yaw deg <3 for well-calibrated compass with fine alignment
yaw with rtk deg around 1.2 in RTK heading fixed mode with 1 meter baseline

◆ getRC()

Telemetry::RC DataBroadcast::getRC ( )

Get RC channel data from local cache

Supported Platforms : M210V2, M300
Note
This getter function is only available with Broadcast, not with Subscribe telemetry
Returns
Telemetry::RC data structure with the newest value.

◆ getRelativePosition()

Telemetry::RelativePosition DataBroadcast::getRelativePosition ( )

Get Obstacle info around the vehicle from local cache

Supported Platforms : M210V2, M300
Note
This getter function is only available with Broadcast, not with Subscribe telemetry

The returned value is relative to your home location.

Returns
Telemetry::RelativePosition data structure with the newest value.

◆ getRTKInfo()

Telemetry::RTK DataBroadcast::getRTKInfo ( )

Get RTK data from local cache

Supported Platforms : M210V2, M300
Note
This getter function is only available with Broadcast, not with Subscribe telemetry

This feature provides detailed RTK info. Available on A3/M600. You need to enable it separately on DJI Assistant 2's SDK page.

Returns
Telemetry::RTK data structure with the newest value.
Note
RTK Position Info and Yaw Info State is shown in the table below
State Meaning Description
0 NONE No solution
1 FIXEDPOS Position has been fixed by the FIX POSITION command
2 FIXEDHEIGHT Position has been fixed by the FIX HEIGHT/AUTO command
8 DOPPLER_VELOCITY Velocity computed using instantaneous Doppler
16 Single Single point position
17 PSRDIFF Pseudorange differential solution
18 WAAS Solution calculated using corrections from an SBAS
19 PROPAGATED Propagated by a Kalman filter without new observations
20 OMNISTAR OmniSTAR VBS position (L1 sub-metre)
32 L1_FLOAT Floating L1 ambiguity solution
33 IONOFREE_FLOAT Floating ionospheric-free ambiguity solution
34 NARROW_FLOAT Floating narrow-lane ambiguity solution
48 L1_INT Integer L1 ambiguity solution
49 WIDE_INT Integer wide-lane ambiguity solution
50 NARROW_INT Integer narrow-lane ambiguity solution

◆ getSDKInfo()

Telemetry::SDKInfo DataBroadcast::getSDKInfo ( )

Get SDK Control Mode/Authority info from local cache

Supported Platforms : M210V2, M300
Note
This getter function is only available with Broadcast, not with Subscribe telemetry
Returns
Telemetry::SDKInfo data structure with the newest value.

◆ getStatus()

Telemetry::Status DataBroadcast::getStatus ( )

Get Status (flight status, mode, gear and error) from local cache

Supported Platforms : M210V2, M300
Note
This getter function is only available with Broadcast, not with Subscribe telemetry
Returns
Telemetry::Status data structure with the newest value.

◆ getSyncStamp()

Telemetry::SyncStamp DataBroadcast::getSyncStamp ( )

Get software sync timestamp from local cache

Supported Platforms : M210V2, M300
Note
This getter function is only available with Broadcast, not with Subscribe telemetry

Note that this is unrelated to the hardware sync subscription.

Returns
Telemetry::SyncStamp data structure with the newest value.

◆ getTimeStamp()

Telemetry::TimeStamp DataBroadcast::getTimeStamp ( )

Get timestamp from local cache

Supported Platforms : M210V2, M300
Note
This getter function is only available with Broadcast, not with Subscribe telemetry
Returns
Telemetry::TimeStamp data structure with the newest value.

◆ getVelocity()

Telemetry::Vector3f DataBroadcast::getVelocity ( )

Get velocity from local cache

Supported Platforms : M210V2, M300
Note
This getter function is only available with Broadcast, not with Subscribe telemetry

Data accuracy:

Axis Unit Accuracy
vgx, vgy m/s Around 5cm/s for GNSS navigation. Around 3cm/s with VO at 1 meter height
vgz m/s 10cm/s only with barometer in steady air. 3cm/s with VO at 1 meter height with 8cm baseline

The velocity is based on ground frame.

Returns
Telemetry::Vector3f data structure with the newest value.

◆ getVelocityInfo()

Telemetry::VelocityInfo DataBroadcast::getVelocityInfo ( )

Get Velocity Info (health) from local cache

Supported Platforms : M210V2, M300
Note
This getter function is only available with Broadcast, not with Subscribe telemetry

This data is received along with velocity.

Returns
Telemetry::VelocityInfo data structure with the newest value.

◆ setBroadcastFreq() [1/2]

void DataBroadcast::setBroadcastFreq ( uint8_t *  dataLenIs16,
VehicleCallBack  callback = 0,
UserData  userData = 0 
)

Non-blocking call for Frequency setting

Supported Platforms : M210V2, M300
Parameters
dataLenIs16Array of length 16 that has frequency values for each topic
callbackCallback function you want called upon ACK
userDataAdditional data you want the callback function to have access to

◆ setBroadcastFreq() [2/2]

ACK::ErrorCode DataBroadcast::setBroadcastFreq ( uint8_t *  dataLenIs16,
int  wait_timeout 
)

Blocking call for Frequency setting

Supported Platforms : M210V2, M300
Parameters
dataLenIs16Array of length 16 that has frequency values for each topic
wait_timeoutTime(in s) you want the function to wait for an ACK
Returns
ACK::ErrorCode struct containing the ACK and metadata

◆ setBroadcastFreqDefaults() [1/2]

void DataBroadcast::setBroadcastFreqDefaults ( )

Non-Blocking call for setting default frequencies

Supported Platforms : M210V2, M300

◆ setBroadcastFreqDefaults() [2/2]

ACK::ErrorCode DataBroadcast::setBroadcastFreqDefaults ( int  timeout)

Blocking call for setting default frequencies

Supported Platforms : M210V2, M300
Parameters
wait_timeoutTime(in s) you want the function to wait for an ACK
Returns
ACK::ErrorCode struct containing the ACK and metadata

◆ setBroadcastFreqToZero()

void DataBroadcast::setBroadcastFreqToZero ( )

Non-Blocking call for setting all frequencies to zero

Supported Platforms : M210V2, M300

The documentation for this class was generated from the following files: