mavlink: no acks for commands that aren't for us

We should not send out acks for commands that are not targetted at us.
This can confuse other MAVLink components and MAVLink commands just
don't scale that way, and it unnecessarily fills up our ack queue.

This was likely introduced to debug when MAVLink components were
implemented incorrectly sending commands to a wrong target.

The most we should do in this case is to print/log an info.
This commit is contained in:
Julian Oes
2024-10-31 10:10:40 +13:00
parent b37a31b3a1
commit 25e071e21d
+2 -2
View File
@@ -566,10 +566,10 @@ void MavlinkReceiver::handle_message_command_both(mavlink_message_t *msg, const
uint8_t progress = 0; // TODO: should be 255, 0 for backwards compatibility
if (!target_ok) {
// Reject alien commands only if there is no forwarding or we've never seen target component before
if (!_mavlink.get_forwarding_on()
|| !_mavlink.component_was_seen(cmd_mavlink.target_system, cmd_mavlink.target_component, _mavlink)) {
acknowledge(msg->sysid, msg->compid, cmd_mavlink.command, vehicle_command_ack_s::VEHICLE_CMD_RESULT_FAILED);
PX4_INFO("Ignore command %d from %d/%d to %d/%d",
cmd_mavlink.command, msg->sysid, msg->compid, cmd_mavlink.target_system, cmd_mavlink.target_component);
}
return;