mavlink / rust-mavlink

MAVLink library for Rust.
https://mavlink.github.io/rust-mavlink/mavlink/
Apache License 2.0
158 stars 79 forks source link

Fix sequence order in serialization function #204

Closed IhsenBouallegue closed 1 year ago

IhsenBouallegue commented 1 year ago

I am currently doing my bachelor's degree about MAVLink and LoRa. I decided to use rust and therefore rust-mavlink. I need to serialize and deserialize MavFrames to send them over the LoRa link. While doing that, I noticed a weird behavior of the deser function. The order of serializing the header fields (system_id, component_id and sequence) does not align with the order of deserialization.

Here is a screenshot showing the problem image

Order of serialization image

Old order of deserialization image

Also, if you look closely, the values are all over the place and do not match (it's not a corrupt message problem). I am going to open a separate issue for that (https://github.com/mavlink/rust-mavlink/issues/205), as I am still investigating it and is not related to the header.

IhsenBouallegue commented 1 year ago

Hi @IhsenBouallegue, thanks for identifying the problem! But the issue is in the serialization and not on deserialization. The order behind it is explained here: https://mavlink.io/en/guide/serialization.html

Oh I blindly assumed that the serialization is the right one. I will switch that one then. Thanks for the catch!

patrickelectric commented 1 year ago

Fix #205