From b5487a72053e9e476c4b82a68afb8f8bd1cfc3b0 Mon Sep 17 00:00:00 2001 From: itssme Date: Sun, 21 Oct 2018 19:28:59 +0200 Subject: [PATCH 1/4] changed config and launch file for bebop2 --- bebop_driver/config/defaults.yaml | 1 + bebop_driver/launch/bebop_node.launch | 2 +- bebop_driver/launch/bebop_nodelet.launch | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/bebop_driver/config/defaults.yaml b/bebop_driver/config/defaults.yaml index 4ce12e2..cf2fd3e 100644 --- a/bebop_driver/config/defaults.yaml +++ b/bebop_driver/config/defaults.yaml @@ -19,6 +19,7 @@ states: enable_autotakeoffmodechanged: true enable_mediastreamingstate_videoenablechanged: true enable_camerastate_orientation: true + enable_camerastate_orientationv2: true enable_gpsstate_numberofsatellitechanged: true enable_numberofsatellitechanged: true diff --git a/bebop_driver/launch/bebop_node.launch b/bebop_driver/launch/bebop_node.launch index f28797e..f74005e 100644 --- a/bebop_driver/launch/bebop_node.launch +++ b/bebop_driver/launch/bebop_node.launch @@ -2,7 +2,7 @@ - + diff --git a/bebop_driver/launch/bebop_nodelet.launch b/bebop_driver/launch/bebop_nodelet.launch index 048fcf6..87ddbbe 100644 --- a/bebop_driver/launch/bebop_nodelet.launch +++ b/bebop_driver/launch/bebop_nodelet.launch @@ -2,7 +2,7 @@ - + From 0d2ed23af5dcc3c5ac9de65bc7f584a7d18b6df5 Mon Sep 17 00:00:00 2001 From: itssme Date: Sun, 21 Oct 2018 19:32:20 +0200 Subject: [PATCH 2/4] changed camera_state_orientation to version2 as v1 is deprecated (see: https://developer.parrot.com/docs/reference/bebop/index.html#move-the-camera-deprecated) --- .../bebop_driver/autogenerated/ardrone3_state_callbacks.h | 3 +++ bebop_driver/src/bebop.cpp | 6 +++--- bebop_driver/src/bebop_driver_nodelet.cpp | 6 +++--- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/bebop_driver/include/bebop_driver/autogenerated/ardrone3_state_callbacks.h b/bebop_driver/include/bebop_driver/autogenerated/ardrone3_state_callbacks.h index 87c63cc..f633508 100644 --- a/bebop_driver/include/bebop_driver/autogenerated/ardrone3_state_callbacks.h +++ b/bebop_driver/include/bebop_driver/autogenerated/ardrone3_state_callbacks.h @@ -1605,6 +1605,9 @@ class Ardrone3CameraStateOrientationV2 : public AbstractState { ARSAL_PRINT(ARSAL_PRINT_INFO, "CB" , "[STATES] Enabling %s", topic.c_str()); ros_pub_ = nh.advertise(topic, 10, true); + ::boost::lock_guard lock(mutex_); + msg_ptr.reset(new ::bebop_msgs::Ardrone3CameraStateOrientationV2()); + ros_pub_.publish(msg_ptr); } // pub_enabled_ is false } diff --git a/bebop_driver/src/bebop.cpp b/bebop_driver/src/bebop.cpp index d2664c1..5564109 100644 --- a/bebop_driver/src/bebop.cpp +++ b/bebop_driver/src/bebop.cpp @@ -553,10 +553,10 @@ void Bebop::Move(const double &roll, const double &pitch, const double &gaz_spee void Bebop::MoveCamera(const double &tilt, const double &pan) { ThrowOnInternalError("Camera Move Failure"); - ThrowOnCtrlError(device_controller_ptr_->aRDrone3->setCameraOrientation( + ThrowOnCtrlError(device_controller_ptr_->aRDrone3->setCameraOrientationV2( device_controller_ptr_->aRDrone3, - static_cast(tilt), - static_cast(pan))); + static_cast(tilt), + static_cast(pan))); } uint32_t Bebop::GetFrontCameraFrameWidth() const diff --git a/bebop_driver/src/bebop_driver_nodelet.cpp b/bebop_driver/src/bebop_driver_nodelet.cpp index 1deca22..e5dc45c 100644 --- a/bebop_driver/src/bebop_driver_nodelet.cpp +++ b/bebop_driver/src/bebop_driver_nodelet.cpp @@ -482,7 +482,7 @@ void BebopDriverNodelet::AuxThread() util::ResetTwist(zero_twist); // Camera Pan/Tilt State - bebop_msgs::Ardrone3CameraStateOrientation::ConstPtr camera_state_ptr; + bebop_msgs::Ardrone3CameraStateOrientationV2::ConstPtr camera_state_ptr; // East-South-Down bebop_msgs::Ardrone3PilotingStateSpeedChanged::ConstPtr speed_esd_ptr; @@ -568,9 +568,9 @@ void BebopDriverNodelet::AuxThread() } } - if (bebop_ptr_->ardrone3_camerastate_orientation_ptr) + if (bebop_ptr_->ardrone3_camerastate_orientationV2_ptr) { - camera_state_ptr = bebop_ptr_->ardrone3_camerastate_orientation_ptr->GetDataCstPtr(); + camera_state_ptr = bebop_ptr_->ardrone3_camerastate_orientationV2_ptr->GetDataCstPtr(); if ((camera_state_ptr->header.stamp - last_camerastate_time).toSec() > util::eps) { From 5e92a150f215c19736fc957964f35d7bd9082dee Mon Sep 17 00:00:00 2001 From: itssme Date: Sun, 21 Oct 2018 21:45:20 +0200 Subject: [PATCH 3/4] fixed typo that caused an compile error --- bebop_driver/src/bebop_driver_nodelet.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bebop_driver/src/bebop_driver_nodelet.cpp b/bebop_driver/src/bebop_driver_nodelet.cpp index e5dc45c..f49d1b6 100644 --- a/bebop_driver/src/bebop_driver_nodelet.cpp +++ b/bebop_driver/src/bebop_driver_nodelet.cpp @@ -568,9 +568,9 @@ void BebopDriverNodelet::AuxThread() } } - if (bebop_ptr_->ardrone3_camerastate_orientationV2_ptr) + if (bebop_ptr_->ardrone3_camerastate_orientationv2_ptr) { - camera_state_ptr = bebop_ptr_->ardrone3_camerastate_orientationV2_ptr->GetDataCstPtr(); + camera_state_ptr = bebop_ptr_->ardrone3_camerastate_orientationv2_ptr->GetDataCstPtr(); if ((camera_state_ptr->header.stamp - last_camerastate_time).toSec() > util::eps) { From 28856cbb1af8cca08470e6ced0c3e5bae4a39de2 Mon Sep 17 00:00:00 2001 From: itssme Date: Mon, 22 Oct 2018 11:06:21 +0200 Subject: [PATCH 4/4] fixed bug that orientationV2 was not updated until the camera was moved --- bebop_driver/src/bebop_driver_nodelet.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/bebop_driver/src/bebop_driver_nodelet.cpp b/bebop_driver/src/bebop_driver_nodelet.cpp index f49d1b6..2d1dc60 100644 --- a/bebop_driver/src/bebop_driver_nodelet.cpp +++ b/bebop_driver/src/bebop_driver_nodelet.cpp @@ -483,6 +483,7 @@ void BebopDriverNodelet::AuxThread() // Camera Pan/Tilt State bebop_msgs::Ardrone3CameraStateOrientationV2::ConstPtr camera_state_ptr; + bebop_ptr_->MoveCamera(0.0, 0.0); // East-South-Down bebop_msgs::Ardrone3PilotingStateSpeedChanged::ConstPtr speed_esd_ptr;