40 #ifndef _vpRobotBebop2_h_ 41 #define _vpRobotBebop2_h_ 43 #include <visp3/core/vpConfig.h> 45 #ifdef VISP_HAVE_ARSDK 47 #include <visp3/core/vpImage.h> 50 #include <libARController/ARController.h> 51 #include <libARSAL/ARSAL.h> 53 #ifdef VISP_HAVE_FFMPEG 54 #include <libavcodec/avcodec.h> 55 #include <libswscale/swscale.h> 74 vpRobotBebop2(
bool verbose =
false,
bool setDefaultSettings =
true, std::string ipAddress =
"192.168.42.1",
75 int discoveryPort = 44444);
80 std::string getIpAddress();
81 int getDiscoveryPort();
87 unsigned int getBatteryLevel();
88 void setVerbose(
bool verbose);
89 void resetAllSettings();
106 void setMaxTilt(
double maxTilt);
107 void setPitch(
int value);
108 void setPosition(
float dX,
float dY,
float dZ,
float dPsi,
bool blocking);
110 void setRoll(
int value);
111 void setVelocity(
const vpColVector &vel,
double delta_t);
112 void setVerticalSpeed(
int value);
113 void setYawSpeed(
int value);
115 void takeOff(
bool blocking =
true);
121 #ifdef VISP_HAVE_FFMPEG 126 int getVideoHeight();
128 void setExposure(
float expo);
129 void setStreamingMode(
int mode);
130 void setVideoResolution(
int mode);
131 void setVideoStabilisationMode(
int mode);
132 void startStreaming();
133 void stopStreaming();
141 double getCameraHorizontalFOV()
const;
142 double getCurrentCameraPan()
const;
143 double getMaxCameraPan()
const;
144 double getMinCameraPan()
const;
145 double getCurrentCameraTilt()
const;
146 double getMaxCameraTilt()
const;
147 double getMinCameraTilt()
const;
148 void setCameraOrientation(
double tilt,
double pan,
bool blocking =
false);
149 void setCameraPan(
double pan,
bool blocking =
false);
150 void setCameraTilt(
double tilt,
bool blocking =
false);
156 std::string m_ipAddress;
159 ARSAL_Sem_t m_stateSem;
160 struct sigaction m_sigAct;
162 #ifdef VISP_HAVE_FFMPEG 163 AVCodecContext *m_codecContext;
166 std::mutex m_bgr_picture_mutex;
167 AVFrame *m_bgr_picture;
168 SwsContext *m_img_convert_ctx;
171 bool m_videoDecodingStarted;
177 static bool m_running;
181 bool m_flatTrimFinished;
182 bool m_relativeMoveEnded;
183 bool m_videoResolutionSet;
184 bool m_streamingStarted;
185 bool m_streamingModeSet;
186 bool m_settingsReset;
188 bool m_update_codec_params;
189 std::vector<uint8_t> m_codec_params_data;
191 unsigned int m_batteryLevel;
194 double m_cameraHorizontalFOV;
196 double m_currentCameraTilt;
197 double m_minCameraTilt;
198 double m_maxCameraTilt;
200 double m_currentCameraPan;
201 double m_minCameraPan;
202 double m_maxCameraPan;
204 static ARCONTROLLER_Device_t *m_deviceController;
206 eARCONTROLLER_ERROR m_errorController;
207 eARCONTROLLER_DEVICE_STATE m_deviceState;
210 [[noreturn]]
static void sighandler(
int signo);
212 eARCOMMANDS_ARDRONE3_PILOTINGSTATE_FLYINGSTATECHANGED_STATE getFlyingState();
213 eARCOMMANDS_ARDRONE3_MEDIASTREAMINGSTATE_VIDEOENABLECHANGED_ENABLED getStreamingState();
217 ARDISCOVERY_Device_t *discoverDrone();
218 void createDroneController(ARDISCOVERY_Device_t *discoveredDrone);
219 void setupCallbacks();
220 void startController();
222 #ifdef VISP_HAVE_FFMPEG 227 void startVideoDecoding();
228 void stopVideoDecoding();
229 void computeFrame(ARCONTROLLER_Frame_t *frame);
234 static void stateChangedCallback(eARCONTROLLER_DEVICE_STATE newState, eARCONTROLLER_ERROR error,
void *customData);
235 #ifdef VISP_HAVE_FFMPEG 236 static eARCONTROLLER_ERROR decoderConfigCallback(ARCONTROLLER_Stream_Codec_t codec,
void *customData);
237 static eARCONTROLLER_ERROR didReceiveFrameCallback(ARCONTROLLER_Frame_t *frame,
void *customData);
240 static void cmdBatteryStateChangedRcv(ARCONTROLLER_DICTIONARY_ELEMENT_t *elementDictionary,
vpRobotBebop2 *drone);
241 static void cmdCameraOrientationChangedRcv(ARCONTROLLER_DICTIONARY_ELEMENT_t *elementDictionary,
243 static void cmdCameraSettingsRcv(ARCONTROLLER_DICTIONARY_ELEMENT_t *elementDictionary,
vpRobotBebop2 *drone);
244 static void cmdExposureSetRcv(ARCONTROLLER_DICTIONARY_ELEMENT_t *elementDictionary,
vpRobotBebop2 *drone);
245 static void cmdMaxPitchRollChangedRcv(ARCONTROLLER_DICTIONARY_ELEMENT_t *elementDictionary,
vpRobotBebop2 *drone);
246 static void cmdRelativeMoveEndedRcv(ARCONTROLLER_DICTIONARY_ELEMENT_t *elementDictionary,
vpRobotBebop2 *drone);
247 static void commandReceivedCallback(eARCONTROLLER_DICTIONARY_KEY commandKey,
248 ARCONTROLLER_DICTIONARY_ELEMENT_t *elementDictionary,
void *customData);
252 #endif //#ifdef VISP_HAVE_ARSDK 253 #endif //#ifndef _vpRobotBebop2_h_ Implementation of an homogeneous matrix and operations on such kind of matrices.
Implementation of column vector and the associated operations.