29 #ifndef DJI_FLIGHT_ASSISTANT_MODULE_HPP 30 #define DJI_FLIGHT_ASSISTANT_MODULE_HPP 37 #define MAX_PARAMETER_VALUE_LENGTH 8 39 class FlightAssistant {
41 FlightAssistant(Vehicle *vehicle);
45 const static uint16_t MAX_FLIGHT_HEIGHT = 500;
46 const static uint16_t MIN_GO_HOME_HEIGHT = 20;
47 const static uint32_t MAX_FLY_RADIUS = 20000;
49 enum ParamHashValue : uint32_t {
50 USE_RTK_DATA = 1288992843,
51 GO_HOME_ALTITUDE = 952919004,
52 HORIZ_AVOID = 3001460201,
53 UPWARDS_AVOID = 854709684,
56 enum RtkEnableData : uint8_t {
60 enum AvoidEnable : uint8_t {
64 enum UpwardsAvoidEnable : uint8_t {
65 UPWARDS_AVOID_DISABLE = 0,
66 UPWARDS_AVOID_ENABLE = 1,
68 enum HomeLocationType : uint8_t {
69 DJI_HOMEPOINT_AIRCRAFT_LOACTON =
71 DJI_HOMEPOINT_SDK_SET_LOCAIION =
74 typedef uint16_t GoHomeAltitude;
77 typedef struct ParameterData {
79 uint8_t paramValue[MAX_PARAMETER_VALUE_LENGTH];
96 typedef struct UpwardsAvoidEnableAck {
99 uint8_t upwardsAvoidEnable;
100 } UpwardsAvoidEnableAck;
106 GoHomeAltitude altitude;
109 typedef struct SetHomeLocationData {
110 HomeLocationType homeType;
114 } SetHomeLocationData;
125 static const int maxSize = 32;
130 template <
typename T>
139 template <
typename T>
153 void *data, uint8_t len,
164 void writeParameterByHashAsync(
165 uint32_t hashValue,
void *data, uint8_t len,
166 void (*ackDecoderCB)(Vehicle *vehicle,
RecvContainer recvFrame,
169 UserData userData,
int timeout = 500,
int retry_time = 2);
179 void *param,
int timeout);
181 template <
typename DataT>
182 void readParameterByHashAsync(
183 ParamHashValue hashValue,
184 void (*ackDecoderCB)(Vehicle *vehicle,
RecvContainer recvFrame,
187 UserData userData,
int timeout = 500,
int retry_time = 2);
207 void setRtkEnableAsync(RtkEnableData rtkEnable,
231 RtkEnableData rtkEnable,
255 void setUpwardsAvoidanceEnabledAsync(UpwardsAvoidEnable upwardsAvoidEnable,
281 UpwardsAvoidEnable upwardsEnable,
314 void setGoHomeAltitudeAsync(
315 GoHomeAltitude altitude,
337 void getGoHomeAltitudeAsync(
339 GoHomeAltitude altitude,
UserData userData),
349 AvoidEnable avoidEnable,
int timeout);
360 void setCollisionAvoidanceEnabledAsync(
361 AvoidEnable avoidEnable,
372 AvoidEnable &avoidEnable,
int timeout);
383 void getCollisionAvoidanceEnabledAsync(
385 AvoidEnable avoidEnable,
UserData userData),
421 void setHomeLocationAsync(
422 SetHomeLocationData homeLocation,
427 FlightLink *flightLink;
429 template <
typename AckT>
432 static void setParameterDecoder(Vehicle *vehicle,
RecvContainer recvFrame,
435 static void getRtkEnableDecoder(Vehicle *vehicle,
RecvContainer recvFrame,
438 static void getAvoidEnableDecoder(Vehicle *vehicle,
RecvContainer recvFrame,
440 static void getUpwardsAvoidEnableDecoder(Vehicle *vehicle,
RecvContainer recvFrame,
442 static void getGoHomeAltitudeDecoder(Vehicle *vehicle,
445 static void setHomePointAckDecoder(Vehicle *vehicle,
RecvContainer recvFrame,
452 static bool goHomeAltitudeValidCheck(uint16_t altitude);
457 #endif // DJI_FLIGHT_ASSISTANT_MODULE_HPP void * UserData
This is used as the datatype for all data arguments in callbacks.
Definition: dji_type.hpp:75
Definition: dji_flight_assistant_module.hpp:83
type of callback only deal the retCode for user
Definition: dji_flight_assistant_module.hpp:120
int64_t ErrorCodeType
Unified error type.
Definition: dji_error.hpp:144
Type definition for new Vehicle-style callbacks.
Definition: dji_flight_assistant_module.hpp:103
Received info.
Definition: dji_vehicle_callback.hpp:59
struct of callback deal the param and retCode for user
Definition: dji_flight_assistant_module.hpp:131
Definition: dji_ack.cpp:38
Definition: dji_flight_assistant_module.hpp:90