Welcome! Log In Create A New Profile

Advanced

Nunchuk Yaw data problems

Posted by violino 
Nunchuk Yaw data problems
November 24, 2010 03:53AM
I need help about enabling the ir tracking for the nunchuk I have tried
// wiiuse_set_nunchuk_orient_threshold(WPAD_CHAN_0, 1.0f);
but no luck.
Many thanks in advance
Re: Nunchuk Yaw data problems
November 24, 2010 08:06AM
"ir tracking for the nunchuk"?

The nunchuk has an accelerometer, joystick and buttons. What are you trying to do?
Re: Nunchuk Yaw data problems
November 24, 2010 09:00AM
I am trying to use the orient.yaw, orient.pitch and orient.roll data from the nunchuk to track the movements of the nunchuk but have two problems pitch and roll both work but by default the yaw data is always set to 0
The second issue is that I need to set a threshold so that not every change in the angles is an event.
So I am after the orientation data of the nunchuk
Hope that is clearer
Cheers
Violino
Re: Nunchuk Yaw data problems
November 24, 2010 10:56AM
The nunchuk doesn't have a yaw. The nunchuck 'senses' gravity, and from that it can calculate yaw/pitch.
Re: Nunchuk Yaw data problems
November 24, 2010 11:40AM
OK but how do I enable the Ir Tracking of the Nunchuk so that the orient.yaw is not always giving me 0
Re: Nunchuk Yaw data problems
November 24, 2010 02:55PM
Look at the nunchuk, notice that it's missing an IR sensor.

So:
1) Grab your favorite soldering iron, add it yourself, hack everything else around it to use it.
or:
2) You're out of luck. PERIOD.

(I want the Wii to bake me apple pie! And a pony)



Edited 1 time(s). Last edit at 11/24/2010 02:56PM by Daid.
Re: Nunchuk Yaw data problems
November 24, 2010 10:13PM
I am aware that it does not have any infra red sensor but what I need to get is the orientation angle for yaw I am able to get values for orient.pitch and values for orient.roll but the orient.yaw value is always 0 is it ever possible to get a value for the orient.yaw and if so how?
Re: Nunchuk Yaw data problems
November 24, 2010 10:26PM
orient.yaw = rand();
Re: Nunchuk Yaw data problems
November 24, 2010 11:20PM
orient.yaw is read only and the problem is that when I look at the data by using the code below I am getting values for orient.pitch and orient.roll but nothing for orient.yaw


      WPAD_Orientation(WPAD_CHAN_0, &orient);
	struct expansion_t data;
     WPAD_Expansion(WPAD_CHAN_0, &data);
     data.nunchuk.orient_threshold = 0.5f;
      rquadnunchuklateral = data.nunchuk.orient.yaw * 180 / PI ;
	rquadnunchukvertical = data.nunchuk.orient.pitch * 180.0 / PI;
	rquadnunchukroll = data.nunchuk.orient.roll * 180.0 / PI;
Re: Nunchuk Yaw data problems
November 24, 2010 11:22PM
U can try.

yaw= atan2(gforce.x, gforce.z);

but I think Daid's solution is better.
Re: Nunchuk Yaw data problems
November 24, 2010 11:54PM
I tried yaw= atan2(gforce.x, gforce.z); and got no values for yaw
also have no values for gforce.x
the code I used is as follows
WPAD_Orientation(WPAD_CHAN_0, &orient);
	struct expansion_t data;
     WPAD_Expansion(WPAD_CHAN_0, &data);
     data.nunchuk.orient_threshold = 0.5f;
      rquadnunchuklateral= atan2(data.nunchuk.gforce.x,data.nunchuk.gforce.z);


also tried
rquadnunchuklateral=data.nunchuk.gforce.x;
it seems my nunchuk is not reporting gforce data how do I make it do this
Re: Nunchuk Yaw data problems
November 25, 2010 01:47AM
take a look here - [wiibrew.org]

probably needs init()


WPAD_Orientation(WPAD_CHAN_0, &(data.orient));//get rotation data
WPAD_GForce(WPAD_CHAN_0, &(data.gforce));//get "speed" data
WPAD_Accel(WPAD_CHAN_0, &(data.accel));//get accelerometer data
WPAD_Expansion(WPAD_CHAN_0, &(data.exp));//get expansion data



Edited 1 time(s). Last edit at 11/25/2010 01:48AM by scanff.
Re: Nunchuk Yaw data problems
November 25, 2010 04:54AM
Thanks I am now getting all the data
is it possible to smooth the data as it still has a lot of noise
Re: Nunchuk Yaw data problems
November 25, 2010 06:58AM
The data is raw so you'll have to do your own smoothing.

IR smoothing is done here [devkitpro.svn.sourceforge.net]


Maybe you can do something similar.
Re: Nunchuk Yaw data problems
November 25, 2010 10:31AM
Thanks I will have a look at it
Sorry, only registered users may post in this forum.

Click here to login