@@ -172,9 +172,11 @@ bool DJIMatricePSDKPlatform::ownSetOffboardControl(bool offboard)
172
172
{
173
173
if (!offboard) {
174
174
// Release control authority
175
+ RCLCPP_INFO (this ->get_logger (), " Releasing control authority" );
175
176
return setControlAuthority (false );
176
177
}
177
- return true ;
178
+ RCLCPP_INFO (this ->get_logger (), " Obtain control authority" );
179
+ return setControlAuthority (true );
178
180
}
179
181
180
182
bool DJIMatricePSDKPlatform::ownSetPlatformControlMode (const as2_msgs::msg::ControlMode & msg)
@@ -196,7 +198,7 @@ bool DJIMatricePSDKPlatform::ownSetPlatformControlMode(const as2_msgs::msg::Cont
196
198
{
197
199
// Obtain control authority
198
200
RCLCPP_INFO (this ->get_logger (), " HOVER || SPEED MODE: Obtain control authority" );
199
- success = setControlAuthority ( true ) ;
201
+ success = ctl_authority_ ;
200
202
break ;
201
203
}
202
204
default :
@@ -275,6 +277,9 @@ bool DJIMatricePSDKPlatform::ownTakeoff()
275
277
bool success = result && response->success ;
276
278
if (!success) {
277
279
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 ));
278
283
}
279
284
return success;
280
285
}
@@ -289,6 +294,9 @@ bool DJIMatricePSDKPlatform::ownLand()
289
294
bool success = result && response->success ;
290
295
if (!success) {
291
296
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 ));
292
300
}
293
301
return success;
294
302
}
0 commit comments