AndersMalmgren / FreePIE

Programmable Input Emulator
645 stars 144 forks source link

Freepie Psmove is 180 degrees rotated #114

Open tomazcdn opened 7 years ago

tomazcdn commented 7 years ago

Hello im with a big issue,im using psmove on freepie to make positional tracking on steamvr,but when i turn on it is rotating to 180 degrees back,i need to make the orientation of freepie 180 degrees to back on X axis to try solve my problem,so im using this code:

def update(): freeTrack.pitch = -freePieIO[0].pitch math.cos(freePieIO[0].yaw/2) - freePieIO[0].roll math.sin(freePieIO[0].yaw/2) freeTrack.roll = - freePieIO[0].pitch math.sin(freePieIO[0].yaw/2) + freePieIO[0].roll math.cos(freePieIO[0].yaw/2) freeTrack.yaw = freePieIO[0].yaw

#Multiply by 10 for SteamVR use
freeTrack.x = (freePieIO[0].x * 10)
freeTrack.y = (freePieIO[0].y * 10)
freeTrack.z = (freePieIO[0].z * 10)

if starting: freePieIO[0].update += update

Here a video showing whats my issue (the psmove need to go front and view too,but its inverting the action,i mean my psmove go to front and my view to back) link: https://www.youtube.com/watch?v=H6ziMvFzwLE

if there is a audio on this video,please ignore or mute. Thank you very much,any help is very welcome

MarijnS95 commented 7 years ago

That's as simple as inverting (negating) the movement on the two horizontal axes (which are x and y, or x and z, I don't know what coordinate space these things use).

tomazcdn commented 7 years ago

Thanks for the big tip,i will try to change it on freepie,but im not good on programming so im trying to manage how im going to invert it... i use 180 or (-1) ?

MarijnS95 commented 7 years ago

By adding a minus sign to the respective calculations, so that would be:

freeTrack.x = -freePieIO[0].x * 10
freeTrack.y = -freePieIO[0].y * 10
freeTrack.z = freePieIO[0].z * 10

or

freeTrack.x = -freePieIO[0].x * 10
freeTrack.y = freePieIO[0].y * 10
freeTrack.z = -freePieIO[0].z * 10

depending on the coordinate system.

tomazcdn commented 7 years ago

hmm good idea... i did solve the problem just right now,it was on trinus gyre aplication,it says (use 0 instead of -1) so i let -1...but i will try your solution because my own isnt that good

tomazcdn commented 7 years ago

yeah your solution didnt worked..atleast not the - withot the (freepie...) i mean without " ( ) " so i finished leting the problem solved on trinus gyre... the solution is: dont change the "rotIndex":-1, thank you very much