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

Wrong byte order for RollPitchYaw<i16> field #7

Open
DeepSOIC opened this issue Jun 29, 2023 · 1 comment
Open

Wrong byte order for RollPitchYaw<i16> field #7

DeepSOIC opened this issue Jun 29, 2023 · 1 comment

Comments

@DeepSOIC
Copy link

I have added a new message type (ParamsExtData) to get encoder offsets from the gimbal.
The values I get are "y-p-r: -2292, -27384, 0", and the actual values are "3319, 2197, 0".

#[derive(BgcPayload, Clone, Debug, PartialEq)]
pub struct ParamsExtData {
    //...stuf stuff stuff...

    ///units: 0.02197265625 deg, aka 2^14 units per turn
    #[kind(payload)]
    #[size(6)]
    pub encoder_offset: RollPitchYaw<i16>,

    //...more stuff...
}

converting the byte order on -2292:

>>> hex(-2292+65536)
'0xf70c'
>>> 0x0cf7
3319
>>> 
@DeepSOIC
Copy link
Author

followup: if i explode the RollPitchYaw into three raw i16 fields, the values are read correctly.

DeepSOIC added a commit to DeepSOIC/simplebgc-rs that referenced this issue Jul 3, 2023
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

No branches or pull requests

1 participant