Skip to content

Commit

Permalink
Hack for PX4 auto-tune
Browse files Browse the repository at this point in the history
  • Loading branch information
DonLakeFlyer committed Nov 16, 2023
1 parent 570548a commit 2f9b78d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/Vehicle/Vehicle.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3277,7 +3277,13 @@ void Vehicle::_handleCommandAck(mavlink_message_t& message)
int entryIndex = _findMavCommandListEntryIndex(message.compid, static_cast<MAV_CMD>(ack.command));
if (entryIndex != -1) {
if (ack.result == MAV_RESULT_IN_PROGRESS) {
MavCommandListEntry_t commandEntry = _mavCommandList.at(entryIndex); // Command has not completed yet, don't remove
MavCommandListEntry_t commandEntry;
if (px4Firmware() && ack.command == MAV_CMD_DO_AUTOTUNE_ENABLE) {
// HacK to support PX4 autotune which does not send final result ack and just sends in progress
commandEntry = _mavCommandList.takeAt(entryIndex);
} else {
commandEntry = _mavCommandList.at(entryIndex); // Command has not completed yet, don't remove
}

commandEntry.maxTries = 1; // Vehicle responsed to command so don't retry
commandEntry.elapsedTimer.restart(); // We've heard from vehicle, restart elapsed timer for no ack received timeout
Expand Down

0 comments on commit 2f9b78d

Please sign in to comment.