25 #ifndef BEBOP_AUTONOMY_BEBOP_H 26 #define BEBOP_AUTONOMY_BEBOP_H 28 #define BEBOP_ERR_STR_SZ 150 30 #include <sys/syscall.h> 31 #include <sys/types.h> 38 #include <boost/shared_ptr.hpp> 39 #include <boost/atomic.hpp> 40 #include <boost/thread/mutex.hpp> 41 #include <boost/thread/condition_variable.hpp> 45 #include "libARSAL/ARSAL.h" 46 #include "libARController/ARController.h" 52 struct ARDISCOVERY_Device_t;
66 return (syscall(SYS_gettid));
72 class BebopArdrone3Config;
76 class AbstractCommand;
78 #define FORWARD_DECLARATIONS 82 #undef FORWARD_DECLARATIONS 99 typedef std::map<eARCONTROLLER_DICTIONARY_KEY, boost::shared_ptr<cb::AbstractCommand> >
callback_map_t;
100 typedef std::pair<eARCONTROLLER_DICTIONARY_KEY, boost::shared_ptr<cb::AbstractCommand> >
callback_map_pair_t;
108 static void StateChangedCallback(
109 eARCONTROLLER_DEVICE_STATE new_state,
110 eARCONTROLLER_ERROR error,
111 void *bebop_void_ptr);
113 static void CommandReceivedCallback(
114 eARCONTROLLER_DICTIONARY_KEY cmd_key,
115 ARCONTROLLER_DICTIONARY_ELEMENT_t* element_dict_ptr,
116 void* bebop_void_ptr);
118 static eARCONTROLLER_ERROR FrameReceivedCallback(ARCONTROLLER_Frame_t *frame,
119 void *bebop_void_ptr);
121 static eARCONTROLLER_ERROR DecoderConfigCallback(ARCONTROLLER_Stream_Codec_t codec,
122 void *bebop_void_ptr);
127 void ThrowOnInternalError(
const std::string& message = std::string());
128 void ThrowOnCtrlError(
const eARCONTROLLER_ERROR& error,
const std::string& message = std::string());
132 #define DEFINE_SHARED_PTRS 136 #undef DEFINE_SHARED_PTRS 144 explicit Bebop(ARSAL_Print_Callback_t custom_print_callback = 0);
148 void StartStreaming();
151 void StopStreaming();
155 void SetDate(
const std::string &date);
156 void RequestAllSettings();
157 void ResetAllSettings();
158 void UpdateSettings(
const bebop_driver::BebopArdrone3Config& config);
165 void NavigateHome(
const bool& start_stop);
166 void StartAutonomousFlight(
const std::string &filepath);
167 void PauseAutonomousFlight();
168 void StopAutonomousFlight();
169 void AnimationFlip(
const uint8_t& anim_id);
172 void Move(
const double& roll,
const double& pitch,
const double& gaz_speed,
const double& yaw_speed);
173 void MoveCamera(
const double& tilt,
const double& pan);
177 void SetExposure(
const float& exposure);
179 void ToggleVideoRecording(
const bool start);
183 bool GetFrontCameraFrame(std::vector<uint8_t>& buffer, uint32_t &width, uint32_t &height)
const;
184 uint32_t GetFrontCameraFrameWidth()
const;
185 uint32_t GetFrontCameraFrameHeight()
const;
191 #endif // BEBOP_AUTONOMY_BEBOP_H
const ARCONTROLLER_Device_t * GetControllerCstPtr() const
callback_map_t callback_map_
boost::shared_ptr< VideoDecoder > video_decoder_ptr_
ARSAL_Sem_t * GetStateSemPtr()
boost::atomic< bool > is_connected_
static const char * LOG_TAG
boost::condition_variable frame_avail_cond_
ARCONTROLLER_Device_t * device_controller_ptr_
bool IsStreamingStarted() const
boost::mutex frame_avail_mutex_
eARCONTROLLER_DEVICE_STATE device_state_
ARDISCOVERY_Device_t * device_ptr_
std::map< eARCONTROLLER_DICTIONARY_KEY, boost::shared_ptr< cb::AbstractCommand > > callback_map_t
eARCONTROLLER_ERROR error_
std::pair< eARCONTROLLER_DICTIONARY_KEY, boost::shared_ptr< cb::AbstractCommand > > callback_map_pair_t
boost::atomic< bool > is_streaming_started_