diff --git a/src/FirmwarePlugin/PX4/PX4FirmwarePlugin.cc b/src/FirmwarePlugin/PX4/PX4FirmwarePlugin.cc index 2cb1c3f0bc63257c4e0ec2afbc75b10fe57427d7..188da227fb950f3f941e53d6446d2d89dea4c747 100644 --- a/src/FirmwarePlugin/PX4/PX4FirmwarePlugin.cc +++ b/src/FirmwarePlugin/PX4/PX4FirmwarePlugin.cc @@ -428,16 +428,30 @@ void PX4FirmwarePlugin::guidedModeGotoLocation(Vehicle* vehicle, const QGeoCoord return; } - vehicle->sendMavCommand(vehicle->defaultComponentId(), - MAV_CMD_DO_REPOSITION, - true, // show error is fails - -1.0f, - MAV_DO_REPOSITION_FLAGS_CHANGE_MODE, - 0.0f, - NAN, - gotoCoord.latitude(), - gotoCoord.longitude(), - vehicle->altitudeAMSL()->rawValue().toFloat()); + if (vehicle->capabilityBits() && MAV_PROTOCOL_CAPABILITY_COMMAND_INT) { + vehicle->sendMavCommandInt(vehicle->defaultComponentId(), + MAV_CMD_DO_REPOSITION, + MAV_FRAME_GLOBAL, + true, // show error is fails + -1.0f, + MAV_DO_REPOSITION_FLAGS_CHANGE_MODE, + 0.0f, + NAN, + gotoCoord.latitude(), + gotoCoord.longitude(), + vehicle->altitudeAMSL()->rawValue().toFloat()); + } else { + vehicle->sendMavCommand(vehicle->defaultComponentId(), + MAV_CMD_DO_REPOSITION, + true, // show error is fails + -1.0f, + MAV_DO_REPOSITION_FLAGS_CHANGE_MODE, + 0.0f, + NAN, + gotoCoord.latitude(), + gotoCoord.longitude(), + vehicle->altitudeAMSL()->rawValue().toFloat()); + } } void PX4FirmwarePlugin::guidedModeChangeAltitude(Vehicle* vehicle, double altitudeChange) diff --git a/src/Vehicle/Vehicle.cc b/src/Vehicle/Vehicle.cc index e8ea30bf4f5501af1fc9abc3fd070eb921161739..cdd1d130d7bc7282f19d148f0c2e99011b5d0d4a 100644 --- a/src/Vehicle/Vehicle.cc +++ b/src/Vehicle/Vehicle.cc @@ -2978,7 +2978,6 @@ void Vehicle::_sendMavCommandAgain(void) &msg, &cmd); } else { - mavlink_message_t msg; mavlink_command_long_t cmd; memset(&cmd, 0, sizeof(cmd));