Public Types | Public Member Functions | Static Public Member Functions | Private Attributes
DJI::onboardSDK::VirtualRC Class Reference

VirtualRC class has all the methods to mimic the RC functionality via OnboardSDK. More...

#include <DJI_VirtualRC.h>

List of all members.

Public Types

enum  CutOff { CutOff_ToLogic = 0, CutOff_ToRealRC = 1 }

Public Member Functions

CoreAPIgetApi () const
RadioData getRCData () const
VirtualRCData getVRCData () const
 New function - this will replace sendSafeModeData() in a future release.
bool isVirtualRC () const
void neutralVRCSticks ()
void resetData ()
 This function will not be maintained and will be deprecated in a future release. Please use resetVRCData() instead.
void sendData (VirtualRCData Data)
void sendData ()
 This function will be deprecated in a future release. Please use sendData(VirtualRCData Data) instead.
void sendSafeModeData ()
 This function will be deprecated in the future. Please use neutralVRCSticks() instead.
void setApi (CoreAPI *value)
void setControl (bool enable, CutOff cutoffType)
void setVRCData (const VirtualRCData &value)
 VirtualRC (CoreAPI *ControlAPI=0)

Static Public Member Functions

static RadioData toRadioData (VirtualRCData &vData)
static RCData toRCData (VirtualRCData &vData)
static VirtualRCData toVirtualRCData (RadioData &rData)

Private Attributes

CoreAPIapi
VirtualRCData vrcData

Detailed Description

VirtualRC class has all the methods to mimic the RC functionality via OnboardSDK.

Definition at line 24 of file DJI_VirtualRC.h.


Member Enumeration Documentation

Enumerator:
CutOff_ToLogic 
CutOff_ToRealRC 

Definition at line 27 of file DJI_VirtualRC.h.


Constructor & Destructor Documentation

VirtualRC::VirtualRC ( CoreAPI ControlAPI = 0)

Definition at line 17 of file DJI_VirtualRC.cpp.


Member Function Documentation

Definition at line 81 of file DJI_VirtualRC.cpp.

Warning:
return type will change to RCData in a future release
The return type will change to RCData in a future release.

Definition at line 79 of file DJI_VirtualRC.cpp.

New function - this will replace sendSafeModeData() in a future release.

Definition at line 84 of file DJI_VirtualRC.cpp.

bool VirtualRC::isVirtualRC ( ) const

Definition at line 90 of file DJI_VirtualRC.cpp.

Deprecated:
This function will not be maintained and will be deprecated in a future release - please use neutralVRCSticks() instead.

Definition at line 72 of file DJI_VirtualRC.cpp.

This function will not be maintained and will be deprecated in a future release. Please use resetVRCData() instead.

Definition at line 45 of file DJI_VirtualRC.cpp.

api->send command was moved to this function from sendData().

Definition at line 31 of file DJI_VirtualRC.cpp.

This function will be deprecated in a future release. Please use sendData(VirtualRCData Data) instead.

Definition at line 39 of file DJI_VirtualRC.cpp.

This function will be deprecated in the future. Please use neutralVRCSticks() instead.

Definition at line 66 of file DJI_VirtualRC.cpp.

void VirtualRC::setApi ( CoreAPI value)

Definition at line 82 of file DJI_VirtualRC.cpp.

void VirtualRC::setControl ( bool  enable,
VirtualRC::CutOff  cutoffType 
)
Attention:
Safety notes You must use these methods below really carefully with following rules:
  • Use API setControl(bool enable, CutOff cutoffType); only once in your main loop;
  • Check your control device status by useing the following method: if(getControlDevice() != CONTROL_BY_VIRTUALRC) { reset code; }
Your reset code must not be "setControl(true);" without any status check It may cause your drone became a nut drone.
Note:
You could quit your VRC(Virtual Remot Control) by switching your remote controller out of modeF
Attention:
Most dangerous, setControl(true); must not be called over 0.5Hz or your drone will be locked in a logic-checking loop. And you cannot exit VirtualRC mode by switching your remote controller's mode. Actually, in this situation your drone will be a full automatically controlled by it self. It will keep flying until its bettery is empty or your code make it stop.
If you do not know what reset code you need to write, please just output your datalog and keep it empty.
It would be realy dangous if you keep calling sendData(); in a loop with out control-losing protection. like :

Global: VirtualRCData myData;

Thread 1: while(1) { myData = myAPIToSetupDataFromGroundStation(); }

Thread 2: while(1) { sendData(myData); msleep(200); }

When your drone lose signal, it will keep the recent command sent by your API: myAPIToSetupDataFromGroundStation(); This may result in a catastrophic crash.

Note:
API "sendData();" need to be called above 2Hz, and not greater than 25hz.
API "sendSafeModeData();" will lead your drone hover;

Definition at line 23 of file DJI_VirtualRC.cpp.

void VirtualRC::setVRCData ( const VirtualRCData value)

Definition at line 85 of file DJI_VirtualRC.cpp.

Warning:
old interface. Will be replaced by toRCData (see below) in a future release.
This function will be deprecated in a future release. Please use toRCData instead.

Definition at line 96 of file DJI_VirtualRC.cpp.

RCData VirtualRC::toRCData ( VirtualRCData vData) [static]

Definition at line 108 of file DJI_VirtualRC.cpp.

Definition at line 120 of file DJI_VirtualRC.cpp.


Member Data Documentation

Definition at line 111 of file DJI_VirtualRC.h.

Definition at line 112 of file DJI_VirtualRC.h.


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


dji_sdk_lib
Author(s):
autogenerated on Thu Jun 6 2019 17:55:25