Skip to content

Commit 910451f

Browse files
committed
check control authority before go to, add sleep after takeoff and land
1 parent cef5775 commit 910451f

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/as2_platform_dji_psdk.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,7 @@ bool DJIMatricePSDKPlatform::ownSetPlatformControlMode(const as2_msgs::msg::Cont
198198
{
199199
// Obtain control authority
200200
RCLCPP_INFO(this->get_logger(), "HOVER || SPEED MODE: Obtain control authority");
201+
success = ctl_authority_;
201202
break;
202203
}
203204
default:
@@ -276,6 +277,9 @@ bool DJIMatricePSDKPlatform::ownTakeoff()
276277
bool success = result && response->success;
277278
if (!success) {
278279
RCLCPP_INFO(this->get_logger(), "Could not takeoff due to '%s'", response->message.data());
280+
} else {
281+
// sleep 10 seconds to wait for the takeoff
282+
rclcpp::sleep_for(std::chrono::seconds(10));
279283
}
280284
return success;
281285
}
@@ -290,6 +294,9 @@ bool DJIMatricePSDKPlatform::ownLand()
290294
bool success = result && response->success;
291295
if (!success) {
292296
RCLCPP_INFO(this->get_logger(), "Could not land due to '%s'", response->message.data());
297+
} else {
298+
// sleep 10 seconds to wait for the land
299+
rclcpp::sleep_for(std::chrono::seconds(10));
293300
}
294301
return success;
295302
}

0 commit comments

Comments
 (0)