WiiLi Wiki frontpage Include your post in the News Get links Hoteles Quito
WiiLi.org Forum Index WiiLi.org
a new revolution
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

IR rotation

 
Post new topic   Reply to topic    WiiLi.org Forum Index -> Wii Remote and Nunchuck
View previous topic :: View next topic  
Author Message
blahblah



Joined: 18 Dec 2006
Posts: 9

Digg It
PostPosted: Sun Dec 24, 2006 9:56 pm    Post subject: IR rotation

Hello, I just got my new wiimote working (using it for midi stuff). Does anyone out there know how to make a gpie script that will process the ir data to give x,y co-ordinates and separate values for rotation?

Would come in very handy, hopefully for many of us.

thanks
Back to top
View user's profile Send private message
CarlKenner
Site Admin


Joined: 29 Nov 2006
Posts: 614

Digg It
PostPosted: Mon Dec 25, 2006 1:33 pm    Post subject:

I haven't tried using IR for rotation, since I don't have a sensor bar. And it would only provide roll.

To seperate the rotation of the Wiimote from accelerations, you can use:

Wiimote.Roll
Wiimote.Pitch
Wiimote.Nunchuk.Roll
Wiimote.Nunchuk.Pitch

They will be in degrees. GlovePIE uses the accelerometers to update the rotation only while the wiimote has a total acceleration of about 1g. But it doesn't seperate rotation from acceleration very well. Sometimes it is too choppy updating the rotation, and sometimes it updates the rotation when it shouldn't.

There are lots of good scripts for positioning a mouse based on the IR data. Have a look at them. But at its most basic, all you need to do is read:
Wiimote.dot1x
Wiimote.dot1y

Note that dot1x is backwards from what you might expect (it is from the point of view of the camera).
Back to top
View user's profile Send private message Send e-mail
blahblah



Joined: 18 Dec 2006
Posts: 9

Digg It
PostPosted: Mon Dec 25, 2006 9:41 pm    Post subject:

Thanks,

Actually what I meant was to be able to account for teh roll of the handset when in IR mode.

I want to be able to get x,y data from the IR but be able to change the roll of the wiimote at the same time.

When getting the x,y from the ir, if you change the roll of the wiimote to (for instance) 90 degrees, my x becomes the computers y. It should be possible to remove the roll from the xy data so that no matter what the orientation of the remote, we know its absolute position in xy (or at least where on the xy plane it is pointing). Does that make more sense?
Back to top
View user's profile Send private message
mrsoyo



Joined: 27 Dec 2006
Posts: 2
Location: Sverige

Digg It
PostPosted: Thu Dec 28, 2006 10:07 pm    Post subject:

CarlKenner wrote:
I haven't tried using IR for rotation, since I don't have a sensor bar. And it would only provide roll.



Use candles! works great =)
_________________
myspace.com/mrsoyo
Back to top
View user's profile Send private message
squeakypants



Joined: 09 Nov 2006
Posts: 99

Digg It
PostPosted: Fri Dec 29, 2006 2:38 am    Post subject:

The Wiimote.Roll value (drawn from the accelerometers) and the IR's roll should be near to exactly the same. However, if you must:
Code:
arctan(-(wiimote.dot2y-wiimote.dot1y)/(wiimote.dot2x-wiimote.dot1x))

However, you need to account for upside-down:
Code:
var.rotation = arctan(-(wiimote.dot2y-wiimote.dot1y)/(wiimote.dot2x-wiimote.dot1x));
if (wiimote.gy < 0) {
   if (var.rotation < 0) {
      var.rotation = var.rotation - 90;
   } else {
      var.rotation = var.rotation + 90;
   }
}


I just use 1 IR point and use Wiimote.Roll to deal with it.
Back to top
View user's profile Send private message AIM Address MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    WiiLi.org Forum Index -> Wii Remote and Nunchuck All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group