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

Pitch and roll values are reversed In real machine. #1075

Closed
mbitfun opened this issue Aug 12, 2018 · 27 comments
Closed

Pitch and roll values are reversed In real machine. #1075

mbitfun opened this issue Aug 12, 2018 · 27 comments
Assignees
Labels
bug device For bugs that repro on the device next-release

Comments

@mbitfun
Copy link

mbitfun commented Aug 12, 2018

Describe the bug

In simulator the pitch and roll values are correct.
But, In real machine pitch and roll values are reversed

To Reproduce

Please check in real machine.

microbit-screenshot

Desktop (please complete the following information):

  • OS: Windows10
  • Browser Chrome
  • Version 68
@guillaumejenkins
Copy link
Contributor

Good catch, this is a regression as it only happens in /beta

@guillaumejenkins guillaumejenkins added bug v1 device For bugs that repro on the device labels Aug 13, 2018
@guillaumejenkins
Copy link
Contributor

@jaustin has something changed in the micro:bit framework around rotation? Our rotation API hasn't changed at all since v0. The functions are exactly the same:

v0: https://github.com/Microsoft/pxt-microbit/blob/master/libs/core/input.cpp#L310
v1: https://github.com/Microsoft/pxt-microbit/blob/v1/libs/core/input.cpp#L321

enum class Rotation {
    //% block=pitch
    Pitch = 0,
    //% block=roll
    Roll = 1,
};

int rotation(Rotation kind) {
    switch (kind) {
        case Rotation::Pitch: return uBit.accelerometer.getPitch();
        case Rotation::Roll: return uBit.accelerometer.getRoll();
    }
    return 0;
}

@guillaumejenkins
Copy link
Contributor

Maybe @finneyj or @jamesadevine would have some info as well?

@jaustin
Copy link
Collaborator

jaustin commented Aug 14, 2018

Looks strongly like we broke this in the DAL, as the 'dal-integration' instance of v0 gets this wrong too.

@finneyj we should fix our axes!

DAL bug lancaster-university/microbit-dal#371

(PS this reminds me of #799 - which would have helped a lot here!)

@finneyj
Copy link

finneyj commented Aug 15, 2018

Thanks @guillaumejenkins, @jaustin. @mbitfun.

Curious - we definitely checked the axes were consistent after the patch. Will check again...

@finneyj
Copy link

finneyj commented Aug 15, 2018

Just built up two fresh C++ native test cases for the current HEAD revision of microbit-dal master, and the HEAD revision of dal-integration (which should translate to the versions compared above).

The accelerometer data coming out of the device driver via getX(), getY() and getZ() is consistent in terms of magnitude and axis alignment, so the issue must be constrained to the pitch and roll computation a little further up the stack... will dig some more.

@abchatra
Copy link
Contributor

abchatra commented Sep 5, 2018

@finneyj any update here?

@finneyj
Copy link

finneyj commented Sep 5, 2018

hi @abchatra

yep - should be fixed in the dal-integration-2 beta...

@abchatra
Copy link
Contributor

abchatra commented Sep 5, 2018

Thanks @finneyj We will validate and close this bug.

@finneyj
Copy link

finneyj commented Sep 5, 2018

thanks @abchatra. Let me know if you have any issues.

@guillaumejenkins
Copy link
Contributor

guillaumejenkins commented Sep 5, 2018

@finneyj Jonny mentioned new config parameters for the build, to enable legacy pitch/roll. Where can I find info on those flags, and where must I enable them?

@finneyj
Copy link

finneyj commented Sep 5, 2018

@guillaumejenkins

Indeed, there's a compile time option that we should keep for v0. For v1 we'd like to move to the new full range values that make pitch and roll consistent with each other.

For legacy compat, you should set this #define to '0' :
https://github.com/lancaster-university/microbit-dal/blob/dal-integration/inc/core/MicroBitConfig.h#L329

there should be an option to allow you to flip this in your config.json file, but I'm afraid I forgot to add some glue in dal-integration-2 to let this happen.

Jonny and I are happy for the v0 beta to be a little inconsistent until the next release where we'll fix it, if that's ok with you?

@pelikhan
Copy link
Member

pelikhan commented Sep 6, 2018

@finneyj you mean we take this drop and introduce the small bug for v0. looks ok to me.

@finneyj
Copy link

finneyj commented Sep 6, 2018

@pelikhan

Yep, it's a very minor bug we can live with until the next drop.

@jaustin
Copy link
Collaborator

jaustin commented Sep 6, 2018

A couple if things: @pelikhan dal-integration-2 shouldn't be going to live yet, just v0-beta and v1-beta. I'd argue this is more incomplete fix than it is new bug, but it's still not the final state of affairs. @finneyj perhaps it's worth picking the yotta config name now so the MakeCode team can set the config in advance of the DAL arriving with it?

@finneyj
Copy link

finneyj commented Sep 6, 2018

I'd argue it's a bugfix. ;)

let's go with this for config.json

{
    "microbit-dal":
    {
        "full_range_pitch_calculation": 0
    }
}

@finneyj
Copy link

finneyj commented Sep 6, 2018

@pelikhan @guillaumejenkins

FYI, I've added the glue logic for this into the HEAD revision of the dal-integration branch, ready for the next tag.

lancaster-university/microbit-dal@83e1795

@guillaumejenkins
Copy link
Contributor

@finneyj just to clarify, you only added the flag to dal-integration, not the full fix, correct? To test the fix we should still have our beta sites point to dal-integration-2?

@finneyj
Copy link

finneyj commented Sep 6, 2018

@guillaumejenkins HEAD revision of the dal-integration branch now contains the full fix, including the config.json glue that was missing yesterday. No tag on that yet though, pending other changes. If it's a big problem for you, let us know and i'll do an interim tag, but I'm happy to wait until we do another scheduled tag.

@pelikhan
Copy link
Member

pelikhan commented Sep 6, 2018 via email

@finneyj
Copy link

finneyj commented Sep 6, 2018

Just on the train with a draining battery… can it wait an hour?

@pelikhan
Copy link
Member

pelikhan commented Sep 6, 2018

Of course no worries.

@finneyj
Copy link

finneyj commented Sep 6, 2018

actually, I just made it with a few minute to spare. ;)

dal-integration-3

no time to test though, so please shout if you have problems

@guillaumejenkins
Copy link
Contributor

Works well, thanks! We'll release this to our beta websites shortly

@finneyj
Copy link

finneyj commented Sep 6, 2018

great stuff. thanks @guillaumejenkins.

@guillaumejenkins
Copy link
Contributor

Fix will be in the following releases:

  • v0: v0.14.48
  • v1: v1.1.47

@lock
Copy link

lock bot commented Sep 25, 2019

This thread has been automatically locked since there has not been
any recent activity after it was closed. Please open a new issue for
related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Sep 25, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug device For bugs that repro on the device next-release
Projects
None yet
Development

No branches or pull requests

6 participants