Skip to content

AMC-975: Allow to select supported vehicle and to skip telemetry radi…#976

Merged
amilcarlucas merged 1 commit into
ArduPilot:masterfrom
flyasky:feature/AMC-975
Oct 27, 2025
Merged

AMC-975: Allow to select supported vehicle and to skip telemetry radi…#976
amilcarlucas merged 1 commit into
ArduPilot:masterfrom
flyasky:feature/AMC-975

Conversation

@flyasky

@flyasky flyasky commented Oct 26, 2025

Copy link
Copy Markdown

…o as another system on the same connection

Possible fix for #975
pushed with --no-verify

pylint..........................................................................Failed
- hook id: pylint
- exit code: 1

Failed to canonicalize script path

mypy............................................................................Failed
- hook id: mypy
- exit code: 1

Copilot AI review requested due to automatic review settings October 26, 2025 00:06
@flyasky flyasky requested a review from amilcarlucas as a code owner October 26, 2025 00:06

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR enhances the MAVLink connection logic to detect multiple vehicles on the same connection and handle unsupported autopilot types more gracefully. Instead of failing immediately when an unsupported vehicle is detected, the system now continues searching for a supported vehicle within the timeout period.

Key Changes:

  • Modified heartbeat detection to collect all vehicles detected within the timeout window
  • Changed behavior to skip unsupported autopilot types instead of returning an error immediately
  • Updated logging messages to reflect the multi-vehicle detection capability
Comments suppressed due to low confidence (1)

ardupilot_methodic_configurator/backend_flightcontroller.py:493

  • The loop continues when an unsupported autopilot is found but never breaks or returns when a supported autopilot is found. This means after processing a supported vehicle, the code falls through to line 498 and beyond, but self.info state may be set incorrectly if multiple vehicles were detected. The loop should explicitly break after line 493 for a supported vehicle, or return success at that point.
            for (sysid, compid), m in detected_vehicles.items():
                self.info.set_system_id_and_component_id(sysid, compid)
                logging_debug(
                    _("Connection established with systemID %d, componentID %d."), self.info.system_id, self.info.component_id
                )
                self.info.set_autopilot(m.autopilot)
                if self.info.is_supported:
                    msg = _("Autopilot type {self.info.autopilot}")
                    logging_info(msg.format(**locals()))
                else:
                    msg = _("Unsupported autopilot type {self.info.autopilot}")
                    # return msg.format(**locals())
                    continue

                self.info.set_type(m.type)
                msg = _("Vehicle type: {self.info.mav_type} running {self.info.vehicle_type} firmware")
                logging_info(msg.format(**locals()))

Comment on lines +474 to +477
if not detected_vehicles:
return _("No MAVLink heartbeat received, connection failed.")
self.info.set_system_id_and_component_id(m.get_srcSystem(), m.get_srcComponent())
logging_debug(
_("Connection established with systemID %d, componentID %d."), self.info.system_id, self.info.component_id
)

self.info.set_autopilot(m.autopilot)
if self.info.is_supported:
msg = _("Autopilot type {self.info.autopilot}")
logging_info(msg.format(**locals()))
else:
msg = _("Unsupported autopilot type {self.info.autopilot}")
return msg.format(**locals())
for (sysid, compid), m in detected_vehicles.items():

Copilot AI Oct 26, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After the loop completes (line 477-494), there's no handling for the case where all detected vehicles are unsupported. The code should return an error message after the loop if no supported vehicle was found, otherwise it will continue to line 498 with potentially incorrect vehicle state.

Copilot uses AI. Check for mistakes.
logging_info(msg.format(**locals()))
else:
msg = _("Unsupported autopilot type {self.info.autopilot}")
# return msg.format(**locals())

Copilot AI Oct 26, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commented-out code should be removed rather than left in the codebase. If this is temporary for debugging or comparison, add a TODO comment explaining why it's retained.

Suggested change
# return msg.format(**locals())

Copilot uses AI. Check for mistakes.
Allow to select supported vehicle and to skip
telemetry radio as another system on the same connection
amilcarlucas
amilcarlucas previously approved these changes Oct 26, 2025

@amilcarlucas amilcarlucas left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution.
I corrected the linting issues, squashed the commits and rewrote the commit message to obey conventional commits standards.

@amilcarlucas

Copy link
Copy Markdown
Collaborator

Tested in windows, works for both udp and tcp

@amilcarlucas amilcarlucas merged commit aac4638 into ArduPilot:master Oct 27, 2025
27 of 28 checks passed
@flyasky flyasky deleted the feature/AMC-975 branch October 28, 2025 19:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants