{"action":"opened","issue":{"url":"https://api.github.com/repos/mfosse/JoyCon-Driver/issues/75","repository_url":"https://api.github.com/repos/mfosse/JoyCon-Driver","labels_url":"https://api.github.com/repos/mfosse/JoyCon-Driver/issues/75/labels{/name}","comments_url":"https://api.github.com/repos/mfosse/JoyCon-Driver/issues/75/comments","events_url":"https://api.github.com/repos/mfosse/JoyCon-Driver/issues/75/events","html_url":"https://github.com/mfosse/JoyCon-Driver/issues/75","id":312534984,"number":75,"title":"Gyro calibration data not being used as offset","user":{"login":"JibbSmart","id":6497881,"avatar_url":"https://avatars2.githubusercontent.com/u/6497881?v=4","gravatar_id":"","url":"https://api.github.com/users/JibbSmart","html_url":"https://github.com/JibbSmart","followers_url":"https://api.github.com/users/JibbSmart/followers","following_url":"https://api.github.com/users/JibbSmart/following{/other_user}","gists_url":"https://api.github.com/users/JibbSmart/gists{/gist_id}","starred_url":"https://api.github.com/users/JibbSmart/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JibbSmart/subscriptions","organizations_url":"https://api.github.com/users/JibbSmart/orgs","repos_url":"https://api.github.com/users/JibbSmart/repos","events_url":"https://api.github.com/users/JibbSmart/events{/privacy}","received_events_url":"https://api.github.com/users/JibbSmart/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-04-09T13:40:08Z","updated_at":"2018-04-09T13:40:08Z","closed_at":null,"author_association":"NONE","body":"Hi Matt, it's me again.\r\n\r\nWe talked before about how I thought the factory and user sensor calibration data are supposed to be used as offsets for the raw sensor input (rather than multipliers), and now I'm more confident this is the case.\r\n\r\nWhen I calibrate my JoyCons using the Switch's system settings, the user sensor calibration data gets set, as one would expect. Then I've hex-dumped the calibration data, as well as the raw sensor data over several seconds worth of polling while leaving the JoyCons untouched on my desk.\r\n\r\nEach JoyCon has a different small offset (on average) on their resting gyro output. And this offset, for each device, is approximately the same as the corresponding device's user gyro calibration numbers if they've been calibrated recently in the Switch system settings. Subtracting the user calibration data from the gyro data before using it results in much less drift.\r\n\r\nI recommend trying it out yourself.\r\n\r\nBut the actionable item here is: your (excellent, really useful) tool should subtract the sensor_cal data from their corresponding gyro / accel before being used. Eg:\r\n`jc->gyro.roll = (float)(uint16_to_int16(packet[19] | (packet[20] << 8) & 0xFF00) - jc->sensor_cal[1][0]) * ...conversion_to_SI;`\r\n\r\nThanks for your time!"}}
{"actor":{"display_login":"JibbSmart"}}