bebop.cpp
Go to the documentation of this file.
1 
25 #include <stdexcept>
26 #include <cmath>
27 #include <string>
28 #include <algorithm>
29 #include <vector>
30 
31 #include <boost/bind.hpp>
32 #include <boost/thread/locks.hpp>
33 #include <boost/make_shared.hpp>
34 
35 extern "C"
36 {
37  #include "libARCommands/ARCommands.h"
38  #include "libARDiscovery/ARDiscovery.h"
39  #include <libARController/ARController.h>
40 }
41 
42 #include <bebop_driver/bebop.h>
43 #include "bebop_driver/BebopArdrone3Config.h"
45 
46 // include all callback wrappers
50 
51 /*
52  * Bebop coordinate systems
53  *
54  * Velocities:
55  *
56  * +x : East
57  * +y : South
58  * +z : Down
59  *
60  * Attitude:
61  *
62  * +x : forward
63  * +y : right
64  * +z : down
65  * +yaw : CW
66  *
67  * ROS coordinate system (REP 105)
68  *
69  * +x : forward
70  * +y : left
71  * +z : up
72  * +yaw : CCW
73  *
74  * Move function (setPilotingPCMD, conforms with Attiude, except for gaz)
75  *
76  * +roll : right
77  * +pitch : forward
78  * +gaz : up
79  * +yaw : CW
80  *
81  */
82 
83 namespace bebop_driver
84 {
85 
86 const char* Bebop::LOG_TAG = "BebopSDK";
87 
88 void Bebop::StateChangedCallback(eARCONTROLLER_DEVICE_STATE new_state, eARCONTROLLER_ERROR error, void *bebop_void_ptr)
89 {
90  // TODO(mani-monaj): Log error
91  Bebop* bebop_ptr_ = static_cast<Bebop*>(bebop_void_ptr);
92 
93  switch (new_state)
94  {
95  case ARCONTROLLER_DEVICE_STATE_STOPPED:
96  ARSAL_Sem_Post(&(bebop_ptr_->state_sem_));
97  break;
98  case ARCONTROLLER_DEVICE_STATE_RUNNING:
99  ARSAL_Sem_Post(&(bebop_ptr_->state_sem_));
100  break;
101  }
102 }
103 
104 void Bebop::CommandReceivedCallback(eARCONTROLLER_DICTIONARY_KEY cmd_key,
105  ARCONTROLLER_DICTIONARY_ELEMENT_t *element_dict_ptr,
106  void *bebop_void_ptr)
107 {
108  static long int lwp_id = util::GetLWPId();
109  static bool lwp_id_printed = false;
110 
111  if (!lwp_id_printed)
112  {
113  ARSAL_PRINT(ARSAL_PRINT_INFO, LOG_TAG, "Command Received Callback LWP id is: %ld", lwp_id);
114  lwp_id_printed = true;
115  }
116  Bebop* bebop_ptr = static_cast<Bebop*>(bebop_void_ptr);
117  if (!bebop_ptr->IsConnected()) return;
118 
119  ARCONTROLLER_DICTIONARY_ELEMENT_t *single_element_ptr = NULL;
120 
121  if (element_dict_ptr)
122  {
123  // We are only interested in single key dictionaries
124  HASH_FIND_STR(element_dict_ptr, ARCONTROLLER_DICTIONARY_SINGLE_KEY, single_element_ptr);
125 
126  if (single_element_ptr)
127  {
128  callback_map_t::iterator it = bebop_ptr->callback_map_.find(cmd_key);
129  if (it != bebop_ptr->callback_map_.end())
130  {
131  // TODO(mani-monaj): Check if we can find the time from the packets
132  it->second->Update(element_dict_ptr->arguments, ros::Time::now());
133  }
134  }
135  }
136 }
137 
138 // This callback is called within the same context as FrameReceivedCallback()
139 eARCONTROLLER_ERROR Bebop::DecoderConfigCallback(ARCONTROLLER_Stream_Codec_t codec, void *bebop_void_ptr)
140 {
141  Bebop* bebop_ptr = static_cast<Bebop*>(bebop_void_ptr);
142  if (codec.type == ARCONTROLLER_STREAM_CODEC_TYPE_H264)
143  {
144  ARSAL_PRINT(ARSAL_PRINT_INFO, LOG_TAG, "H264 configuration packet received: #SPS: %d #PPS: %d (MP4? %d)",
145  codec.parameters.h264parameters.spsSize,
146  codec.parameters.h264parameters.ppsSize,
147  codec.parameters.h264parameters.isMP4Compliant);
148 
149  if (!bebop_ptr->video_decoder_ptr_->SetH264Params(
150  codec.parameters.h264parameters.spsBuffer,
151  codec.parameters.h264parameters.spsSize,
152  codec.parameters.h264parameters.ppsBuffer,
153  codec.parameters.h264parameters.ppsSize))
154  {
155  return ARCONTROLLER_ERROR;
156  }
157  }
158  else
159  {
160  ARSAL_PRINT(ARSAL_PRINT_WARNING, LOG_TAG, "Codec type is not H264");
161  return ARCONTROLLER_ERROR;
162  }
163 
164  return ARCONTROLLER_OK;
165 }
166 
167 // This Callback runs in ARCONTROLLER_Stream_ReaderThreadRun context and blocks it until it returns
168 eARCONTROLLER_ERROR Bebop::FrameReceivedCallback(ARCONTROLLER_Frame_t *frame, void *bebop_void_ptr)
169 {
170  static long int lwp_id = util::GetLWPId();
171  static bool lwp_id_printed = false;
172  if (!lwp_id_printed)
173  {
174  ARSAL_PRINT(ARSAL_PRINT_INFO, LOG_TAG, "Frame Recv & Decode LWP id: %ld", lwp_id);
175  lwp_id_printed = true;
176  }
177 
178  if (!frame)
179  {
180  ARSAL_PRINT(ARSAL_PRINT_WARNING, LOG_TAG, "Received frame is NULL");
181  return ARCONTROLLER_ERROR_NO_VIDEO;
182  }
183 
184  Bebop* bebop_ptr = static_cast<Bebop*>(bebop_void_ptr);
185  if (!bebop_ptr->IsConnected()) return ARCONTROLLER_ERROR;
186 
187  {
188  boost::unique_lock<boost::mutex> lock(bebop_ptr->frame_avail_mutex_);
189  if (bebop_ptr->is_frame_avail_)
190  {
191  ARSAL_PRINT(ARSAL_PRINT_WARNING, LOG_TAG, "Previous frame might have been missed.");
192  }
193 
194  if (!bebop_ptr->video_decoder_ptr_->Decode(frame))
195  {
196  ARSAL_PRINT(ARSAL_PRINT_ERROR, LOG_TAG, "Video decode failed");
197  }
198  else
199  {
200  bebop_ptr->is_frame_avail_ = true;
201  // ARSAL_PRINT(ARSAL_PRINT_INFO, LOG_TAG, "FRAME IS READY");
202  bebop_ptr->frame_avail_cond_.notify_one();
203  }
204  }
205 
206  return ARCONTROLLER_OK;
207 }
208 
209 
210 Bebop::Bebop(ARSAL_Print_Callback_t custom_print_callback):
211  is_connected_(false),
212  is_streaming_started_(false),
213  device_ptr_(NULL),
215  error_(ARCONTROLLER_OK),
216  device_state_(ARCONTROLLER_DEVICE_STATE_MAX),
218  is_frame_avail_(false)
219 // out_file("/tmp/ts.txt")
220 {
221  // Redirect all calls to AR_PRINT_* to this function if provided
222  if (custom_print_callback)
223  ARSAL_Print_SetCallback(custom_print_callback);
224 
225  ARSAL_PRINT(ARSAL_PRINT_INFO, LOG_TAG, "Bebop Cnstr()");
226 }
227 
229 {
230  // This is the last resort, the program must run Cleanup() fo
231  // proper disconnection and free
232  if (device_ptr_) ARDISCOVERY_Device_Delete(&device_ptr_);
233  if (device_controller_ptr_) ARCONTROLLER_Device_Delete(&device_controller_ptr_);
234 }
235 
236 void Bebop::Connect(ros::NodeHandle& nh, ros::NodeHandle& priv_nh, const std::string& bebop_ip)
237 {
238  try
239  {
240  if (is_connected_) throw std::runtime_error("Already inited");
241 
242  // TODO(mani-monaj): Error checking;
243  ARSAL_Sem_Init(&state_sem_, 0, 0);
244 
245  eARDISCOVERY_ERROR error_discovery = ARDISCOVERY_OK;
246  device_ptr_ = ARDISCOVERY_Device_New(&error_discovery);
247 
248  if (error_discovery != ARDISCOVERY_OK)
249  {
250  throw std::runtime_error("Discovery failed: " + std::string(ARDISCOVERY_Error_ToString(error_discovery)));
251  }
252 
253  // set/save ip
254  bebop_ip_ = bebop_ip;
255 
256  // TODO(mani-monaj): Make ip and port params
257  error_discovery = ARDISCOVERY_Device_InitWifi(device_ptr_,
258  ARDISCOVERY_PRODUCT_ARDRONE, "Bebop",
259  bebop_ip_.c_str(), 44444);
260 
261  if (error_discovery != ARDISCOVERY_OK)
262  {
263  throw std::runtime_error("Discovery failed: " + std::string(ARDISCOVERY_Error_ToString(error_discovery)));
264  }
265 
266  device_controller_ptr_ = ARCONTROLLER_Device_New(device_ptr_, &error_);
267  ThrowOnCtrlError(error_, "Creation of device controller failed: ");
268 
269  ARDISCOVERY_Device_Delete(&device_ptr_);
270 
271  // callback_map is not being modified after this initial update
272 #define UPDTAE_CALLBACK_MAP
276 #undef UPDTAE_CALLBACK_MAP
277 
278  ThrowOnCtrlError(ARCONTROLLER_Device_Start(device_controller_ptr_), "Controller device start failed");
279 
281  ARCONTROLLER_Device_AddStateChangedCallback(
282  device_controller_ptr_, Bebop::StateChangedCallback, reinterpret_cast<void*>(this)),
283  "Registering state callback failed");
285  ARCONTROLLER_Device_AddCommandReceivedCallback(
286  device_controller_ptr_, Bebop::CommandReceivedCallback, reinterpret_cast<void*>(this)),
287  "Registering command callback failed");
288 
289 // ThrowOnCtrlError(
290 // ARCONTROLLER_Device_SetVideoStreamMP4Compliant(
291 // device_controller_ptr_, 1),
292 // "Enforcing MP4 compliancy failed");
293 
294  // The forth argument is frame timeout callback
296  ARCONTROLLER_Device_SetVideoStreamCallbacks(
298  NULL , reinterpret_cast<void*>(this)),
299  "Registering video callback failed");
300 
301  // This semaphore is touched inside the StateCallback
302  ARSAL_Sem_Wait(&state_sem_);
303 
304  device_state_ = ARCONTROLLER_Device_GetState(device_controller_ptr_, &error_);
305  if ((error_ != ARCONTROLLER_OK) || (device_state_ != ARCONTROLLER_DEVICE_STATE_RUNNING))
306  {
307  throw std::runtime_error("Waiting for device failed: " + std::string(ARCONTROLLER_Error_ToString(error_)));
308  }
309 
310  // Enforce termination of video streaming ... (use Start/Stop streaming to enable/disable this)
311  ThrowOnCtrlError(device_controller_ptr_->aRDrone3->sendMediaStreamingVideoEnable(
312  device_controller_ptr_->aRDrone3, 0), "Stopping video stream failed.");
313  }
314  catch (const std::runtime_error& e)
315  {
316  Cleanup();
317  throw e;
318  }
319 
320  is_connected_ = true;
321  ARSAL_PRINT(ARSAL_PRINT_INFO, LOG_TAG, "BebopSDK inited, lwp_id: %ld", util::GetLWPId());
322 }
323 
325 {
326  ARSAL_PRINT(ARSAL_PRINT_INFO, LOG_TAG, "Bebop Cleanup()");
328  {
329  device_state_ = ARCONTROLLER_Device_GetState(device_controller_ptr_, &error_);
330  if ((error_ == ARCONTROLLER_OK) && (device_state_ != ARCONTROLLER_DEVICE_STATE_STOPPED))
331  {
332  ARSAL_PRINT(ARSAL_PRINT_INFO, LOG_TAG, "Disconnecting ...");
333  error_ = ARCONTROLLER_Device_Stop(device_controller_ptr_);
334  if (error_ == ARCONTROLLER_OK)
335  {
336  ARSAL_Sem_Wait(&state_sem_);
337  }
338  }
339  ARCONTROLLER_Device_Delete(&device_controller_ptr_);
340  }
341  is_connected_ = false;
342  ARSAL_Sem_Destroy(&state_sem_);
343 }
344 
346 {
348  {
349  ARSAL_PRINT(ARSAL_PRINT_WARNING, LOG_TAG, "Video streaming is already started ...");
350  return;
351  }
352  try
353  {
354  ThrowOnInternalError("Starting video stream failed");
355  // Start video streaming
356  ThrowOnCtrlError(device_controller_ptr_->aRDrone3->sendMediaStreamingVideoEnable(
357  device_controller_ptr_->aRDrone3, 1), "Starting video stream failed.");
358  is_streaming_started_ = true;
359  ARSAL_PRINT(ARSAL_PRINT_WARNING, LOG_TAG, "Video streaming started ...");
360  }
361  catch (const std::runtime_error& e)
362  {
363  ARSAL_PRINT(ARSAL_PRINT_INFO, LOG_TAG, "Failed to start video streaming ...");
364  is_streaming_started_ = false;
365  throw e;
366  }
367 }
368 
370 {
371  if (!is_streaming_started_) return;
372  try
373  {
374  ThrowOnInternalError("Stopping video stream failed");
375  // Stop video streaming
376  ThrowOnCtrlError(device_controller_ptr_->aRDrone3->sendMediaStreamingVideoEnable(
377  device_controller_ptr_->aRDrone3, 0), "Stopping video stream failed.");
378  is_streaming_started_ = false;
379  }
380  catch (const std::runtime_error& e)
381  {
382  ARSAL_PRINT(ARSAL_PRINT_ERROR, LOG_TAG, "Failed to stop video streaming ...");
383  }
384 }
385 
387 {
388  if (!is_connected_) return;
390  Cleanup();
391  ARSAL_PRINT(ARSAL_PRINT_INFO, LOG_TAG, "Disconnected from Bebop ...");
392 }
393 
394 void Bebop::SetDate(const std::string &date)
395 {
396  ThrowOnInternalError("Setting Date Failed");
398  device_controller_ptr_->common->sendCommonCurrentDate(device_controller_ptr_->common, const_cast<char*>(date.c_str())),
399  "Setting Date Failed");
400 }
401 
403 {
404  ThrowOnInternalError("Request Settings Failed");
406  device_controller_ptr_->common->sendSettingsAllSettings(device_controller_ptr_->common),
407  "Request Settings Failed");
408 }
409 
411 {
412  ThrowOnInternalError("Reset Settings Failed");
414  device_controller_ptr_->common->sendSettingsReset(device_controller_ptr_->common),
415  "Reset Settings Failed");
416 
417  ARSAL_PRINT(ARSAL_PRINT_INFO, LOG_TAG, "All settings of the drone have been reset to default values.");
418 }
419 
420 void Bebop::UpdateSettings(const BebopArdrone3Config &config)
421 {
422  ThrowOnInternalError("Update Settings Failed");
423 
424  // For all callback_map members
425  // 1) Check if they are derived from AbstractSetting type
426  // 1.1) Pass the config objects to them
427 // boost::lock_guard<boost::mutex> lock(callback_map_mutex_);
428  for (callback_map_t::iterator it = callback_map_.begin(); it != callback_map_.end(); it++)
429  {
430  // Convert the base class pointer (AbstractCommand) to the derived class pointer (AbstractSetting)
431  // In case of State classes, do nothing
432  boost::shared_ptr<cb::AbstractSetting> setting_ptr = boost::dynamic_pointer_cast<cb::AbstractSetting>(it->second);
433  if (setting_ptr)
434  {
435  setting_ptr->UpdateBebopFromROS(config, device_controller_ptr_);
436  }
437  }
438 }
439 
441 {
442  ThrowOnInternalError("Takeoff failed");
444  device_controller_ptr_->aRDrone3->sendPilotingTakeOff(device_controller_ptr_->aRDrone3),
445  "Takeoff failed");
446 }
447 
449 {
450  ThrowOnInternalError("Land failed");
452  device_controller_ptr_->aRDrone3->sendPilotingLanding(device_controller_ptr_->aRDrone3),
453  "Land failed");
454 }
455 
457 {
458  ThrowOnInternalError("Emergency failed");
460  device_controller_ptr_->aRDrone3->sendPilotingEmergency(device_controller_ptr_->aRDrone3),
461  "Emergency failed");
462 }
463 
465 {
466  ThrowOnInternalError("FlatTrim failed");
468  device_controller_ptr_->aRDrone3->sendPilotingFlatTrim(device_controller_ptr_->aRDrone3),
469  "FlatTrim failed");
470 }
471 
472 void Bebop::NavigateHome(const bool &start_stop)
473 {
474  ThrowOnInternalError("Navigate home failed");
476  device_controller_ptr_->aRDrone3->sendPilotingNavigateHome(
477  device_controller_ptr_->aRDrone3, start_stop ? 1 : 0),
478  "Navigate home failed");
479 }
480 
481 void Bebop::StartAutonomousFlight(const std::string &filepath)
482 {
483  ThrowOnInternalError("Start autonomous flight failed");
485  device_controller_ptr_->common->sendMavlinkStart(device_controller_ptr_->common, const_cast<char*>(filepath.c_str()), (eARCOMMANDS_COMMON_MAVLINK_START_TYPE)0),
486  "Start autonomous flight failed");
487 }
488 
490 {
491  ThrowOnInternalError("Pause autonomous flight failed");
493  device_controller_ptr_->common->sendMavlinkPause(device_controller_ptr_->common),
494  "Pause autonomous flight failed");
495 }
496 
498 {
499  ThrowOnInternalError("Stop autonomous flight failed");
501  device_controller_ptr_->common->sendMavlinkStop(device_controller_ptr_->common),
502  "Stop autonomous flight failed");
503 }
504 
505 void Bebop::AnimationFlip(const uint8_t &anim_id)
506 {
507  ThrowOnInternalError("Animation failed");
508  if (anim_id >= ARCOMMANDS_ARDRONE3_ANIMATIONS_FLIP_DIRECTION_MAX)
509  {
510  throw std::runtime_error("Inavlid animation id");
511  }
513  device_controller_ptr_->aRDrone3->sendAnimationsFlip(
514  device_controller_ptr_->aRDrone3, static_cast<eARCOMMANDS_ARDRONE3_ANIMATIONS_FLIP_DIRECTION>(
515  anim_id % ARCOMMANDS_ARDRONE3_ANIMATIONS_FLIP_DIRECTION_MAX)),
516  "Navigate home failed");
517 }
518 
519 void Bebop::Move(const double &roll, const double &pitch, const double &gaz_speed, const double &yaw_speed)
520 {
521  // TODO(mani-monaj): Bound check
522  ThrowOnInternalError("Move failure");
523 
524  // If roll or pitch value are non-zero, enabel roll/pitch flag
525  const bool do_rp = !((fabs(roll) < 0.001) && (fabs(pitch) < 0.001));
526 
527  // If all values are zero, hover
528  const bool do_hover = !do_rp && (fabs(yaw_speed) < 0.001) && (fabs(gaz_speed) < 0.001);
529 
530  if (do_hover)
531  {
532  ARSAL_PRINT(ARSAL_PRINT_DEBUG, LOG_TAG, "STOP");
534  device_controller_ptr_->aRDrone3->setPilotingPCMD(
535  device_controller_ptr_->aRDrone3,
536  0, 0, 0, 0, 0, 0));
537  }
538  else
539  {
541  device_controller_ptr_->aRDrone3->setPilotingPCMD(
542  device_controller_ptr_->aRDrone3,
543  do_rp,
544  static_cast<int8_t>(roll * 100.0),
545  static_cast<int8_t>(pitch * 100.0),
546  static_cast<int8_t>(yaw_speed * 100.0),
547  static_cast<int8_t>(gaz_speed * 100.0),
548  0));
549  }
550 }
551 
552 // in degrees
553 void Bebop::MoveCamera(const double &tilt, const double &pan)
554 {
555  ThrowOnInternalError("Camera Move Failure");
556  ThrowOnCtrlError(device_controller_ptr_->aRDrone3->setCameraOrientation(
557  device_controller_ptr_->aRDrone3,
558  static_cast<int8_t>(tilt),
559  static_cast<int8_t>(pan)));
560 }
561 
563 {
564  return video_decoder_ptr_->GetFrameWidth();
565 }
566 
568 {
569  return video_decoder_ptr_->GetFrameHeight();
570 }
571 
572 bool Bebop::GetFrontCameraFrame(std::vector<uint8_t> &buffer, uint32_t& width, uint32_t& height) const
573 {
574  boost::unique_lock<boost::mutex> lock(frame_avail_mutex_);
575 
576  ARSAL_PRINT(ARSAL_PRINT_DEBUG, LOG_TAG, "Waiting for frame to become available ...");
577  while (!is_frame_avail_)
578  {
579  frame_avail_cond_.wait(lock);
580  }
581 
582 // ARSAL_PRINT(ARSAL_PRINT_INFO, LOG_TAG, "COPY STARTED");
583  const uint32_t num_bytes = video_decoder_ptr_->GetFrameWidth() * video_decoder_ptr_->GetFrameHeight() * 3;
584  if (num_bytes == 0)
585  {
586  ARSAL_PRINT(ARSAL_PRINT_WARNING, LOG_TAG, "No picture size");
587  return false;
588  }
589  buffer.resize(num_bytes);
590  // New frame is ready
591  std::copy(video_decoder_ptr_->GetFrameRGBRawCstPtr(),
592  video_decoder_ptr_->GetFrameRGBRawCstPtr() + num_bytes,
593  buffer.begin());
594 
595  width = video_decoder_ptr_->GetFrameWidth();
596  height = video_decoder_ptr_->GetFrameHeight();
597  is_frame_avail_ = false;
598 // ARSAL_PRINT(ARSAL_PRINT_INFO, LOG_TAG, "COPY ENDED");
599  return true;
600 }
601 
603 {
604  ThrowOnInternalError("Snapshot Failure");
606  device_controller_ptr_->aRDrone3->sendMediaRecordPictureV2(
607  device_controller_ptr_->aRDrone3));
608 }
609 
610 void Bebop::SetExposure(const float& exposure)
611 {
612  ThrowOnInternalError("Failed to set exposure");
613  // TODO fairf4x: Check bounds ?
615  device_controller_ptr_->aRDrone3->sendPictureSettingsExpositionSelection(device_controller_ptr_->aRDrone3, (float)exposure)
616  );
617 }
618 
619 void Bebop::ToggleVideoRecording(const bool start)
620 {
621  ThrowOnInternalError("Video Toggle Failure");
622  ThrowOnCtrlError(device_controller_ptr_->aRDrone3->sendMediaRecordVideoV2(
623  device_controller_ptr_->aRDrone3,
624  start ? ARCOMMANDS_ARDRONE3_MEDIARECORD_VIDEOV2_RECORD_START :
625  ARCOMMANDS_ARDRONE3_MEDIARECORD_VIDEOV2_RECORD_STOP));
626 }
627 
628 void Bebop::ThrowOnInternalError(const std::string &message)
629 {
631  {
632  throw std::runtime_error(message);
633  }
634 }
635 
636 void Bebop::ThrowOnCtrlError(const eARCONTROLLER_ERROR &error, const std::string &message)
637 {
638  if (error != ARCONTROLLER_OK)
639  {
640  throw std::runtime_error(message + std::string(ARCONTROLLER_Error_ToString(error)));
641  }
642 }
643 
644 } // namespace bebop_driver
bool is_frame_avail_
Definition: bebop.h:106
static void StateChangedCallback(eARCONTROLLER_DEVICE_STATE new_state, eARCONTROLLER_ERROR error, void *bebop_void_ptr)
Definition: bebop.cpp:88
void MoveCamera(const double &tilt, const double &pan)
Definition: bebop.cpp:553
void UpdateSettings(const bebop_driver::BebopArdrone3Config &config)
Definition: bebop.cpp:420
void wait(unique_lock< mutex > &m)
callback_map_t callback_map_
Definition: bebop.h:101
boost::shared_ptr< VideoDecoder > video_decoder_ptr_
Definition: bebop.h:95
void ThrowOnCtrlError(const eARCONTROLLER_ERROR &error, const std::string &message=std::string())
Definition: bebop.cpp:636
uint32_t GetFrontCameraFrameWidth() const
Definition: bebop.cpp:562
std::string bebop_ip_
Definition: bebop.h:96
ARSAL_Sem_t state_sem_
Definition: bebop.h:94
static eARCONTROLLER_ERROR FrameReceivedCallback(ARCONTROLLER_Frame_t *frame, void *bebop_void_ptr)
Definition: bebop.cpp:168
boost::atomic< bool > is_connected_
Definition: bebop.h:88
void ThrowOnInternalError(const std::string &message=std::string())
Definition: bebop.cpp:628
void AnimationFlip(const uint8_t &anim_id)
Definition: bebop.cpp:505
static const char * LOG_TAG
Definition: bebop.h:87
void RequestAllSettings()
Definition: bebop.cpp:402
void NavigateHome(const bool &start_stop)
Definition: bebop.cpp:472
uint32_t GetFrontCameraFrameHeight() const
Definition: bebop.cpp:567
bool IsConnected() const
Definition: bebop.h:141
boost::condition_variable frame_avail_cond_
Definition: bebop.h:104
void ResetAllSettings()
Definition: bebop.cpp:410
static void CommandReceivedCallback(eARCONTROLLER_DICTIONARY_KEY cmd_key, ARCONTROLLER_DICTIONARY_ELEMENT_t *element_dict_ptr, void *bebop_void_ptr)
Definition: bebop.cpp:104
long int GetLWPId()
Definition: bebop.h:64
void TakeSnapshot()
Definition: bebop.cpp:602
bool GetFrontCameraFrame(std::vector< uint8_t > &buffer, uint32_t &width, uint32_t &height) const
Definition: bebop.cpp:572
static eARCONTROLLER_ERROR DecoderConfigCallback(ARCONTROLLER_Stream_Codec_t codec, void *bebop_void_ptr)
Definition: bebop.cpp:139
void StopAutonomousFlight()
Definition: bebop.cpp:497
ARCONTROLLER_Device_t * device_controller_ptr_
Definition: bebop.h:91
boost::mutex frame_avail_mutex_
Definition: bebop.h:105
void Move(const double &roll, const double &pitch, const double &gaz_speed, const double &yaw_speed)
Definition: bebop.cpp:519
void PauseAutonomousFlight()
Definition: bebop.cpp:489
void StopStreaming()
Definition: bebop.cpp:369
void SetDate(const std::string &date)
Definition: bebop.cpp:394
eARCONTROLLER_DEVICE_STATE device_state_
Definition: bebop.h:93
static Time now()
void StartAutonomousFlight(const std::string &filepath)
Definition: bebop.cpp:481
void notify_one() BOOST_NOEXCEPT
ARDISCOVERY_Device_t * device_ptr_
Definition: bebop.h:90
void ToggleVideoRecording(const bool start)
Definition: bebop.cpp:619
void Connect(ros::NodeHandle &nh, ros::NodeHandle &priv_nh, const std::string &bebop_ip="192.168.42.1")
Definition: bebop.cpp:236
void SetExposure(const float &exposure)
Definition: bebop.cpp:610
eARCONTROLLER_ERROR error_
Definition: bebop.h:92
void StartStreaming()
Definition: bebop.cpp:345
boost::atomic< bool > is_streaming_started_
Definition: bebop.h:89
Bebop(ARSAL_Print_Callback_t custom_print_callback=0)
Definition: bebop.cpp:210


bebop_driver
Author(s): Mani Monajjemi
autogenerated on Mon Jun 10 2019 12:58:56