Onboard-SDK-ROS
Public Types | Public Member Functions | Static Public Member Functions | List of all members
DJI::onboardSDK::Flight Class Reference

Flight class encapsulates all flight control related functions provided by the DJI OnboardSDK. More...

#include <DJI_Flight.h>

Public Types

enum  TASK { TASK_GOHOME = 1, TASK_TAKEOFF = 4, TASK_LANDING = 6 }
 
enum  VerticalLogic { VERTICAL_VELOCITY = 0x00, VERTICAL_POSITION = 0x10, VERTICAL_THRUST = 0x20 }
 
enum  HorizontalLogic { HORIZONTAL_ANGLE = 0x00, HORIZONTAL_VELOCITY = 0x40, HORIZONTAL_POSITION = 0X80 }
 
enum  YawLogic { YAW_ANGLE = 0x00, YAW_RATE = 0x08 }
 
enum  HorizontalCoordinate { HORIZONTAL_GROUND = 0x00, HORIZONTAL_BODY = 0x02 }
 
enum  YawCoordinate { YAW_GROUND = 0x00, YAW_BODY = 0X01 }
 
enum  SmoothMode { SMOOTH_DISABLE = 0x00, SMOOTH_ENABLE = 0x01 }
 
enum  Status {
  STATUS_GROUND_STANDBY = 1, STATUS_TAKE_OFF = 2, STATUS_SKY_STANDBY = 3, STATUS_LANDING = 4,
  STATUS_FINISHING_LANDING = 5
}
 
enum  Device { DEVICE_RC = 0, DEVICE_APP = 1, DEVICE_SDK = 2 }
 
enum  Mode {
  ATTI_STOP = 0, HORIZ_ANG_VERT_VEL_YAW_ANG = 1, HORIZ_ANG_VERT_VEL_YAW_RATE = 2, HORIZ_VEL_VERT_VEL_YAW_ANG = 3,
  HORIZ_VEL_VERT_VEL_YAW_RATE = 4, HORIZ_POS_VERT_VEL_YAW_ANG = 5, HORIZ_POS_VERT_VEL_YAW_RATE = 6, HORIZ_ANG_VERT_POS_YAW_ANG = 7,
  HORIZ_ANG_VERT_POS_YAW_RATE = 8, HORIZ_VEL_VERT_POS_YAW_ANG = 9, HORIZ_VEL_VERT_POS_YAW_RATE = 10, HORIZ_POS_VERT_POS_YAW_ANG = 11,
  HORIZ_POS_VERT_POS_YAW_RATE = 12, HORIZ_ANG_VERT_THR_YAW_ANG = 13, HORIZ_ANG_VERT_THR_YAW_RATE = 14, HORIZ_VEL_VERT_THR_YAW_ANG = 15,
  HORIZ_VEL_VERT_THR_YAW_RATE = 16, HORIZ_POS_VERT_THR_YAW_ANG = 17, HORIZ_POS_VERT_THR_YAW_RATE = 18, GPS_ATII_CTRL_CL_YAW_RATE = 97,
  GPS_ATTI_CTRL_YAW_RATE = 98, ATTI_CTRL_YAW_RATE = 99, ATTI_CTRL_STOP = 100, MODE_NOT_SUPPORTED = 0xFF
}
 

Public Member Functions

 Flight (CoreAPI *ControlAPI=0)
 
void task (TASK taskname, CallBack TaskCallback=0, UserData userData=0)
 
void setArm (bool enable, CallBack ArmCallback=0, UserData userData=0)
 
void control (uint8_t flag, float32_t x, float32_t y, float32_t z, float32_t yaw)
 
void setMovementControl (uint8_t flag, float32_t x, float32_t y, float32_t z, float32_t yaw)
 
void setFlight (FlightData *data)
 
QuaternionData getQuaternion () const
 
EulerAngle getEulerAngle () const
 
PositionData getPosition () const
 
VelocityData getVelocity () const
 
CommonData getAcceleration () const
 
CommonData getYawRate () const
 
MagnetData getMagnet () const
 
Device getControlDevice () const
 
Status getStatus () const
 
Mode getControlMode () const
 
Angle getYaw () const
 
Angle getRoll () const
 
Angle getPitch () const
 
CoreAPIgetApi () const
 
void setApi (CoreAPI *value)
 

Static Public Member Functions

static void armCallback (CoreAPI *api, Header *protoclHeader, UserData userData=0)
 
static void taskCallback (CoreAPI *api, Header *protocolHeader, UserData userData=0)
 
static EulerianAngle toEulerianAngle (QuaternionData data)
 @ deprecated Use toEulerAngle instead. More...
 
static EulerAngle toEulerAngle (QuaternionData quaternionData)
 
static QuaternionData toQuaternion (EulerianAngle eulerAngleData)
 

Detailed Description

Flight class encapsulates all flight control related functions provided by the DJI OnboardSDK.

Member Enumeration Documentation

Todo:
rename
Version
3.1
Version
2.3

Constructor & Destructor Documentation

Flight::Flight ( CoreAPI ControlAPI = 0)
Note
In order to keep your drone safe, you must keep sending FlightData to flight controller. Or your drone will hover.

Position control is a open-looped control. That means it accept incremental data, not absolute position data.

Note
This functionality is not supported in this release.

Member Function Documentation

void Flight::armCallback ( CoreAPI api,
Header protoclHeader,
UserData userData  __UNUSED = 0 
)
static
Note
callbacks
CommonData Flight::getAcceleration ( ) const
Warning
The return type for getAcceleration and getYawrate will change to Vector3fData in a future release
The return type for getAcceleration will change to Vector3fData in a future release
CoreAPI * Flight::getApi ( ) const
Note
Access method
MagnetData Flight::getMagnet ( ) const
Warning
old interface. Will be replaced by MagData getMagData() in the next release.
old interface. Will be replaced by MagData Flight::getMagData() in the next release.
QuaternionData Flight::getQuaternion ( ) const
Deprecated:
old interface. PLease use setMovementControl instead.
CommonData Flight::getYawRate ( ) const
Warning
The return type for getYawRate will change to Vector3fData in a future release
void Flight::setMovementControl ( uint8_t  flag,
float32_t  x,
float32_t  y,
float32_t  z,
float32_t  yaw 
)
Deprecated:
This function will be deprecated, please use setMovementControl instead.
void Flight::task ( TASK  taskname,
CallBack  TaskCallback = 0,
UserData  userData = 0 
)
Note
This functionality is not supported in this release.
EulerianAngle Flight::toEulerianAngle ( QuaternionData  data)
static

@ deprecated Use toEulerAngle instead.

Note
mathematical method
Deprecated:
old interface. Please use toEulerAngle instead.

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