MAVLink: support mavlink 2.1 32 bit system IDs#33734
Conversation
51c0de0 to
b5cd14b
Compare
c7f01f7 to
76eb4fc
Compare
76eb4fc to
8c631c4
Compare
Pulls in the MAVLink2.1 32 bit system ID and extended target header support (MAVLINK_IFLAG_SYSID32 / MAVLINK_IFLAG_TARGETTED) from mavlink/rfcs#20.
Widen system ID handling throughout for MAVLink2.1 32 bit system IDs (mavlink/rfcs#20): - MAV_SYSID, MAV_GCS_SYSID and MAV_GCS_SYSID_HI become AP_Int32 with parameter width conversion. Values must stay below 2^24 until the parameter transport moves away from float32 - routing table entries, get_targets() and find_by_mavtype use the new mavlink_msg_get_target_sysid/compid helpers so targets in the extended TARGETTED header are routed correctly - send_message_target() lets raw payload struct senders pass a possibly 32 bit target for the extended header; used by the mission and FTP reply paths - send_to_components() passes our sysid so component relays work when our sysid is over 255 - packet_overhead_chan() accounts for the extended header bytes - MANUAL_CONTROL target check uses the TARGETTED-aware getter
Widen gimbal and target sysid storage and pass 32 bit targets via the extended header aware send path.
Widen camera sysid storage and pass 32 bit targets via the extended header aware send path.
Widen source/target system IDs in the MAVC log message and the MAVLink log transfer target.
FOLL_SYSID becomes AP_Int32 with parameter width conversion. Values must stay below 2^24 until the parameter transport moves away from float32.
SYSID_TARGET becomes AP_Int32 with parameter width conversion.
Reboots with MAV_SYSID 100000, checks the SYSID32 extended header is used, fetches parameters from a source system over 255, and runs mission upload and arming checks at the new sysid.
Widen the CAN forwarding requester system ID so replies to a 32 bit GCS are not aliased.
Accept 32 bit sysids in MAV_CMD_DO_FOLLOW.
The component ID was compared against the last source system ID instead of the last source component ID.
The Lua MAVLink module and scripts parse the in-memory mavlink_message_t structure; the wider sysid moved the compid, msgid and payload offsets, and the CRC check must reconstruct the wire header from the incompat flags. The extended header target is exposed as target_sysid/target_compid. Users often copy current scripts onto older firmware, so the layout is detected at runtime from the structure size: 291 bytes for the older 1 byte sysid layout, 299 bytes for the 32 bit sysid layout. The same scripts work on both firmware generations.
8c631c4 to
b45972c
Compare
|
Automated review note — AI-generated (Claude), validated against the live diff and cross-checked by a second AI reviewer (Codex). Please sanity-check before acting. Verdict: REQUEST CHANGES — the widening is coherent and careful (param width conversions, extended-header targeting, routing, Lua dual-layout handling, and the 100000-sysid autotest all check out), but three sysid truncation sites remain in-tree that break when a >255 sysid is actually used:
Positive notes: the |
Summary
Implements 32 bit system IDs
See also:
Classification & Testing (check all that apply and add your own)
Description
This implements mavlink/rfcs#20 but with 32 bit system IDs to allow for IPv4 addresses to be used for system IDs. This should make large drone light shows easier.
I also plan on making full 32 bit integers work with mavlink parameters to make this more practical for real IPv4 addresses. That will be a separate effort
Some open questions: