78 vpRobotBebop2(
bool verbose =
false,
bool setDefaultSettings =
true, std::string ipAddress =
"192.168.42.1",
79 int discoveryPort = 44444);
112 void setPosition(
float dX,
float dY,
float dZ,
float dPsi,
bool blocking);
119 void takeOff(
bool blocking =
true);
125#ifdef VISP_HAVE_FFMPEG
128 void getGrayscaleImage(vpImage<unsigned char> &I);
160 std::string m_ipAddress;
163 ARSAL_Sem_t m_stateSem;
164 struct sigaction m_sigAct;
166#ifdef VISP_HAVE_FFMPEG
167 AVCodecContext *m_codecContext;
170 std::mutex m_bgr_picture_mutex;
171 AVFrame *m_bgr_picture;
172 SwsContext *m_img_convert_ctx;
175 bool m_videoDecodingStarted;
181 static bool m_running;
185 bool m_flatTrimFinished;
186 bool m_relativeMoveEnded;
187 bool m_videoResolutionSet;
188 bool m_streamingStarted;
189 bool m_streamingModeSet;
190 bool m_settingsReset;
192 bool m_update_codec_params;
193 std::vector<uint8_t> m_codec_params_data;
195 unsigned int m_batteryLevel;
198 double m_cameraHorizontalFOV;
200 double m_currentCameraTilt;
201 double m_minCameraTilt;
202 double m_maxCameraTilt;
204 double m_currentCameraPan;
205 double m_minCameraPan;
206 double m_maxCameraPan;
208 static ARCONTROLLER_Device_t *m_deviceController;
210 eARCONTROLLER_ERROR m_errorController;
211 eARCONTROLLER_DEVICE_STATE m_deviceState;
214 [[noreturn]]
static void sighandler(
int signo);
216 eARCOMMANDS_ARDRONE3_PILOTINGSTATE_FLYINGSTATECHANGED_STATE getFlyingState();
217 eARCOMMANDS_ARDRONE3_MEDIASTREAMINGSTATE_VIDEOENABLECHANGED_ENABLED getStreamingState();
221 ARDISCOVERY_Device_t *discoverDrone();
222 void createDroneController(ARDISCOVERY_Device_t *discoveredDrone);
223 void setupCallbacks();
224 void startController();
226#ifdef VISP_HAVE_FFMPEG
231 void startVideoDecoding();
232 void stopVideoDecoding();
233 void computeFrame(ARCONTROLLER_Frame_t *frame);
238 static void stateChangedCallback(eARCONTROLLER_DEVICE_STATE newState, eARCONTROLLER_ERROR error,
void *customData);
239#ifdef VISP_HAVE_FFMPEG
240 static eARCONTROLLER_ERROR decoderConfigCallback(ARCONTROLLER_Stream_Codec_t codec,
void *customData);
241 static eARCONTROLLER_ERROR didReceiveFrameCallback(ARCONTROLLER_Frame_t *frame,
void *customData);
244 static void cmdBatteryStateChangedRcv(ARCONTROLLER_DICTIONARY_ELEMENT_t *elementDictionary,
vpRobotBebop2 *drone);
245 static void cmdCameraOrientationChangedRcv(ARCONTROLLER_DICTIONARY_ELEMENT_t *elementDictionary,
247 static void cmdCameraSettingsRcv(ARCONTROLLER_DICTIONARY_ELEMENT_t *elementDictionary,
vpRobotBebop2 *drone);
248 static void cmdExposureSetRcv(ARCONTROLLER_DICTIONARY_ELEMENT_t *elementDictionary,
vpRobotBebop2 *drone);
249 static void cmdMaxPitchRollChangedRcv(ARCONTROLLER_DICTIONARY_ELEMENT_t *elementDictionary,
vpRobotBebop2 *drone);
250 static void cmdRelativeMoveEndedRcv(ARCONTROLLER_DICTIONARY_ELEMENT_t *elementDictionary,
vpRobotBebop2 *drone);
251 static void commandReceivedCallback(eARCONTROLLER_DICTIONARY_KEY commandKey,
252 ARCONTROLLER_DICTIONARY_ELEMENT_t *elementDictionary,
void *customData);