mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-07-16 08:10:35 +08:00
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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user