Minecrift Discussion Thread

Post Reply
Croccy22
Cross Eyed!
Posts: 140
Joined: Wed Feb 04, 2009 7:51 am

Re: Minecrift Discussion Thread

Post by Croccy22 »

mabrowning wrote:
Croccy22 wrote: Thanks for the info. I will look into the plugin infrastructure eventually but at page 200 of Java for dummies there is still a few things I need to understand (Done classes, objects, methods, constructors, super/sub classes, extending classes. Not done anything about interfaces or implements yet!).

I guess I also need to look into Github at some point as i've never used that before apart from downloading stuff.

I'm hoping the whole FreePIE thing plays out and we can emulate the Hydra. But I still want to learn Java a bit better as I only ever wrote Android apps before. If I can get to the point where I can write a new input plugin I would consider my goal complete :P

Thanks, Matt.
Out of curiosity, does the build system work for you? Or have you not tested your code changes yet, just hacking on the files?

Interfaces are really simple; they just specify methods signatures that all classes that "implement" the interface must provide definitions for. Think of it like a base class without any method bodies. You'll get there! Java isn't the best language in the world, but it is the 2nd most popular. ;)
Yeah the build system seemed to work fine. Made some changes, ran build.bat. Launched the installer and then ran the mincrift-1.6.2-LOCAL. Simples :)
Croccy22
Cross Eyed!
Posts: 140
Joined: Wed Feb 04, 2009 7:51 am

Re: Minecrift Discussion Thread

Post by Croccy22 »

OMG!!!! The FreePIE stuff works!!!!! :D

Installed the latest version of Minecrift. Opened up the C:\Users\username\AppData\Roaming\.minecraft\libraries\com\sixense\SixenseJavaLibrary\062612.0\SixenseJavaLibrary-062612.0-natives-windows.jar file and removed the sixense.dll file and replaced it with the sixense.dll file from the FreePIE thread.

Then using this script:

Code: Select all

def update():
    global yaw
    yaw = math.radians(-ahrsImu.yaw)
    global pitch
    pitch = math.radians(ahrsImu.pitch)
    global roll
    roll = math.radians(ahrsImu.roll)

if starting:
    centerYaw = 0
    centerPitch = 0
    centerRoll = 0
   
    yaw = 0
    pitch = 0
    roll = 0
    ahrsImu.update += update

hydra[0].yaw  = yaw - centerYaw
hydra[0].pitch = pitch - centerPitch
hydra[0].roll = roll - centerRoll

if keyboard.getKeyDown(Key.Z):
    centerYaw = yaw
    centerPitch = pitch
    centerRoll = roll
    
if keyboard.getKeyDown(Key.O):
	hydra[0].trigger = 1
	
if keyboard.getKeyDown(Key.P):
	hydra[1].trigger = 1
I launched FreePIE and setup my AHRS Imu and then ran the script. Started Minecrift which asked me to press the left trigger ('O' key on keyboard) and then the right trigger ('P' key on keyboard). Everything then just kicked into life. I looked straight ahead and pressed the 'Z' key which in my script re-centers everything.

My options in VR Mode are using Hydra for Head tracking, neck model for body position (At the moment :P).

I have set Keyhole width to fully coupled, Keyhole moves with head to yes, pitch affects camera to off and decouple look/move to on.

This allows me to walk around using the mouse to control my body but I am free to look around with my head as I please.

My next step is to have a play around with my PS Move and use that for body tracking since I can now emulate this also with FreePIE.

Yaaahhooooooo!!! :P

Matt.
mabrowning
Binocular Vision CONFIRMED!
Posts: 289
Joined: Wed May 15, 2013 12:48 pm
Location: Texas, USA
Contact:

Re: Minecrift Discussion Thread

Post by mabrowning »

So, no need for a UDP pulgin?

Glad you got your DIY working. :) If you have any gameplay/UI/controls comments, do let us know!
Croccy22
Cross Eyed!
Posts: 140
Joined: Wed Feb 04, 2009 7:51 am

Re: Minecrift Discussion Thread

Post by Croccy22 »

mabrowning wrote:So, no need for a UDP pulgin?

Glad you got your DIY working. :) If you have any gameplay/UI/controls comments, do let us know!
I think now FreePIE can emulate the hydra minecrift can support all sorts of headtracking devices without any additional plugins. :)

I do have one problem though and I will try my best to explain it. In minecraft if I look forward and then look up and down it works as expected. However if I look 90 degrees to the left and look up/down instead of the pitch changing, the camera rolls instead?

I am too tired to work this out tonight so i'm going to sleep on it. The pitch is obviously working as it works when you look forward. I am wondering if it is a difference in how the hydras work compared to the ahrsImu. Due to how exact it is (looking forward pitch works 100%, looking 90deg left roll is 100%, look 45deg left and pitch is 50% and roll is 50%) I guess an equation here could solve the issue but I would be more interested to know why the issue exists in the first place.

Matt.
mabrowning
Binocular Vision CONFIRMED!
Posts: 289
Joined: Wed May 15, 2013 12:48 pm
Location: Texas, USA
Contact:

Re: Minecrift Discussion Thread

Post by mabrowning »

Croccy22 wrote:I do have one problem though and I will try my best to explain it. In minecraft if I look forward and then look up and down it works as expected. However if I look 90 degrees to the left and look up/down instead of the pitch changing, the camera rolls instead?
Yuuuup. Euler angles. Either you've done your pitch,yaw,roll differently than the FreePIE plugin expects, or the FreePIE plugin has bugs with its Euler angle code. If you want your mind to melt, try to comprehend this wikipedia article on the subject. Suffice to say, the order in which you apply pitch, yaw, roll matters a lot.

Edit: I just read the FreePIE post with CyberVillian explaining how he goes from pitch,yaw,roll to the rotation matrix; sounds like he's using sixense::Mat3::rotation(), so I'd find out from him what order he is applying them in.
Last edited by mabrowning on Mon Jul 22, 2013 3:12 pm, edited 1 time in total.
StellaArtois
Sharp Eyed Eagle!
Posts: 436
Joined: Wed Apr 10, 2013 4:07 am
Location: UK

Re: Minecrift Discussion Thread

Post by StellaArtois »

Croccy22 wrote:OMG!!!! The FreePIE stuff works!!!!!
Fantastic! 8-)
User avatar
Jademalo
Binocular Vision CONFIRMED!
Posts: 249
Joined: Sun Apr 14, 2013 12:03 pm

Re: Minecrift Discussion Thread

Post by Jademalo »

http://www.reddit.com/r/oculus/comments ... minecrift/

Looks like I'm not the only one, and the mod is having issues with the rift not being plugged in.

In other news, PROCESSING!
:D
Croccy22
Cross Eyed!
Posts: 140
Joined: Wed Feb 04, 2009 7:51 am

Re: Minecrift Discussion Thread

Post by Croccy22 »

Right well I couldn't go to sleep without thinking about this problem so I got up again and had another look and now I can see what is happening (I think I can anyway!).

It doesn't look to be a problem with freepie or my IMU (The values going into freePIE are correct and it works with other demos)

I "think" the problem is with how minecraft deals with the Hydra (At least with the settings I chose which are listed in a previous post).

If I use Pitch for example. The pitch value from the Hydra is effecting Steves head in the direction of the HUD and not in the direction that his head is pointing. So if Steve is looking North and the HUD is north, then the pitch will work fine. However, if the HUD is North and Steve is looking West, then the pitch is applied to the HUD direction still. This result in Steve seeing Roll instead of pitch.

Does that make sense?

Matt.
mabrowning
Binocular Vision CONFIRMED!
Posts: 289
Joined: Wed May 15, 2013 12:48 pm
Location: Texas, USA
Contact:

Re: Minecrift Discussion Thread

Post by mabrowning »

Croccy22, read the link I sent on Euler Angles. I am 95% sure thats whats going on here. It is possible that the problem is with how I extract minecraft's Euler angles from the Hydra. I'll investigate tonight to see if hydra orientation is just broken in general.
Croccy22
Cross Eyed!
Posts: 140
Joined: Wed Feb 04, 2009 7:51 am

Re: Minecrift Discussion Thread

Post by Croccy22 »

I tried reading it and my head exploded. Not too sure if it is classed as good bedtime reading hehe. More like mid morning after a few red bulls :-).

I'm pretty sure that pitch and roll is being applied assuming Steve is looking towards the HUD. Do you get what I mean? I could make a video if not?

Matt.
Croccy22
Cross Eyed!
Posts: 140
Joined: Wed Feb 04, 2009 7:51 am

Re: Minecrift Discussion Thread

Post by Croccy22 »

In terms of the euler angles thing. I would say the the pitch and roll are being applied to the camera but then the yaw is being applied after.

So if you tilt the camera down 45deg but then rotate the camera 90deg left, the pitch becomes roll?
CyberVillain
Petrif-Eyed
Posts: 2166
Joined: Mon Jun 22, 2009 8:36 am
Location: Stockholm, Sweden

Re: Minecrift Discussion Thread

Post by CyberVillain »

mabrowning wrote: Edit: I just read the FreePIE post with CyberVillian explaining how he goes from pitch,yaw,roll to the rotation matrix; sounds like he's using sixense::Mat3::rotation(), so I'd find out from him what order he is applying them in.
Heres the code

https://github.com/AndersMalmgren/FreeP ... ke.cpp#L88

Basicly

Code: Select all

void convert_euler(float yaw, float pitch, float roll, sixenseControllerData *output) {
  auto quat = sixenseMath::Quat::rotation(yaw, pitch, roll);
  auto mat = sixenseMath::Matrix3::rotation(quat);
  
  quat.fill((float*)&output->rot_quat);
  mat.fill((float(*)[3])&output->rot_mat);  
 }
mabrowning
Binocular Vision CONFIRMED!
Posts: 289
Joined: Wed May 15, 2013 12:48 pm
Location: Texas, USA
Contact:

Re: Minecrift Discussion Thread

Post by mabrowning »

CyberVillain wrote: Basicly

Code: Select all

void convert_euler(float yaw, float pitch, float roll, sixenseControllerData *output) {
  auto quat = sixenseMath::Quat::rotation(yaw, pitch, roll);
  auto mat = sixenseMath::Matrix3::rotation(quat);
  
  quat.fill((float*)&output->rot_quat);
  mat.fill((float(*)[3])&output->rot_mat);  
 }
Hmm.. In the sixense lib, the quaternion becomes

Code: Select all

    Matrix3 mat =
        Matrix3::rotation( yaw,   Vector3( 0, 1,  0 ) ) *
        Matrix3::rotation( pitch, Vector3( 1, 0,  0 ) ) *
        Matrix3::rotation( roll,  Vector3( 0, 0, -1 ) );
    return Quat(mat);
which means that it expects z-x-y extrinsic rotation Tait-Bryan angles (or y-x'-z'' intrinsic), though roll seems inverted...

I suspect then that ahrs is giving them in a different convention.

Croccy22, where is the code to the plugin you are pulling your angles from?
Croccy22
Cross Eyed!
Posts: 140
Joined: Wed Feb 04, 2009 7:51 am

Re: Minecrift Discussion Thread

Post by Croccy22 »

Do you mean the freePie code or the firmware code for the ahrsImu?

If it helps these are the values that are getting inputted into Freepie.

Yaw = 0 when centered, 1.5 when looking left, -1.5 when looking right
Pitch = 0 when centered, 1.5 when looking up, -1.5 when looking down
Roll = 0 when centered, 1.5 when rotated clockwise, -1.5 when rotated counter clockwise

One weird thing I noticed is that If I do "hydra[0].yaw = math.radians(ahrsImu.yaw)" Then the Yaw is backwards to what I expect, looking left rotates camera right. This is the only plugin that this happens with.

I have just been playing around with very unpretty maths and nearly have it working by changing my script in a very odd way. Please don't ask me how I came up with this because I don't know!! But it might make some sense.

Code: Select all

newYaw = yaw - centerYaw
newPitch = pitch - centerPitch
newRoll = roll - centerRoll

hydra[0].yaw  = newYaw
hydra[0].pitch = (((1/1.5)*-newYaw) * newRoll) + ((1-((1/1.5)*newYaw)) * newPitch)
hydra[0].roll = (((1/1.5)*newYaw) * newPitch) + ((1-((1/1.5)*newYaw)) * newRoll)
Now I can look forward and Roll/pitch work fine. I can look anywhere left and roll/pitch work fine but if I look right it goes all weird. Think it's because when I look right the yaw value becomes negative so my equation cocks up. If I can remember how to discard the negative part of a number it would probably work somehow :P

I really should be asleep now and not attempting things like this hehe. My alarm goes off in 4 hours for work!

Matt.
StellaArtois
Sharp Eyed Eagle!
Posts: 436
Joined: Wed Apr 10, 2013 4:07 am
Location: UK

Re: Minecrift Discussion Thread

Post by StellaArtois »

Croccy22 wrote:I really should be asleep now and not attempting things like this hehe. My alarm goes off in 4 hours for work!

Matt.
Welcome to the world of Minecrift development! ;-)

I'll quit with the 'helpful' posts now. This stuff fries my brain as well; I tend to get there through trial and error.
StellaArtois
Sharp Eyed Eagle!
Posts: 436
Joined: Wed Apr 10, 2013 4:07 am
Location: UK

Re: Minecrift Discussion Thread

Post by StellaArtois »

Jademalo wrote:http://www.reddit.com/r/oculus/comments ... minecrift/

Looks like I'm not the only one, and the mod is having issues with the rift not being plugged in.
Hmmm. Still can't reproduce this at my end, even with the Rift unplugged. On it.
Jademalo wrote: In other news, PROCESSING!
:D
Yay!! :woot
Croccy22
Cross Eyed!
Posts: 140
Joined: Wed Feb 04, 2009 7:51 am

Re: Minecrift Discussion Thread

Post by Croccy22 »

Just want to clarify one thing. Has anyone tested Minecrift using a real Razer Hydra as the Head Orientation device? and if so does it work as expected with head pitch/roll?

I'm pretty sure I can solve the problem i'm having with a mathematical equation but that fact is highlighting that something in between my Imu -> FreePIE -> Minecraft is not working as expected. If I can confirm that a real hydra works then we know that FreePIE plugin needs looking at.

Matt.
Additives
Cross Eyed!
Posts: 129
Joined: Tue Sep 25, 2012 7:53 am

Re: Minecrift Discussion Thread

Post by Additives »

So I have been really enjoying playing vanilla with this mod, but I'm starting to itch for some forge mods. What is the current method of installing minecrift with forge?

PS thanks so much for the mod, just spent 3+ continuous hours inside and didn't even notice!
DannySwish
One Eyed Hopeful
Posts: 7
Joined: Tue Jun 18, 2013 1:58 am

Re: Minecrift Discussion Thread

Post by DannySwish »

So I just installed the latest beta as of writing using the amazingly handy .jar installer as instructed, but the game crashes upon loading (I briefly see the 'Mojang' logo as it crashes) when a Rift is plugged in. It loads up successfully when one is not. I'm on Mac OS X 10.8.4.

I think I should also add that the .jar appeared to successfully install the mod just by double-clicking it, and not doing that command line thing (I tried both, same results).
StellaArtois
Sharp Eyed Eagle!
Posts: 436
Joined: Wed Apr 10, 2013 4:07 am
Location: UK

Re: Minecrift Discussion Thread

Post by StellaArtois »

DannySwish wrote:So I just installed the latest beta as of writing using the amazingly handy .jar installer as instructed, but the game crashes upon loading (I briefly see the 'Mojang' logo as it crashes) when a Rift is plugged in. It loads up successfully when one is not. I'm on Mac OS X 10.8.4.

I think I should also add that the .jar appeared to successfully install the mod just by double-clicking it, and not doing that command line thing (I tried both, same results).
DannySwish, could you paste up the developer console log dump from the startup and crash (from the developer console tab in the 1.6 launcher)?

Install guide updated, thanks.
User avatar
Jademalo
Binocular Vision CONFIRMED!
Posts: 249
Joined: Sun Apr 14, 2013 12:03 pm

Re: Minecrift Discussion Thread

Post by Jademalo »

StellaArtois wrote:Hmmm. Still can't reproduce this at my end, even with the Rift unplugged. On it.
Random thought - Does it possibly have something to do with the Rift SDK being installed and profiles being set up? I haven't got any of that configured yet obviously.
Croccy22
Cross Eyed!
Posts: 140
Joined: Wed Feb 04, 2009 7:51 am

Re: Minecrift Discussion Thread

Post by Croccy22 »

Jademalo wrote:
StellaArtois wrote:Hmmm. Still can't reproduce this at my end, even with the Rift unplugged. On it.
Random thought - Does it possibly have something to do with the Rift SDK being installed and profiles being set up? I haven't got any of that configured yet obviously.
It shouldn't have anything to do with this. I don't have any of the rift SDK stuff installed and it all works perfectly for me. I am using my own custom made HMD but this is not detected as an oculus or anything like that.

It's a long shot but do you have multiple monitors connected or anything? Only time I have seen the screen go black is when I switched to fullscreen mode and the display went full screen on my second monitor. I highly doubt this is the case in your situation though.

So what exactly happens? You go into minecraft, click the vr button and the minecraft window goes black? Does the rest of minecraft all work fine apart from the VR option?

Matt.
User avatar
Jademalo
Binocular Vision CONFIRMED!
Posts: 249
Joined: Sun Apr 14, 2013 12:03 pm

Re: Minecrift Discussion Thread

Post by Jademalo »

Croccy22 wrote:It shouldn't have anything to do with this. I don't have any of the rift SDK stuff installed and it all works perfectly for me. I am using my own custom made HMD but this is not detected as an oculus or anything like that.

It's a long shot but do you have multiple monitors connected or anything? Only time I have seen the screen go black is when I switched to fullscreen mode and the display went full screen on my second monitor. I highly doubt this is the case in your situation though.

So what exactly happens? You go into minecraft, click the vr button and the minecraft window goes black? Does the rest of minecraft all work fine apart from the VR option?

Matt.
I've got nvidia surround.

All of minecraft works apart from when I click VR Mode. As soon as I click that, black screen. If I click in the same place again, it disables and I can play normal minecraft again without issue. In addition to this, both the latest 1.5.2 and 1.4.7 builds work perfectly.
StellaArtois
Sharp Eyed Eagle!
Posts: 436
Joined: Wed Apr 10, 2013 4:07 am
Location: UK

Re: Minecrift Discussion Thread

Post by StellaArtois »

Jademalo wrote:
Croccy22 wrote:It shouldn't have anything to do with this. I don't have any of the rift SDK stuff installed and it all works perfectly for me. I am using my own custom made HMD but this is not detected as an oculus or anything like that.

It's a long shot but do you have multiple monitors connected or anything? Only time I have seen the screen go black is when I switched to fullscreen mode and the display went full screen on my second monitor. I highly doubt this is the case in your situation though.

So what exactly happens? You go into minecraft, click the vr button and the minecraft window goes black? Does the rest of minecraft all work fine apart from the VR option?

Matt.
I've got nvidia surround.

All of minecraft works apart from when I click VR Mode. As soon as I click that, black screen. If I click in the same place again, it disables and I can play normal minecraft again without issue. In addition to this, both the latest 1.5.2 and 1.4.7 builds work perfectly.
I can reproduce this now; had to unplug the USB lead from the Rift box to the PC - not just the power lead... :roll:
mabrowning
Binocular Vision CONFIRMED!
Posts: 289
Joined: Wed May 15, 2013 12:48 pm
Location: Texas, USA
Contact:

Re: Minecrift Discussion Thread

Post by mabrowning »

I am also fighting this one. Wanted to test out something quick before I got to work this morning, but alas. Black screen without my rift.
mabrowning
Binocular Vision CONFIRMED!
Posts: 289
Joined: Wed May 15, 2013 12:48 pm
Location: Texas, USA
Contact:

Re: Minecrift Discussion Thread

Post by mabrowning »

DannySwish wrote:So I just installed the latest beta as of writing using the amazingly handy .jar installer as instructed, but the game crashes upon loading (I briefly see the 'Mojang' logo as it crashes) when a Rift is plugged in. It loads up successfully when one is not. I'm on Mac OS X 10.8.4.

I think I should also add that the .jar appeared to successfully install the mod just by double-clicking it, and not doing that command line thing (I tried both, same results).
So, there is a stupid Sixense bug. Unplug all USB devices, start the game, then plug them in. I need to find a way around that, but it should work for now.

If you don't have a hydra, then edit the Library/Application Support/minecraft/versions/minecrift-1.6.2-bXYZ/*.json file and remove the SixenseJava library entry (towards the bottom). I'll make it toggleable in the installer in short order (later this week, probably)
mabrowning
Binocular Vision CONFIRMED!
Posts: 289
Joined: Wed May 15, 2013 12:48 pm
Location: Texas, USA
Contact:

Re: Minecrift Discussion Thread

Post by mabrowning »

Additives wrote:So I have been really enjoying playing vanilla with this mod, but I'm starting to itch for some forge mods. What is the current method of installing minecrift with forge?

PS thanks so much for the mod, just spent 3+ continuous hours inside and didn't even notice!
Fantastic! Glad you enjoyed it.

Forge. I haven't tested the 1.6.2 build with Forge, but in theory it should be mostly compatible. If you're comfortable leading the charge, download and installer forge #789 (last version Optifine was vetted against; later versions may work). Then, open your $minecraft/versions directory and find the forge install and the minecrift install. Copy the following library entries from the minecraft json into the forge json (maybe create a new version as a copy of forge):
  • com.mtbs3d.minecrift
    net.optifine
    JRift
    JRiftLibrary
    SixenseJava (if you have a hydra)
    SixenseJavaLibrary (if you have a hydra)
Put all of those at the very beginning of the libraries list, and it might work. I'll likely have to add more compatibility code, but if you get started testing, you can point me at what doesn't work (if the game even loads).

It is on my list to make the installer allow you to create a Forge-enabled install, but it'll probably be next week or so before I get to it.
StellaArtois
Sharp Eyed Eagle!
Posts: 436
Joined: Wed Apr 10, 2013 4:07 am
Location: UK

Re: Minecrift Discussion Thread

Post by StellaArtois »

mabrowning wrote:I am also fighting this one. Wanted to test out something quick before I got to work this morning, but alas. Black screen without my rift.
Ok, it's a JRift regression. The aspect ratio changes I put in must only be performed if the Rift is initialised. Doh. :oops:

Fixed next build!
User avatar
Jademalo
Binocular Vision CONFIRMED!
Posts: 249
Joined: Sun Apr 14, 2013 12:03 pm

Re: Minecrift Discussion Thread

Post by Jademalo »

Hooray!

Check one of my older posts by the way, I did mention some sweet-ass FoV zooming when I turned VR mode off. =p
StellaArtois
Sharp Eyed Eagle!
Posts: 436
Joined: Wed Apr 10, 2013 4:07 am
Location: UK

Re: Minecrift Discussion Thread

Post by StellaArtois »

Jademalo wrote:Hooray!

Check one of my older posts by the way, I did mention some sweet-ass FoV zooming when I turned VR mode off. =p
Yup! Never saw that on either of my two machines...?
User avatar
Jademalo
Binocular Vision CONFIRMED!
Posts: 249
Joined: Sun Apr 14, 2013 12:03 pm

Re: Minecrift Discussion Thread

Post by Jademalo »

StellaArtois wrote:
Jademalo wrote:Hooray!

Check one of my older posts by the way, I did mention some sweet-ass FoV zooming when I turned VR mode off. =p
Yup! Never saw that on either of my two machines...?
Essentially, if I was ingame, turned VR mode on for blackscreen, then immediately turned it off, when I resumed the game it would FoV zoom into the normal MC view. It was pretty sweet
mabrowning
Binocular Vision CONFIRMED!
Posts: 289
Joined: Wed May 15, 2013 12:48 pm
Location: Texas, USA
Contact:

Re: Minecrift Discussion Thread

Post by mabrowning »

Croccy22 wrote:Just want to clarify one thing. Has anyone tested Minecrift using a real Razer Hydra as the Head Orientation device? and if so does it work as expected with head pitch/roll?

I'm pretty sure I can solve the problem i'm having with a mathematical equation but that fact is highlighting that something in between my Imu -> FreePIE -> Minecraft is not working as expected. If I can confirm that a real hydra works then we know that FreePIE plugin needs looking at.

Matt.
I just booted up Minecrift, and hydra head orientation works perfectly. Any yaw, any roll, any pitch. Any problems you are having are in taking the ahrsImu values and converting them to the hydra values.

Which brings us to...
Croccy22 wrote:Do you mean the freePie code or the firmware code for the ahrsImu?

If it helps these are the values that are getting inputted into Freepie.

Yaw = 0 when centered, 1.5 when looking left, -1.5 when looking right
Pitch = 0 when centered, 1.5 when looking up, -1.5 when looking down
Roll = 0 when centered, 1.5 when rotated clockwise, -1.5 when rotated counter clockwise

One weird thing I noticed is that If I do "hydra[0].yaw = math.radians(ahrsImu.yaw)" Then the Yaw is backwards to what I expect, looking left rotates camera right. This is the only plugin that this happens with.

I have just been playing around with very unpretty maths and nearly have it working by changing my script in a very odd way. Please don't ask me how I came up with this because I don't know!! But it might make some sense.

Code: Select all

newYaw = yaw - centerYaw
newPitch = pitch - centerPitch
newRoll = roll - centerRoll

hydra[0].yaw  = newYaw
hydra[0].pitch = (((1/1.5)*-newYaw) * newRoll) + ((1-((1/1.5)*newYaw)) * newPitch)
hydra[0].roll = (((1/1.5)*newYaw) * newPitch) + ((1-((1/1.5)*newYaw)) * newRoll)
Now I can look forward and Roll/pitch work fine. I can look anywhere left and roll/pitch work fine but if I look right it goes all weird. Think it's because when I look right the yaw value becomes negative so my equation cocks up. If I can remember how to discard the negative part of a number it would probably work somehow :P

I really should be asleep now and not attempting things like this hehe. My alarm goes off in 4 hours for work!

Matt.
You're getting values in radians (pitch -PI/2 -> PI/2, approximately 1.5707). Don't scale them at all, they should be passed without calling math.radians(), which converts degrees to radians.

You're welcome to keep trying, but I suspect you cannot get what you want to achieve with a simple linear recombination of the angles in radians. You'll get something that maybe works sometimes-ish for small angles, but there will be strange rotation factors that will make you sick.

You need to find out what *exactly* the ahrsImu's values mean. Or point me at some kind of documentation. What exactly is the plugin you're using? I couldn't find code on the FreePIE github that reported pitch/yaw/roll from the ahrs.

Only rotating one axis at a time trying to determine range of rotations isn't going to help, the problem comes when you have multiple rotations in play.

If you could get at a rotation matrix or a quaternion, it would be even better than trying to slog through Euler angle conversions.

I really want to get this working for you! If we learn a little bit in the process, excellent!
mabrowning
Binocular Vision CONFIRMED!
Posts: 289
Joined: Wed May 15, 2013 12:48 pm
Location: Texas, USA
Contact:

Re: Minecrift Discussion Thread

Post by mabrowning »

StellaArtois wrote:
mabrowning wrote:I am also fighting this one. Wanted to test out something quick before I got to work this morning, but alas. Black screen without my rift.
Ok, it's a JRift regression. The aspect ratio changes I put in must only be performed if the Rift is initialised. Doh. :oops:

Fixed next build!
Fixed in Build #82: For OSX & Windows. I'm not at my linux machine and didn't update the Linux libraries, but was lazy and released anyway. Don't download yet if you're on Linux. I had to hard-power off my machine at home before I left for work and I couldn't remotely turn it on :(

https://minecraftvr.ci.cloudbees.com/jo ... -1.6.2/82/

Good catch!
StellaArtois
Sharp Eyed Eagle!
Posts: 436
Joined: Wed Apr 10, 2013 4:07 am
Location: UK

Re: Minecrift Discussion Thread

Post by StellaArtois »

Thanks ma!
User avatar
Jademalo
Binocular Vision CONFIRMED!
Posts: 249
Joined: Sun Apr 14, 2013 12:03 pm

Re: Minecrift Discussion Thread

Post by Jademalo »

And it's working fine!

The GUI feels different to when I last tried it, I can't quite explain. It feels... Bubbled and small.

Ah well, Rift is coming soon, I am seriously hype! :D
StellaArtois
Sharp Eyed Eagle!
Posts: 436
Joined: Wed Apr 10, 2013 4:07 am
Location: UK

Re: Minecrift Discussion Thread

Post by StellaArtois »

Jademalo wrote:And it's working fine!
Cool :-)
Jademalo wrote:The GUI feels different to when I last tried it, I can't quite explain. It feels... Bubbled and small.

Ah well, Rift is coming soon, I am seriously hype! :D
The default HUD size / distance have changed. That may be the difference you're seeing?
User avatar
Jademalo
Binocular Vision CONFIRMED!
Posts: 249
Joined: Sun Apr 14, 2013 12:03 pm

Re: Minecrift Discussion Thread

Post by Jademalo »

StellaArtois wrote:
Jademalo wrote:The GUI feels different to when I last tried it, I can't quite explain. It feels... Bubbled and small.

Ah well, Rift is coming soon, I am seriously hype! :D
The default HUD size / distance have changed. That may be the difference you're seeing?
Probably - I imagine when I actually get my rift I'll get it all looking nice. Gah, I'm so excited!
StellaArtois
Sharp Eyed Eagle!
Posts: 436
Joined: Wed Apr 10, 2013 4:07 am
Location: UK

Re: Minecrift Discussion Thread

Post by StellaArtois »

Jademalo wrote:I imagine when I actually get my rift I'll get it all looking nice. Gah, I'm so excited!
Looking forward to a detailed critique on both the Rift and Minecrift when you do! :-)
Croccy22
Cross Eyed!
Posts: 140
Joined: Wed Feb 04, 2009 7:51 am

Re: Minecrift Discussion Thread

Post by Croccy22 »

mabrowning wrote:You're getting values in radians (pitch -PI/2 -> PI/2, approximately 1.5707). Don't scale them at all, they should be passed without calling math.radians(), which converts degrees to radians.

You're welcome to keep trying, but I suspect you cannot get what you want to achieve with a simple linear recombination of the angles in radians. You'll get something that maybe works sometimes-ish for small angles, but there will be strange rotation factors that will make you sick.

You need to find out what *exactly* the ahrsImu's values mean. Or point me at some kind of documentation. What exactly is the plugin you're using? I couldn't find code on the FreePIE github that reported pitch/yaw/roll from the ahrs.

Only rotating one axis at a time trying to determine range of rotations isn't going to help, the problem comes when you have multiple rotations in play.

If you could get at a rotation matrix or a quaternion, it would be even better than trying to slog through Euler angle conversions.

I really want to get this working for you! If we learn a little bit in the process, excellent!
The code in FreePIE is the ahrsImu plugin. However looking at this plugin, all it does is reads the value with a serial port stream and sends them directly into FreePIE. So to find out what exactly the Imu is doing I will have to look at the firmware code (The site is here https://dev.qu.tu-berlin.de/projects/sf ... i/Tutorial)

The reason I used the math.radians thing was because if I just pass the value from my Imu straight to the hydra plugin it went completely mental so I guessed that my Imu is giving it's output in Degrees (Pretty sure it is). So I used the function to convert the degrees output into radians.

Will continue to look into this and see if there is anything I can do to fix it. I have some tests to do with freePIE with other Hydra demos to see if I get similar results with roation not working properly.

Thanks for your help.

Matt.
mabrowning
Binocular Vision CONFIRMED!
Posts: 289
Joined: Wed May 15, 2013 12:48 pm
Location: Texas, USA
Contact:

Re: Minecrift Discussion Thread

Post by mabrowning »

Croccy22 wrote: The code in FreePIE is the ahrsImu plugin. However looking at this plugin, all it does is reads the value with a serial port stream and sends them directly into FreePIE. So to find out what exactly the Imu is doing I will have to look at the firmware code (The site is here https://dev.qu.tu-berlin.de/projects/sf ... i/Tutorial)

The reason I used the math.radians thing was because if I just pass the value from my Imu straight to the hydra plugin it went completely mental so I guessed that my Imu is giving it's output in Degrees (Pretty sure it is). So I used the function to convert the degrees output into radians.

Will continue to look into this and see if there is anything I can do to fix it. I have some tests to do with freePIE with other Hydra demos to see if I get similar results with roation not working properly.

Thanks for your help.

Matt.

Ok, yep. Found their code https://dev.qu.tu-berlin.de/projects/sf ... azor_AHRS/.

From Output.pde: You're right, it's in degrees.

From DCM.pde: They extract the angles as yaw, then pitch, then roll. To confirm, see Section 8.2, Equation (289) here and compare to the Euler_angles() code in DCM.pde:

Code: Select all

void Euler_angles(void)
{
    yaw   = atan2(DCM_Matrix[1][0],DCM_Matrix[0][0]);
    pitch = -asin(DCM_Matrix[2][0]);
    roll  = atan2(DCM_Matrix[2][1],DCM_Matrix[2][2]);
}
It appears that the Razor IMU coordinate system is +x into the screen, +y to the right, and +z down. The hydra coordinate system is +x to the right +y up, +z out of the screen.

If they have yaw,pitch,roll as a 1,2,3 Euler angle (x-1-roll, y-2-pitch, 3-z-yaw), the same rotation in Sixense space should be represented by a 3,1,2 Euler angle, with yaw and roll inverted. (3-z-roll, 1-x-pitch, 2-y-yaw).

The sixense code CyberVillan uses takes the following (column vector premultiplcation), which seems to expects 2,1,3 Euler angles.

Code: Select all

    Matrix3 mat =
        Matrix3::rotation( yaw,   Vector3( 0, 1,  0 ) ) *
        Matrix3::rotation( pitch, Vector3( 1, 0,  0 ) ) *
        Matrix3::rotation( roll,  Vector3( 0, 0, -1 ) );
    return Quat(mat);
There is a way to convert from 3,1,2 to 2,1,3, (if you want to try, reference the above linked PDF) but it would probably be easier to rebuild the sixense_fake.cpp library to apply the rotation as

Code: Select all

    Matrix3 mat =
        Matrix3::rotation( roll,  Vector3( 0,  0, -1 ) ) *
        Matrix3::rotation( pitch, Vector3( 1,  0,  0 ) ) *
        Matrix3::rotation( yaw,   Vector3( 0, -1,  0 ) ) ;
Post Reply

Return to “Minecrift”