Classes

struct  ImageSelection
 This struct provides an interface for user to determine what images to subscribe to. More...
 

Public Types

enum  ReceivedImgDesc {
  RECV_FRONT_LEFT = 10,
  RECV_FRONT_RIGHT = 11,
  RECV_DOWN_BACK = 0,
  RECV_DOWN_FRONT = 1,
  RECV_FRONT_DEPTH = 15
}
 This struct is used to pair img data with camera.
 
typedef struct DJI::OSDK::AdvancedSensing::ImageSelection ImageSelection
 This struct provides an interface for user to determine what images to subscribe to.
 

Public Member Functions

 AdvancedSensing (Vehicle *vehiclePtr)
 
void init ()
 subscribe to QVGA (240x320) stereo images at 20 fps More...
 
void deinit ()
 
void subscribeStereoImages (const ImageSelection *select, VehicleCallBack callback=0, UserData userData=0)
 subscribe to 240p stereo images at 20 fps More...
 
void subscribeFrontStereoVGA (const uint8_t freq, VehicleCallBack callback=0, UserData userData=0)
 subscribe to VGA (480x640) front stereo images at 10 or 20 fps More...
 
void subscribeFrontStereoDisparity (VehicleCallBack callback=0, UserData userData=0)
 subscribe to QVGA (240x320) stereo depth map at 10 fps More...
 
void unsubscribeStereoImages ()
 unsubscribe to QVGA (240x320) stereo depth map or images More...
 
void unsubscribeVGAImages ()
 unsubscribe to VGA (480x640) stereo images More...
 
bool startFPVCameraStream (CameraImageCallback cb=NULL, void *cbParam=NULL)
 Start the FPV Camera Stream. More...
 
bool startMainCameraStream (CameraImageCallback cb=NULL, void *cbParam=NULL)
 Start the Main Camera Stream. More...
 
void setAcmDevicePath (const char *acm_path)
 Set the ACM device path, mainly for M210V2. More...
 
void stopFPVCameraStream ()
 Stop the FPV RGB Stream. More...
 
void stopMainCameraStream ()
 Stop the Main Camera RGB Stream. More...
 
bool newFPVCameraImageIsReady ()
 Check if a new image from the FPV camera is received. More...
 
bool newMainCameraImageReady ()
 Check if a new image from the main camera is received. More...
 
bool getFPVCameraImage (CameraRGBImage &copyOfImage)
 Get a copy of the new image from the FPV camera. More...
 
bool getMainCameraImage (CameraRGBImage &copyOfImage)
 Get a copy of the new image from the main camera. More...
 
LiveView::LiveViewErrCode changeH264Source (LiveView::LiveViewCameraPosition pos, LiveView::LiveViewCameraSource source)
 Change the camera stream source from one payload device. (Beta API) More...
 
LiveView::LiveViewErrCode startH264Stream (LiveView::LiveViewCameraPosition pos, H264Callback cb, void *userData)
 Start the FPV or Camera H264 Stream. More...
 
LiveView::LiveViewErrCode stopH264Stream (LiveView::LiveViewCameraPosition pos)
 Stop the FPV or Camera H264 Stream. More...
 
Perception::PerceptionErrCode subscribePerceptionImage (Perception::DirectionType direction, Perception::PerceptionImageCB cb, void *userData)
 Subscribe the perception camera image stream (Only for M300 series) More...
 
Perception::PerceptionErrCode unsubscribePerceptionImage (Perception::DirectionType direction)
 Unsubscribe the perception camera image stream (Only for M300 series) More...
 
Perception::PerceptionErrCode triggerStereoCamParamsPushing ()
 Trigger the perception parameters to be passed to the callback which is registered by DJI::OSDK::Perception::setStereoCamParamsObserver. (Only for M300 series) More...
 
void setStereoCamParamsObserver (Perception::PerceptionCamParamCB cb, void *userData)
 Set the callback to catch the perception camera parameters. (Only for M300 series) More...
 
AdvancedSensingProtocol * getAdvancedSensingProtocol ()
 

Static Public Member Functions

static void stereoCallback (Vehicle *vehiclePtr, RecvContainer recvFrame, UserData userData)
 A default callback function for QVGA stereo images. More...
 
static void VGACallback (Vehicle *vehiclePtr, RecvContainer recvFrame, UserData userData)
 A default callback function for VGA stereo images. More...
 

Public Attributes

VehicleCallBackHandler stereoHandler
 
VehicleCallBackHandler vgaHandler
 

Detailed Description

APIs to access stereo camera, FPV camera and the main gimbaled camera on M210 and M210RTK

Member Function Documentation

◆ changeH264Source()

LiveView::LiveViewErrCode DJI::OSDK::AdvancedSensing::changeH264Source ( LiveView::LiveViewCameraPosition  pos,
LiveView::LiveViewCameraSource  source 
)

Change the camera stream source from one payload device. (Beta API)

Supported Platforms : M300
Note
Only support for payload device : H20/H20T
Parameters
pospoint out which camera to output the H264 stream
sourcechange to be the target camera of the payload, ref to LiveView::LiveViewCameraSource
Returns
Errorcode of liveivew, ref to DJI::OSDK::LiveView::LiveViewErrCode

◆ getFPVCameraImage()

bool DJI::OSDK::AdvancedSensing::getFPVCameraImage ( CameraRGBImage &  copyOfImage)

Get a copy of the new image from the FPV camera.

Supported Platforms : M210V2, M300
Parameters
copyOfImageA copy of the new available image will be put here. It is safe for user to manipulate this image.
Note
If a new image is not ready upon calling this function, it will wait for 30ms till timeout.
Returns
true if a new image frame is ready, false if timeout

◆ getMainCameraImage()

bool DJI::OSDK::AdvancedSensing::getMainCameraImage ( CameraRGBImage &  copyOfImage)

Get a copy of the new image from the main camera.

Supported Platforms : M210V2, M300
Parameters
Acopy of the new available image will be put here. It is safe for user to manipulate this image.
Note
If a new image is not ready upon calling this function, it will wait for 30ms till timeout.
Returns
true if a new image frame is ready, false if timeout

◆ init()

void DJI::OSDK::AdvancedSensing::init ( )

subscribe to QVGA (240x320) stereo images at 20 fps

Parameters
imagesto subscribe
callbackcallback function
userDatauser data (void ptr)

◆ newFPVCameraImageIsReady()

bool DJI::OSDK::AdvancedSensing::newFPVCameraImageIsReady ( )

Check if a new image from the FPV camera is received.

Supported Platforms : M210V2, M300
Returns
true if a new image frame is ready, false otherwise

◆ newMainCameraImageReady()

bool DJI::OSDK::AdvancedSensing::newMainCameraImageReady ( )

Check if a new image from the main camera is received.

Supported Platforms : M210V2, M300
Returns
true if a new image frame is ready, false otherwise

◆ setAcmDevicePath()

void DJI::OSDK::AdvancedSensing::setAcmDevicePath ( const char *  acm_path)

Set the ACM device path, mainly for M210V2.

Supported Platforms : M210V2

◆ setStereoCamParamsObserver()

void DJI::OSDK::AdvancedSensing::setStereoCamParamsObserver ( Perception::PerceptionCamParamCB  cb,
void *  userData 
)

Set the callback to catch the perception camera parameters. (Only for M300 series)

Supported Platforms : M300
Note
The callback will be triggered by calling DJI::OSDK::Perception::triggerStereoCamParamsPushing() or when the parameters of perception cameras are refreshed.
Parameters
cbcallback function that is called in a callback thread when the getting the parameters of perception cameras.
userDataa void pointer that users can manipulate inside the callback

◆ startFPVCameraStream()

bool DJI::OSDK::AdvancedSensing::startFPVCameraStream ( CameraImageCallback  cb = NULL,
void *  cbParam = NULL 
)

Start the FPV Camera Stream.

Supported Platforms : M210V2, M300
Parameters
cbcallback function that is called in a callback thread when a new image is received and decoded
cbParama void pointer that users can manipulate inside the callback
Returns
true if successfully started, false otherwise

◆ startH264Stream()

LiveView::LiveViewErrCode DJI::OSDK::AdvancedSensing::startH264Stream ( LiveView::LiveViewCameraPosition  pos,
H264Callback  cb,
void *  userData 
)

Start the FPV or Camera H264 Stream.

Supported Platforms : M210V2, M300
Note
For M210 V2 series, only OSDK_CAMERA_POSITION_NO_1 and OSDK_CAMERA_POSITION_FPV are supported.
For M300, all the poss are supported.
Parameters
pospoint out which camera to output the H264 stream
cbcallback function that is called in a callback thread when a new h264 frame is received
cbParama void pointer that users can manipulate inside the callback
Returns
Errorcode of liveivew, ref to DJI::OSDK::LiveView::LiveViewErrCode

◆ startMainCameraStream()

bool DJI::OSDK::AdvancedSensing::startMainCameraStream ( CameraImageCallback  cb = NULL,
void *  cbParam = NULL 
)

Start the Main Camera Stream.

Supported Platforms : M210V2, M300
Parameters
cbcallback function that is called in a callback thread when a new image is received and decoded
cbParama void pointer that users can manipulate inside the callback
Returns
true if successfully started, false otherwise

◆ stereoCallback()

static void DJI::OSDK::AdvancedSensing::stereoCallback ( Vehicle *  vehiclePtr,
RecvContainer  recvFrame,
UserData  userData 
)
static

A default callback function for QVGA stereo images.

Parameters
vehiclepointer
recvFramethe data comes with the callback function
userDataa void ptr that user can manipulate inside the callback

◆ stopFPVCameraStream()

void DJI::OSDK::AdvancedSensing::stopFPVCameraStream ( )

Stop the FPV RGB Stream.

Supported Platforms : M210V2, M300

◆ stopH264Stream()

LiveView::LiveViewErrCode DJI::OSDK::AdvancedSensing::stopH264Stream ( LiveView::LiveViewCameraPosition  pos)

Stop the FPV or Camera H264 Stream.

Supported Platforms : M210V2, M300
Note
For M210 V2 series, only OSDK_CAMERA_POSITION_NO_1 and OSDK_CAMERA_POSITION_FPV are supported.
For M300, all the poss are supported.
Parameters
pospoint out which camera to output the H264 stream
Returns
Errorcode of liveivew, ref to DJI::OSDK::LiveView::LiveViewErrCode

◆ stopMainCameraStream()

void DJI::OSDK::AdvancedSensing::stopMainCameraStream ( )

Stop the Main Camera RGB Stream.

Supported Platforms : M210V2, M300

◆ subscribeFrontStereoDisparity()

void DJI::OSDK::AdvancedSensing::subscribeFrontStereoDisparity ( VehicleCallBack  callback = 0,
UserData  userData = 0 
)

subscribe to QVGA (240x320) stereo depth map at 10 fps

Supported Platforms : M210V2
Parameters
callbackcallback function
userDatauser data (void ptr)

◆ subscribeFrontStereoVGA()

void DJI::OSDK::AdvancedSensing::subscribeFrontStereoVGA ( const uint8_t  freq,
VehicleCallBack  callback = 0,
UserData  userData = 0 
)

subscribe to VGA (480x640) front stereo images at 10 or 20 fps

Supported Platforms : M210V2, M300
Parameters
frequencyof images using enum from AdvancedSensingProtocol::FREQ
callbackcallback function
userDatauser data (void ptr)

◆ subscribePerceptionImage()

Perception::PerceptionErrCode DJI::OSDK::AdvancedSensing::subscribePerceptionImage ( Perception::DirectionType  direction,
Perception::PerceptionImageCB  cb,
void *  userData 
)

Subscribe the perception camera image stream (Only for M300 series)

Supported Platforms : M300
Parameters
directionpoint out which direction's stream need to be subscribed
cbcallback function that is called in a callback thread when a perception image frame is received
userDataa void pointer that users can manipulate inside the callback
Returns
Errorcode of liveivew, ref to DJI::OSDK::LiveView::LiveViewErrCode

◆ subscribeStereoImages()

void DJI::OSDK::AdvancedSensing::subscribeStereoImages ( const ImageSelection select,
VehicleCallBack  callback = 0,
UserData  userData = 0 
)

subscribe to 240p stereo images at 20 fps

Supported Platforms : M210V2
Parameters
selectthe choice of the image direction, ref to AdvancedSensing::ImageSelection
callbackcallback function
userDatauser data (void ptr)

◆ triggerStereoCamParamsPushing()

Perception::PerceptionErrCode DJI::OSDK::AdvancedSensing::triggerStereoCamParamsPushing ( )

Trigger the perception parameters to be passed to the callback which is registered by DJI::OSDK::Perception::setStereoCamParamsObserver. (Only for M300 series)

Supported Platforms : M300
Returns
Errorcode of liveivew, ref to DJI::OSDK::LiveView::LiveViewErrCode

◆ unsubscribePerceptionImage()

Perception::PerceptionErrCode DJI::OSDK::AdvancedSensing::unsubscribePerceptionImage ( Perception::DirectionType  direction)

Unsubscribe the perception camera image stream (Only for M300 series)

Supported Platforms : M300
Parameters
directionpoint out which direction's stream need to be unsubscribed
Returns
Errorcode of liveivew, ref to DJI::OSDK::LiveView::LiveViewErrCode

◆ unsubscribeStereoImages()

void DJI::OSDK::AdvancedSensing::unsubscribeStereoImages ( )

unsubscribe to QVGA (240x320) stereo depth map or images

Supported Platforms : M210V2, M300

◆ unsubscribeVGAImages()

void DJI::OSDK::AdvancedSensing::unsubscribeVGAImages ( )

unsubscribe to VGA (480x640) stereo images

Supported Platforms : M210V2, M300

◆ VGACallback()

static void DJI::OSDK::AdvancedSensing::VGACallback ( Vehicle *  vehiclePtr,
RecvContainer  recvFrame,
UserData  userData 
)
static

A default callback function for VGA stereo images.

Parameters
vehiclepointer
recvFramethe data comes with the callback function
userDataa void ptr that user can manipulate inside the callback

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