Skip to content

Commit

Permalink
disallowed arming=true when in realworld
Browse files Browse the repository at this point in the history
  • Loading branch information
klaxalk committed Apr 18, 2024
1 parent 6653963 commit c5fb768
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,15 @@ std::tuple<bool, std::string> MrsUavPx4Api::callbackArming([[maybe_unused]] cons

mavros_msgs::CommandLong srv_out;

// when REALWORLD AND ARM:=TRUE
if (!_simulation_ && request) {

ss << "can not arm by service when not in simulation! You should arm the drone by the RC controller only!";
ROS_ERROR_STREAM_THROTTLE(1.0, "[Px4Api]: " << ss.str());

return {srv_out.response.success, ss.str()};
}

srv_out.request.broadcast = false;
srv_out.request.command = 400; // the code for arming
srv_out.request.confirmation = true;
Expand Down

0 comments on commit c5fb768

Please sign in to comment.