## wiimote pitch,roll and yaw

Feb 7, 2008 at 1:01am

# wiimote pitch,roll and yaw

my physics is frankly, crap, and i’m having a hard time obtaining rotational data from the wiimote. ideally i would like to obtain the angle of current rotation so can anyone tell me where i am going wrong in the following patch or provide an example? i tried to use the formulae from this page

http://www.wiili.org/index.php/Motion_analysis

i have ‘calibrated’ the wiimote but don’t think i am quite grapsing why. could someone explain in baby physics for me?

i am using tk.wii on xp to provide me with the wii data. i have unsuccessfully searched the archives for any pointers – there were a couple of questions asked before but no definitive answers. any tips on obtaining position or velocity data would also be of assistance.

thank you very much in advance for any help,

don

max v2;
#N vpatcher 246 19 729 641;
#P origin -298 18;
#P window setfont “Sans Serif” 9.;
#P newex 134 134 56 9109513 pak 0. 0. 0.;
#P flonum 215 103 35 9 0. 1. 3 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 175 103 35 9 0. 1. 3 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 134 103 35 9 0. 1. 3 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 302 48 137 9109513 unpack 0. 0. 0. 0. 0. 0. 0. 0. 0.;
#P newex 285 18 282 9109513 loadmess 0.006 0.006 0.104 0.01 0.112 0.006 0.112 0.006 0.006;
#P newex 318 332 106 9109513 expr (\$f1-\$f2)/(\$f3-\$f2);
#P flonum 321 392 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 175 333 106 9109513 expr (\$f1-\$f2)/(\$f3-\$f2);
#P flonum 178 393 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 313 280 79 9109513 expr (\$f1+\$f2)/2.;
#P comment 292 282 100 9109513 z0;
#P newex 181 279 79 9109513 expr (\$f1+\$f2)/2.;
#P comment 160 281 100 9109513 y0;
#P newex 72 277 79 9109513 expr (\$f1+\$f2)/2.;
#P comment 245 163 13 9109513 z;
#P comment 352 108 13 9109513 3;
#P comment 312 108 13 9109513 2;
#P flonum 352 162 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 312 162 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 271 162 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 352 145 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 312 145 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 271 145 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 352 128 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 312 128 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 271 128 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P inlet 163 159 15 0;
#P newex 27 329 106 9109513 expr (\$f1-\$f2)/(\$f3-\$f2);
#P flonum 30 389 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 136 238 79 9109513 scale 0. 1. -1. 1.;
#P newex 231 240 79 9109513 scale 0. 1. -1. 1.;
#P user ezdac~ 315 686 359 719 0;
#P newex 163 201 71 9109513 unpack 0. 0. 0.;
#P window linecount 3;
#P comment 7 54 223 9109513 a button facing up – x1 +0.006 y1 +0.006 z1 +0.104 expansion port up – x2 +0.010 y2 +0.112 z2 +0.006 on right side left up- x3 +0.112 y3 +0.006 z3 +0.006;
#P window linecount 1;
#P comment 247 59 100 9109513 acc=dv/dt;
#P newex 40 237 79 9109513 scale 0. 1. -1. 1.;
#P window linecount 3;
#P comment 8 149 100 9109513 x = xraw-x0/x1-x0 y = yraw-y0/y2-y0 z = zraw-z0/z3-z0;
#P comment 7 100 100 9109513 x0=(x1+x2)/2=0.008 y0=(y1+y3)/2=0.006 z0=(z2+z3)/2=0.006;
#P window linecount 1;
#P comment 32 370 100 9109513 calibrated force;
#P comment 271 108 13 9109513 1;
#P comment 245 128 100 9109513 x;
#P comment 245 145 100 9109513 y;
#P comment 51 279 100 9109513 x0;
#P user panel 7 359 392 81;
#X brgb 191 191 191;
#X frgb 0 0 0;
#X border 1;
#X rounded 0;
#X done;
#P window linecount 2;
#P comment 134 467 100 9109513 pitch = asin ax/1g roll = asin ay/1g;
#P connect 9 0 17 0;
#P connect 17 0 16 0;
#P connect 12 0 9 0;
#P connect 19 0 31 0;
#P connect 31 0 17 1;
#P connect 19 0 17 2;
#P connect 42 0 45 0;
#P connect 12 1 15 0;
#P connect 20 0 31 1;
#P connect 43 0 45 1;
#P connect 45 0 12 0;
#P connect 18 0 12 0;
#P connect 15 0 37 0;
#P connect 37 0 36 0;
#P connect 44 0 45 2;
#P connect 22 0 33 0;
#P connect 33 0 37 1;
#P connect 12 2 14 0;
#P connect 24 0 33 1;
#P connect 41 0 19 0;
#P connect 41 3 22 0;
#P connect 41 6 25 0;
#P connect 23 0 37 2;
#P connect 40 0 41 0;
#P connect 41 1 20 0;
#P connect 41 4 23 0;
#P connect 41 7 26 0;
#P connect 26 0 35 0;
#P connect 14 0 39 0;
#P connect 39 0 38 0;
#P connect 41 2 21 0;
#P connect 41 5 24 0;
#P connect 41 8 27 0;
#P connect 35 0 39 1;
#P connect 27 0 35 1;
#P connect 27 0 39 2;
#P pop;

#35697
Feb 7, 2008 at 1:41am

always the way – 2 minutes after posting i had a forehead slapping moment…put wiimote on left side measure x (0.408), put wiimote on right side measure x (0.612), use these values in a scale object and bingo…roll! not exact but appears good enough…

#121987
Sep 19, 2009 at 12:52pm

Hi All!

I’m trying to develop a patch in max to recognize wii gestures,
but it has been very difficult since I’m not getting very accuracy in the results.
I think I’m not treating right the raw data from wii (osculator-osc).
So I was trying to translate this java code (www.wiigee.org) to mxj
but it has been hard since I’m a novice in java.
Can anyone help? I would be very much grateful, and I think the community also.

Best Regards,
DC

#121988

You must be logged in to reply to this topic.