Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AP_ADSB: uAvionix Transponder Updates #28419

Merged

Conversation

nicholas-inocencio
Copy link
Contributor

@nicholas-inocencio nicholas-inocencio commented Oct 16, 2024

Replaces #28411, which targeted the wrong branch.

This PR contains updates to the interface with the ping200X. Co-requisite with the MissionPlanner PR ArduPilot/MissionPlanner#3429

Changes:

  • Added parsing for GDL90 Transponder Status V3
    • Fixes buggy behavior when ping200X has both UCP and UCP-HD out protocols enabled
    • Includes new fields for on-ground state, board temperature, NIC, and NACp.
  • Improved behavior when ping200X times out (due to power loss, serial connection error, etc.)
    • UAVIONIX_ADSB_OUT_STATUS_FAULT_STATUS_MESSAGE_UNAVAIL is now 1 if the GDL90 ownship, transponder status, and heartbeat have been missed for 10 seconds, and is otherwise 0 when one of those messages is received. See the co-requisite MissionPlanner PR for changes to how the GCS handles that field.
  • Fixed NIC indication when using ArduPilot's GPS as a GPS source for the ping200X
    • Setting ADSB_OPTIONS=1, which forwarded the AP's GPS data to the transponder, would result in a NIC of UNKNOWN due to an invalid HPL
    • HPL is now estimated using the horizontal accuracy
  • Improved initialization of control message and frontend status
    • Attempts to poll ping200X for config message to set the control message defaults
    • Fixes a display error where a squawk of 0 was listed when the transponder had never been powered before connecting to the GCS

@nicholas-inocencio
Copy link
Contributor Author

@magicrub Your help is appreciated!

@magicrub
Copy link
Contributor

@nicholas-inocencio I haven't looked through all the changes quite yet but a quick glance shows me that the whitespace needs some tweaking to follow our code style guide. Also, the commits need to get squashed. I suggest 2 commits: anything in your API AP_ADSB/GDL90_protocol/ (and maybe code in the driver that is specific to those API/struct changes) and then everything else in AP_ADSB.

@nicholas-inocencio
Copy link
Contributor Author

@nicholas-inocencio I haven't looked through all the changes quite yet but a quick glance shows me that the whitespace needs some tweaking to follow our code style guide. Also, the commits need to get squashed. I suggest 2 commits: anything in your API AP_ADSB/GDL90_protocol/ (and maybe code in the driver that is specific to those API/struct changes) and then everything else in AP_ADSB.

(Apologies, I accidentally closed the PR.)

Thanks Tom, I'll take a good look at the style guide and commit guidelines.

@nicholas-inocencio
Copy link
Contributor Author

nicholas-inocencio commented Oct 17, 2024

@magicrub The entirety of GDL90_Message_Structs.h (and hostGDL90Support.h) are using 2-space indents instead of 4 as the style guide prescribes. Should I correct this in this PR, or only fix the lines I changed?

EDIT: I fixed all the style changes in a separate commit.

@magicrub
Copy link
Contributor

for your own SDK type stuff we don't care about the style, just the stuff in the ArduPilot libraries that others would be looking at and/or potentially editing.

Copy link
Contributor

@magicrub magicrub left a comment

Choose a reason for hiding this comment

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

How does this effect older Ping200X units that aren't using v3?

// We want to use the defaults stored on the ping200X, if possible.
// Until we get the config message (or we've tried requesting it several times),
// don't send the control message.
if (run_state.last_packet_Transponder_Config_ms != 0 || run_state.request_Transponder_Config_tries >= 5) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This will always be true. the _ms != 0 is always non-zero because you set it above so there's no change from previous behavior

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is checking _Config, not _Control; _Config is only updated by handle_msg case GDL90_ID_TRANSPONDER_CONFIG.

Comment on lines 286 to 287
const uint32_t now_ms = AP_HAL::millis();
run_state.last_gcs_send_message_Transponder_Status_ms = now_ms;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
const uint32_t now_ms = AP_HAL::millis();
run_state.last_gcs_send_message_Transponder_Status_ms = now_ms;
run_state.last_gcs_send_message_Transponder_Status_ms = AP_HAL::millis();

Copy link
Contributor

Choose a reason for hiding this comment

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

If you want to cache the time, thats fine.. but do it above the millis() check a couple lines up so both take advantage of it

@nicholas-inocencio
Copy link
Contributor Author

How does this effect older Ping200X units that aren't using v3?

Using a tool available online, older ping200X units can be field configured to send v3.

Even if it only got v1, ArduPilot would work fine. The important thing is that handle_msg uses different structs (transponder_status_v3 vs. transponder_status) for each version because the fields have different offsets. The fields absent from v1 are non-critical or have other sources; NIC_NACp is the most important one and it can be read from the ownship report.

AP_ADSB: uAvionix Transponder Status V3

+ Current version of ping200X sends the v1 status message periodically and the v3 status message in response to the transponder control message, so ardupilot needs to handle both gracefully; version 1 and version 3 are very different in structure and naively assuming one version over another will cause errors.

AP_ADSB: Process additional xpdr status v3 fields

AP_ADSB: Send GCS xpdr status at least every 10s

AP_ADSB: Send ping200X estimated HPL

+ When AP sends the ping200X the GPS data GDL90 message, it needs to provide a valid HPL for the ping200X to report a valid NIC.

AP_ADSB: Don't send unsolicited transponder status

AP_ADSB: Better initialization of xpdr id/config

AP_ADSB: Better initialization of frontend status

AP_ADSB: Suggestions from review
@magicrub
Copy link
Contributor

@nicholas-inocencio I just did a bench test and it's looking good. I backported it to my 4.5 branch and it was a clean cherry-pick. In my particular test I didn't have GPS lock so I couldn't reliably transmit but I that's just my setup. Your code seems to be operating OK so far. I'll test again with a proper setup on Friday and if that goes well we can merge it

@magicrub magicrub merged commit c270c39 into ArduPilot:master Oct 31, 2024
98 checks passed
@magicrub
Copy link
Contributor

Fully tested and merged, thanks @nicholas-inocencio !

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.

2 participants