{"action":"created","issue":{"url":"https://api.github.com/repos/thp/psmoveapi/issues/160","labels_url":"https://api.github.com/repos/thp/psmoveapi/issues/160/labels{/name}","comments_url":"https://api.github.com/repos/thp/psmoveapi/issues/160/comments","events_url":"https://api.github.com/repos/thp/psmoveapi/issues/160/events","html_url":"https://github.com/thp/psmoveapi/issues/160","id":59411706,"number":160,"title":"Work in Progress: Dead Reckoning - Open for Discussion","user":{"login":"ccoenen","id":124909,"avatar_url":"https://avatars.githubusercontent.com/u/124909?v=3","gravatar_id":"","url":"https://api.github.com/users/ccoenen","html_url":"https://github.com/ccoenen","followers_url":"https://api.github.com/users/ccoenen/followers","following_url":"https://api.github.com/users/ccoenen/following{/other_user}","gists_url":"https://api.github.com/users/ccoenen/gists{/gist_id}","starred_url":"https://api.github.com/users/ccoenen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ccoenen/subscriptions","organizations_url":"https://api.github.com/users/ccoenen/orgs","repos_url":"https://api.github.com/users/ccoenen/repos","events_url":"https://api.github.com/users/ccoenen/events{/privacy}","received_events_url":"https://api.github.com/users/ccoenen/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-03-01T18:47:39Z","updated_at":"2015-03-01T21:06:41Z","closed_at":null,"body":"I started implementing dead-reckoning, and it is far enough to discuss it with others. It comes with some caveats, though:\r\n\r\n* It only runs on windows (i used windows threads, and windows Sleep(ms), but this can be fixed easily, i think).\r\n* It frankenstein-patches the `example` for now (seemed the easiest choice)\r\n* It **drifts HEAVILY**\r\n* It should, at a later point, be cleaned up and probably go into a different file. I put it in psmove.c (for the most part) because, again, it was the easiest place starting out.\r\n* There's lots of debug output in there and a hardcoded reset, that would not be very good in production use :D\r\n\r\nSo, here it goes: https://github.com/ccoenen/psmoveapi/tree/dead-reckoning-discuss\r\n\r\nI am using a thread with a [game-engine like locked framerate](https://github.com/ccoenen/psmoveapi/blob/dead-reckoning-discuss/src/psmove.c#L1960). I did this, because many papers on the subject stress how important a constant timer is. Then, i did this series of steps:\r\n\r\n* [Getting the orientation](https://github.com/ccoenen/psmoveapi/blob/dead-reckoning-discuss/src/psmove.c#L1905)\r\n* [Rotate gravity into controller coordinates](https://github.com/ccoenen/psmoveapi/blob/dead-reckoning-discuss/src/psmove.c#L1910)\r\n* [Combine Controller Acceleration and (rotated) gravity](https://github.com/ccoenen/psmoveapi/blob/dead-reckoning-discuss/src/psmove.c#L1926)\r\n* move->cax ... move->caz now contain the controller acceleration, in controller coordinates without gravity\r\n* I'm [rotating this back into global coordinates](https://github.com/ccoenen/psmoveapi/blob/dead-reckoning-discuss/src/psmove.c#L1936), which will yield the controller acceleration in global scope i the variables move->gax ... move->gaz\r\n* Then, i'm just [integrating](https://github.com/ccoenen/psmoveapi/blob/dead-reckoning-discuss/src/psmove.c#L1944) for velocity (global coordinates)\r\n* And [again](https://github.com/ccoenen/psmoveapi/blob/dead-reckoning-discuss/src/psmove.c#L1952) for position (global coordinates)\r\n\r\n\r\nAs i said, it drifts extremely and is not really usable at the moment. I'm not sure if this can be improved enough to be useful ever.\r\n\r\nI'd love to hear everyone's suggestions!\r\n"},"comment":{"url":"https://api.github.com/repos/thp/psmoveapi/issues/comments/76630737","html_url":"https://github.com/thp/psmoveapi/issues/160#issuecomment-76630737","issue_url":"https://api.github.com/repos/thp/psmoveapi/issues/160","id":76630737,"user":{"login":"ccoenen","id":124909,"avatar_url":"https://avatars.githubusercontent.com/u/124909?v=3","gravatar_id":"","url":"https://api.github.com/users/ccoenen","html_url":"https://github.com/ccoenen","followers_url":"https://api.github.com/users/ccoenen/followers","following_url":"https://api.github.com/users/ccoenen/following{/other_user}","gists_url":"https://api.github.com/users/ccoenen/gists{/gist_id}","starred_url":"https://api.github.com/users/ccoenen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ccoenen/subscriptions","organizations_url":"https://api.github.com/users/ccoenen/orgs","repos_url":"https://api.github.com/users/ccoenen/repos","events_url":"https://api.github.com/users/ccoenen/events{/privacy}","received_events_url":"https://api.github.com/users/ccoenen/received_events","type":"User","site_admin":false},"created_at":"2015-03-01T21:06:40Z","updated_at":"2015-03-01T21:06:40Z","body":"Yes, sure! I just thought its so raw right now that i'd discuss it first."}}