# Thread: A wiimote pitch/roll/yaw questiion

1. ## A wiimote pitch/roll/yaw questiion

Hello!

In short, I'm attempting to get the wiimote to work with my pc (and extract data from it), but I'm faced with a mathematical (or trigonometric) problem.

(Explanation)
In order to obtain the orientation of the wiimote I need to know/calculate yaw, pitch and roll.

I've got pitch and roll (in radians) and yaw kind of, but only when I move the wiimote precisely in a horizontal way. This is because yaw is a bit harder to obtain, the reason behind it is that I need to use the IR sensor (bar).

The IR beacon in this image is a bit different than the regular sensor bar (which only has 2 LEDs and not 4) and the focus point (which is the center of the camera/wiimote lens) should be on the other side of the image plane in reality.

The camera lens of the wiimote registers the LEDs of the sensor bar on the image plane which results in an (average) x and y position (see image above). With the help of the x value I can calculate yaw. The problem is that when roll or pitch changes, the image plane changes along with it and x isn't accurate anymore (and nor is yaw). I got the advice to

"build a mental model of how the Wiimote's IR camera works in response to pitch and roll, since the camera image and thus the x and y values rotate with the Wiimote."

What I know is that the x value on the image plane changes when I pitch or roll with the wiimote with the result that yaw isn't calculated accurately anymore.
I know what the pitch and roll angle is at all times and I think they have to go into the yaw calculation as a precondition to get it right, only I'm not sure how.

I was hoping someone could give me some pointers perhaps?
At any rate, thank you for reading all this and if anything is unclear just ask.

2. Originally Posted by Kovacs
Hello!

In short, I'm attempting to get the wiimote to work with my pc (and extract data from it), but I'm faced with a mathematical (or trigonometric) problem.

(Explanation)
In order to obtain the orientation of the wiimote I need to know/calculate yaw, pitch and roll.

I've got pitch and roll (in radians) and yaw kind of, but only when I move the wiimote precisely in a horizontal way. This is because yaw is a bit harder to obtain, the reason behind it is that I need to use the IR sensor (bar).

The IR beacon in this image is a bit different than the regular sensor bar (which only has 2 LEDs and not 4) and the focus point (which is the center of the camera/wiimote lens) should be on the other side of the image plane in reality.

The camera lens of the wiimote registers the LEDs of the sensor bar on the image plane which results in an (average) x and y position (see image above). With the help of the x value I can calculate yaw. The problem is that when roll or pitch changes, the image plane changes along with it and x isn't accurate anymore (and nor is yaw). I got the advice to

"build a mental model of how the Wiimote's IR camera works in response to pitch and roll, since the camera image and thus the x and y values rotate with the Wiimote."

What I know is that the x value on the image plane changes when I pitch or roll with the wiimote with the result that yaw isn't calculated accurately anymore.
I know what the pitch and roll angle is at all times and I think they have to go into the yaw calculation as a precondition to get it right, only I'm not sure how.

I was hoping someone could give me some pointers perhaps?
At any rate, thank you for reading all this and if anything is unclear just ask.
First, let me show my appreciation of the challenge you are taking upon yourself.

My first thought was that the problem to do with the yaw might be because when you turn the Wiimote too much to the right, the yaw becomes so large that the sensor reading doesn't register well anymore because, as you pointed out, the readings spread out far. Maybe the sensor is basically reading a blank wall.

I might be completely on the wrong track, but I hope that was at least a little helpful.

Mathemagister

3. Originally Posted by mathemagister
First, let me show my appreciation of the challenge you are taking upon yourself.
Thank you. Truth be told I think I'm biting more off than I can chew with this yaw thing, but now that I have pitch and roll I have to try.

My first thought was that the problem to do with the yaw might be because when you turn the Wiimote too much to the right, the yaw becomes so large that the sensor reading doesn't register well anymore because, as you pointed out, the readings spread out far. Maybe the sensor is basically reading a blank wall.
Hmm, how far would be too far? The sensor has to pick up both LEDs in order to calculate their position correctly so you're right about that, but you can't move all that far (to the right or left) before you're out of range of one of the two LEDs so I'm not sure if that is where the problem lies.

I've been trying to get the whole pitch/roll/yaw thing on paper and started with roll & yaw.

I figured that if yaw = 0 (wiimote facing forward towards the LEDs) and the wiimote rolls a bit to the left (see pic) then the image plane would roll along with it and the x/y position of the LEDs (red dot in the picture) would change. Perhaps with the help of this new x value and the roll angle that goes along with it I could compensate for this (yaw) error?

4. Originally Posted by Kovacs
I figured that if yaw = 0 (wiimote facing forward towards the LEDs) and the wiimote rolls a bit to the left (see pic) then the image plane would roll along with it and the x/y position of the LEDs (red dot in the picture) would change. Perhaps with the help of this new x value and the roll angle that goes along with it I could compensate for this (yaw) error?
I'm not sure if that's possible because there isn't enough information that way to calculate the yaw, you would need three points. The new (x,y)-position [using only x is hopeless] versus the old (x,y)-position would give 2 possible yaw values.

Mathemagister