yashsingh1/xdaforums huggingface dataset:
[Samsung Epic 4G Touch] Kjricker:
Yeah, I've been researching all day to try to find an answer, but I've come up with nothing. I've just found more reports of people having similar issues with other phones on CM builds, but never anyone with an idea how to fix it.

Using Sensor Box it appears the accelerometer works perfectly. The gyroscope also appears to work fine. It is the orientation sensor that is messed up.

I posted in this thread hoping the maintainer would see it. Until then I'll keep researching. I guess I'll make a backup up CM11 for now and go back to TouchWiz until I find something.
[Samsung Epic 4G Touch] Lanchon:
if you describe which axis of the phone corresponds to which axis of the sensor data and the direction of the correlation, i can check against a known good device and we can take it from there. describe how you obtained the sensor values.
[Samsung Epic 4G Touch] Kjricker:
Hmm I am not sure how to get you what you need, but I am willing to do whatever you need if you are willing to take a look at it Currently I am just using the app called Sesnor Box from the Play store. Using that I can check the various sensor in my phone. There is one called orientation. It shows some bubble levels. Here is what that screen looks like when the sensor is working properly with the phone face up on a level surface. On my phone I can only get the left-right bubble and the large circular level to center when the phone is face down.

I don't think this is the data you really need though. I'll look for an app that can log the data. That would probably be more useful to you.

I found an app to graph the rotational sensor. Here is a graph from that sensor.

This graph was captured starting with my phone face up. The value they call Roll starts out at -180. Then I tilted the phone from side to side. You can see how the Roll jumps from -180 up to 180. This happens each time my phone is coming back to level from being tilted either right or left. Then I held the phone above me with the face down. That is shown in the graph when the Roll value jumps from about -180 up to about 0. Then I proceeded to tilt the phone side to side again. You can see the smooth Roll value changes. It no longer jumps from -180 to 180. Is this of any help?
[Samsung Epic 4G Touch] Lanchon:
i dont care about orientation. all i care about is accelerometer.

describe which axis of the phone corresponds to which axis of the sensor data and the direction of the correlation.

use AndoSensor
[Samsung Epic 4G Touch] Kjricker:
Based on AndroSensor I get the same results as Sensor Kinetics. The orientation Sensor is what is off. Based on the apps help info, it is not a real sensor but a software one. It states that for Z rotation (Roll) 0 should be phone face up and 180 should be phone face down. For my phone the value jumps from 180 to -180 with the phone face up and 0 when the phone is face down. Very much the same thing I see when charted in the graph I added above.

For the Gyroscope. When laying flat all values for x and y and z are 0. When tilted the all behave as expected. Z corresponds to spinning the phone when it is laying flat spinng clockwise (positive) and spin counterclockwise (negative). X correspond to tilting the phone from one side to the next, right up (negative) and left up (positive). Y corresponds to tilting the phone from top up (positive) to bottom up (negative). So things really seem to be screwed up in the calculation of the orientation sensor.

I noticed the value for Z in the accelerometer is flipped. I should be at about 9.81 with the phone facing up, but mine reads around -9.81. When I flip my phone face down the value then become positive.
[Samsung Epic 4G Touch] Lanchon:
ok im sorry but i cant help because you dont do what i ask. as i told you before, its too hard without a test device. sorry, good night.
[Samsung Epic 4G Touch] Kjricker:
I am sorry too. I thought I was giving you the info you needed. I guess I just don't understand what you are asking. I tried to explain it in as much detail as I could with what each axis relates to and the value I get from them. After all this testing I think it may boil down to the fact that the accelerometer's z value is flipped (which I added while you responded). This is used to calculate the orientation sensor which then becomes flipped.

Anyhow. Thank you and good night as well.
[Samsung Epic 4G Touch] dastin1015:
I'm currently working on CM12, which is a PIA, and will be moving back to a closed source sensor blob as opposed to the open source variant since the open source one has issues
[Samsung Epic 4G Touch] Lanchon:
what issues?

---------- Post added at 09:27 AM ---------- Previous post was at 09:03 AM ----------

no you weren't. i asked you twice the same specific question about the accelerometer and twice you didn't reply and instead started talking about the orientation, a sensor about which i couldn't care less. i also don't care about what you think is wrong, i just need access to concise *data*.

so if you want my help answer exactly what i ask, and if you don't understand what i'm asking, explain exactly what you don't understand.

positions:

1) right side up: standing, left part of phone resting on a table.

2) top side up: standing, bottom part of phone resting on a table

3) front side up: flat lying on back, back of phone resting on a table

accelerometer test:

assumptions:

for each position:

-each axis should show roughly -10, 0, or +10

-there should be two axis showing 0 and one axis showing -10 or 10

task:

for each position:

-verify the assumptions above

-state the non-zero axis and its value

thanks
[Samsung Epic 4G Touch] Kjricker:
Okay. I can handle that. Thank you for the clarification of what you need.

positions:

1) right side up: standing, left part of phone resting on a table.

x = 10, y = 0, z = 0

2) top side up: standing, bottom part of phone resting on a table

x = 0, y =9.8, z = 0

3) front side up: flat lying on back, back of phone resting on a table

x = 0, y = 0, z = -9.8

As you stated, the numbers are roughly the values listed above. They are constantly changing slightly, but are roughly close to 10 or -10. I hope I got it right this time.
[Samsung Epic 4G Touch] Lanchon:
ok thank you!

rotations:

speed: rotate at around 90 degress per second, or faster if you want.

1) counterclockwise looking at right side

2) counterclockwise looking at top side

3) counterclockwise looking at front side

gyro test:

assumptions:

for each rotation:

-each axis should show roughly 0 or a "large number" in the range of 1 to 3 rad/s (which can be positive or negative)

-there should be two axis showing 0 and one axis showing a large number

task:

for each rotation:

-verify the assumptions above

-state the NAME of the axis that has the "large number" and the SIGN of said number.

thanks!
[Samsung Epic 4G Touch] Kjricker:
rotations:

1) counterclockwise looking at right side

y= positive values, x=0, z=0

2) counterclockwise looking at top side

x= positive values, y=0, z=0

3) counterclockwise looking at front side

z= negative values, x=0, y=0

Depending on how fast I spin the phone, the values could go as high as 10 or as low as -10. I also tested in clockwise rotation for each and the values were the opposite as expected.
[Samsung Epic 4G Touch] Lanchon:
excellent! that's all the info needed. (i don't think your device has a magnetometer does it? in any case, the magnetometer could wait.)

the data of the rest of the sensors is derived from these real sensors though sensor fusion algorithms. they will be magically fixed once real sensor data is fixed. i will look into this in a couple of days. you may want to keep CM, it shouldn't be terribly difficult to fix. thanks again!
[Samsung Epic 4G Touch] Kjricker:
No, thank you! I do believe my phone does have a magetometer. I see a Magnetic Filed sensor in Andro Sensor and values:

Magnetic Field: (6.8mA)

x:+31. µT

y:+14 µT

z:+24 µT

Σ:+42 µT
[Samsung Epic 4G Touch] HulkSmashBurgers:
It's weird. The magnet sensor seems to be pretty sensitive, yet I can't get Google Cardboard to work with the magnet you're supposed to use with it..
[Samsung Epic 4G Touch] Lanchon:
the CB was designed to work with the nexus 5. the magnetometer might be located elsewhere in your device.
[Samsung Epic 4G Touch] Lanchon:
do you own a vinyl turn table? an old record player by any chance?
[Samsung Epic 4G Touch] HulkSmashBurgers:
No. I do have a pair of speakers with 15" subwoofers, though. I've played around waving the phone around in front of them.
[Samsung Epic 4G Touch] Lanchon:
i wanted to test the gyroscope scale, since your reported 10 rad/s is quite large. when you rotate the phone at about 90 degrees per second, the indicator should be around 1.5 rad/s

i'm taking a look at this now.

the magnetometer will need to be tested too, but i'll leave that for later
[Samsung Epic 4G Touch] Lanchon:
sensor fix test

please:

1) take a nandroid backup

2) flash the attached fix

3) repeat the accel and gyro tests

thank you!

do you own a vinyl turn table? an old record player by any chance?
[Samsung Epic 4G Touch] HulkSmashBurgers:
Kjricker was the one doing all that. I'm not sure when I'll have time to contribute to that, and I'm guessing you'll want tests done on the same device (Kjricker's).
[Samsung Epic 4G Touch] Lanchon:
thanks! i thought i was talking to him all the time! lol
[Samsung Epic 4G Touch] Lanchon:
and finally the magnetometer...

first, find your 3D north:

a) choose a place away from metallic structures, electric circuits, etc.

b) find out the 2D north direction using a compass, another known-good cellphone, or however you like. (if you live in the northern hemisphere, the direction towards the sun at noon is roughly south.)

c) turn on the magnetometer sensor on the test cellphone.

d) calibrate the magnetometer by rotating the phone at least 360 degrees around each of its 3 axes.

e) hold the cellphone horizontally with the display facing up, and point the top of the cellphone towards the 2D north.

f) slowly tilt the top of the cellphone up and down, looking for the 3D north direction. when the magnetometer shows 2 of its axes nearly at zero, and the third axis at its largest value (either positive or negative), then the top of the phone is pointing into the 3D north.

g) REMEMBER THIS DIRECTION !!! it's the 3D north. (the 3D north will point in the same horizontal direction as the 2D north, but will not be in the horizontal plane: it will point partially into the ground or the sky.)

magnetometer test:

positions:

1) the right side of the phone pointing into the 3D north

2) the top side pointing into the 3D north

3) the display pointing into (facing) the 3D north

task:

for each position:

-adjust the position a bit so that 2 axes show roughly 0 and one axis shows a "large number"

-state the NAME of the axis that shows the "large number" and the SIGN of said number.

thanks!
[Samsung Epic 4G Touch] Lanchon:
aren't you going to test this?
[Samsung Epic 4G Touch] Kjricker:
Actually my wife just brought home her old record player for our son a couple weeks ago. I can use that.

I'll try the zip out tonight or tomorrow and report back. Thank you so much.
[Samsung Epic 4G Touch] Lanchon:
great thanks! there is a small window of time we can use to get this fix into CM11 M13 which will be the very last CM11, lets try to make it.

the turntable test is secondary in importance. you can do it after you check the zip. the idea is to test the magnitude of the gyro readings. put the turntable at its slowest speed (tell me which). place the phone as close to the spindle as possible. read the gyro Z value and tell me. thanks!
[Samsung Epic 4G Touch] theclarkster:
Thanks for your testing and fixing fellas! The gyroscope was the only thing that bothered me about this iteration of CM. I flashed the fix on my phone, and took a few photospheres and panoramas and they worked beautifully! It's the first time since we hit CM12 that this has worked properly. Appreciate all the hard work that's done!
[Samsung Epic 4G Touch] Lanchon:
lol thanks! this is no fix yet, just a test iteration, and for CM11. im glad it worked, more glad it didnt bootlooped your phone lol
[Samsung Epic 4G Touch] theclarkster:
Ha! I meant to say CM11. Just making sure you were paying attention ?. If it would have bootlooped, it wouldn't be the first time. I'd be happy to test any future potential fixes relating to the gyroscope/magnometer. Keep up the good work!
[Samsung Epic 4G Touch] dastin1015:
Merged your commit on gerrit. Should show up in the next nightly
[Samsung Epic 4G Touch] Mavrikmeercat:
I'll test too [MENTION=4141005]Lanchon[/MENTION] and do my best to make time to give you relevant results. Thanks helping with this

The gyroscope never worked correctly in anything but Touchwiz. I am also finding in the latest nightlies from about Dec. , there is a problem with the screen rotation. Stays in the vertical position even when set to rotate in settings.

I have a backup ( 11/23 ) that rotation works just fine. Never had a problem in cm before that.

This problem could be what was mentioned in the thread before
[Samsung Epic 4G Touch] Lanchon:
hi guys, and thank you for your offer to test. in order to finish fixing this and commiting it to CM i need these tests done:

requirements for these next 2 tests: recent CM11 build AND MY PREVIOS FIX FLASHED:

1) acceleromter test

2) gyro test

requirements for these next 2 tests: recent CM11 build (doesnt matter if my fix is flashed or not):

3) magnetometer test

4) turntable test

the first 2 tests validate the previous fix. the next 2 tests let me continue fixing the remaining issues.

thank you guys!!

---------- Post added at 04:30 AM ---------- Previous post was at 04:24 AM ----------

please note that the commit you merged just fixes an issue with the gyro state change. it is included in my fix above, but that alone does not fix the axes, etc. i'll push a change for that as soon as people get me the info i need and test the fix.

right now pending steps are: validate current accel & gyro fix, test magnetometer, fix magnetometer(*), validate magnetometer fix, push change(*). i can only do the (*) steps, for the others i need volunteers (have no device).
[Samsung Epic 4G Touch] Kjricker:
Sensor Tests

I am getting to testing right now. Sorry I was wiped out last night., I barely managed to get it flashed before I feel asleep. But I am rested and good to go now! I did do a quick test when I got up and the gyro seemed to be working as it should. I did the bubble level test and it worked great. I even played a game that did not work previously and it worked great. I'll be doing all the tests and reporting back within the hour. Time to go find the little turntable!

Somehow I missed the earlier post about the magnetometer test, sorry about that.

---------- Post added at 10:55 AM ---------- Previous post was at 10:25 AM ----------

Okay here are the basic tests. It'll take me a bit to do the magnetometer test, but I am on it.

Accelerometer:

positions:

1) right side up: standing, left part of phone resting on a table.

x = 9.9, y = 0, z = 0

2) top side up: standing, bottom part of phone resting on a table

x = 0, y =9.8, z = 0

3) front side up: flat lying on back, back of phone resting on a table

x = 0, y = 0, z = 9.7

At each orientation the values I have listed as 0, are not truly 0. They fluctuate between very low values like .01 to a maximum of .5.

Gyroscope:

rotations:

1) counterclockwise looking at right side

x= positive values, y=0, z=0

2) counterclockwise looking at top side

y= positive values, x=0, z=0

3) counterclockwise looking at front side

z= positive values, x=0, y=0

Depending on how fast I spin the phone, the values could go as high as 10 or as low as -10. The vaules look like they could go higher, but the graph cuts them off at 10 and -10. I also tested in clockwise rotation for each and the values were the opposite as expected.

Turntable test:

Record player set at 33:

z= ~ -3.58

Record player set at 45:

z= ~ -4.81

Magnetometer:

positions:

Right side of phone pointing to 3d north:

z= positive value

Top side pointing to 3d north:

z= positive value

Face to 3d north bottom on ground:

y= positive value

Face to 3d north top on ground:

y= negative value

Face to 3d north right side on ground:

x= positive value

Face to 3d north left side on ground:

x= negative value
[Samsung Epic 4G Touch] Lanchon:
thank you!

-the accelerometer axes are fixed

-the gyro axes are fixed

:good:

the gyro scaling is ok, no need to fix:

33+(1/3): http://www.wolframalpha.com/input/?i=3.58+rad/s+in+rpm

45: http://www.wolframalpha.com/input/?i=4.81+rad/s+in+rpm

i will wait for your magnetometer test to finish this and commit it. thanks!
[Samsung Epic 4G Touch] Kjricker:
I've added the magnetometer results above as well. As my results seemed off, I did more tests than you listed.
[Samsung Epic 4G Touch] Lanchon:
thanks! something's off with the procedure. i can't continue with that data. maybe you can redo the test or someone else might want to try.

please note:

1) the 3D north direction is usually NOT horizontal.

2) if you point any of the major axes of the phone (on either side) into the 3D north direction, two of the readings should become zero (with the 3rd one being large (either + or -, depending on the side of the phone chosen)).

3) if you now rotate the phone about the chosen major axis (or the 3D north direction, which is the same), the two readings that were zero SHOULD CONTINUE TO BE ZERO. (rotating the phone 90 degrees should be enough to test this.)

in particular, if the 3rd condition doesn't hold, it means that you did not identify the 3D north direction correctly.
[Samsung Epic 4G Touch] Kjricker:
I can redo the tests, but I'll try to describe exactly what I did.

First I did the test as you wrote. I used my tablet to find where north truly is, since on my phone it is reversed (north is actually south and vice versa). The tablet showed north properly as I know where north is at my location. I then took the phone and pointed the top of the phone toward 2d north. Next I tilted the phone up and down until the y value was 0. At this point x and y were 0 and z was a positive value. If I do the same test with my tablet, x and y are zero, but z is a negative value:

Next I rotated the phone 90 degrees so the right side of the phone is pointing toward 3d north:

Here is the phone where I rotated the phone 90 degrees from the original position. So now the screen is pointing toward 3d north with the top of the phone pointing down.

Next the phone is rotated 90 degrees . The screen is still facing 3d north, but now the right side of the phone is down:

I then rotated the phone 90 degrees so the screen is still facing 3d north but now it is top up.
[Samsung Epic 4G Touch] Lanchon:
thank you!

i think the problem seems to be that the 3D north is actually 90 degrees away from you thought it was.

to find the 3D north with your tablet:

-find a position of the tablet where Y axis is a POSITIVE "large" number and X and Z are ZERO.

-the direction pointed to by the top of the table is 3D north.

i think in your case the 3D north will point well into the ground. (which i guess means you are in the northern hemisphere?)

in any case, once you find 3D north, please repeat:

thanks again for the trouble!!

---------- Post added at 06:51 PM ---------- Previous post was at 06:42 PM ----------

accel and gyro fix pushed to gerrit:

http://review.cyanogenmod.org/#/c/86259/
[Samsung Epic 4G Touch] Kjricker:
I'll do that right after dinner. Checking the tablet again, I did have to orient it so that it was pointing almost straight down to get y a large value and x and z at 0. I am in the north hemisphere at N 35°51'21.92'' W -84°5'27.649''.

---------- Post added at 07:53 PM ---------- Previous post was at 06:55 PM ----------

Okay. I did it again. Hopefully right this time. I aligned the phone with 2d north, then I tilted the top DOWN this time so y had a large value and x and z were 0. I am being rushed to do family stuff. If I skipped anything let me know and I'll get it done tonight.

Top pointing toward 3d north (top of phone pointing down):

y = negative

Right side pointing toward 3d north (top of phone pointing left):

x= positive value

Screen pointing to 3d north (top of phone pointing to me):

z=negative value
[Samsung Epic 4G Touch] Lanchon:
it looks just right this time, thank! ill do a fix asap.
[Samsung Epic 4G Touch] po8pimp:
Success

It was a bit difficult finding all the right pieces to get this up and running, however mission accomplished. I am running this with the ExtremeKernelv2 and so far it is very nice. The visual is outstanding, and I will report back with any bugs I may find. I am also planning on adding the Mod Extreme All in One Tweak Pack v3.0 after I play around a bit with this. I will let you know how this all plays out. Thanks for bringing new life to this Phone.

Edit: read about the MOD Extreme All in One Tweak. Not gonna do it. Not designed for 4.4. It is for 4.0-4.3 at the moment. Not gonna be a guinea pig on this one :) Thanks again this Build is awesome.
[Samsung Epic 4G Touch] Lanchon:
that kernel predates FPBug fix. don't use any pre-FPBug kernel. you can try my trim kernel if you want, or else latest official CM nightly has the fix too.
[Samsung Epic 4G Touch] Lanchon:
here's the final fix, all sensors should be working now.

after flashing the fix, please redo the magnetometer test to verify that everything is alright, so i can push the changes to CM.

this should be the last test if everything goes well. thank you very much for your help!!
[Samsung Epic 4G Touch] po8pimp:
I am using the most recent CM11, do I still need a different kernel?
[Samsung Epic 4G Touch] Kjricker:
A quick test shows everything working. I'll do a more substantial testing within the hour.

It is nice to be able to stay on CM. Thank you for bearing with me and working thru the fixes.

---------- Post added at 09:48 AM ---------- Previous post was at 09:01 AM ----------

Magnetometer Test:

Top pointing toward 3d north (top of phone pointing down):

y =positive value

Right side pointing toward 3d north (top of phone pointing left):

x= positive value

Screen pointing to 3d north (top of phone pointing to me):

z=postive value

Accelerometer:

positions:

1) right side up: standing, left part of phone resting on a table.

x = 9.9, y = 0, z = 0

2) top side up: standing, bottom part of phone resting on a table

x = 0, y =9.8, z = 0

3) front side up: flat lying on back, back of phone resting on a table

x = 0, y = 0, z = 9.7

Gyroscope:

rotations:

1) counterclockwise looking at right side

x= positive values, y=0, z=0

2) counterclockwise looking at top side

y= positive values, x=0, z=0

3) counterclockwise looking at front side

z= positive values, x=0, y=0

These tests were done using CM-11-20150118-Nightly and the sensor-fix-v2-d710.zip file.

This is great. Now I just need to go back and read the trim thread to learn how to do that properly and I am all set.
[Samsung Epic 4G Touch] Lanchon:
great, thank you very much!

full fix in these 2 commits:

http://review.cyanogenmod.org/#/c/86320/

http://review.cyanogenmod.org/#/c/86259/

let's hope [MENTION=3257303]dastin1015[/MENTION] can review and merge them on time. in the meantime you can safely use my fix.

just install my trim d710 kernel and manually run the 4 fstrim commands and you are done.

and if you feel more adventurous you can repartition your device to get 6GB /data for apps and 1GB /system (think lollipop).

thanks!
[Samsung Epic 4G Touch] Kjricker:
I assume your kernel has to be re-flashed everytime CM11 is updated? I do feel rather adventurous. The E4GT has so little room for apps setup the default way. I'd love to open that up. I think I'll dig into that as well.
[Samsung Epic 4G Touch] Lanchon:
yes. CM will step over it on every flash. if you dont find proper PITs for your device, post a link to the stock PIT (or you can download it from your device) in my d710 trim thread and ill make one for you.

recommend 6 or 8gb data, 1gb system, no preload.
[Samsung Epic 4G Touch] dastin1015:
Merged