Skip to content

9 dji m30t cannot obtain control authority but dji example works #10

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions src/as2_platform_dji_psdk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,9 +172,11 @@ bool DJIMatricePSDKPlatform::ownSetOffboardControl(bool offboard)
{
if (!offboard) {
// Release control authority
RCLCPP_INFO(this->get_logger(), "Releasing control authority");
return setControlAuthority(false);
}
return true;
RCLCPP_INFO(this->get_logger(), "Obtain control authority");
return setControlAuthority(true);
}

bool DJIMatricePSDKPlatform::ownSetPlatformControlMode(const as2_msgs::msg::ControlMode & msg)
Expand All @@ -196,7 +198,7 @@ bool DJIMatricePSDKPlatform::ownSetPlatformControlMode(const as2_msgs::msg::Cont
{
// Obtain control authority
RCLCPP_INFO(this->get_logger(), "HOVER || SPEED MODE: Obtain control authority");
success = setControlAuthority(true);
success = ctl_authority_;
break;
}
default:
Expand Down Expand Up @@ -275,6 +277,9 @@ bool DJIMatricePSDKPlatform::ownTakeoff()
bool success = result && response->success;
if (!success) {
RCLCPP_INFO(this->get_logger(), "Could not takeoff due to '%s'", response->message.data());
} else {
// sleep 10 seconds to wait for the takeoff
rclcpp::sleep_for(std::chrono::seconds(10));
}
return success;
}
Expand All @@ -289,6 +294,9 @@ bool DJIMatricePSDKPlatform::ownLand()
bool success = result && response->success;
if (!success) {
RCLCPP_INFO(this->get_logger(), "Could not land due to '%s'", response->message.data());
} else {
// sleep 10 seconds to wait for the land
rclcpp::sleep_for(std::chrono::seconds(10));
}
return success;
}
Expand Down