IR & calculating yaw February 07, 2010 04:05PM | Registered: 14 years ago Posts: 11 |
Re: IR & calculating yaw February 07, 2010 09:48PM | Registered: 14 years ago Posts: 98 |
float calc_yaw(struct ir_t* ir) { float x; x = ir->ax - 512; x *= WIIMOTE_FOV_COEFFICIENT / 512.0; return RAD_TO_DEGREE( atanf(x) ); }
Re: IR & calculating yaw February 07, 2010 11:09PM | Registered: 14 years ago Posts: 11 |
Re: IR & calculating yaw February 09, 2010 04:34AM | Registered: 14 years ago Posts: 98 |
Re: IR & calculating yaw February 09, 2010 08:19PM | Registered: 14 years ago Posts: 11 |
Re: IR & calculating yaw February 10, 2010 03:31AM | Registered: 14 years ago Posts: 98 |
float calc_yaw(struct ir_t* ir) { float x; x = ir->ax - 512; x *= WIIMOTE_FOV_COEFFICIENT / 512.0; return RAD_TO_DEGREE( atanf(x) ); }It's using the x member which is marked as bounded X value (in wiiuse) so you may have to use the "X values" value (raw X is ax in wiiuse and it's using x here, you may have to test it). You have to substract 512 off that number and then multiply it by 0.39f (WIIMOTE_FOV_COEFFICIENT value) and divide that by 512, then apply atanf() (floating's atan)over that value and you will have the yaw in radians. Convert it to degrees and you are done. Try to fit that to your programming language.
Re: IR & calculating yaw February 10, 2010 10:24PM | Registered: 14 years ago Posts: 11 |
Re: IR & calculating yaw February 17, 2010 02:46AM | Registered: 14 years ago Posts: 121 |
Re: IR & calculating yaw March 04, 2010 04:55PM | Registered: 14 years ago Posts: 11 |
float calc_yaw(struct ir_t* ir) { float x; x = ir->ax - 512; x *= WIIMOTE_FOV_COEFFICIENT / 512.0; return RAD_TO_DEGREE( atanf(x) ); }
Re: IR & calculating yaw March 12, 2010 05:54PM | Registered: 14 years ago Posts: 11 |
float calc_yaw(struct ir_t* ir) { float x; x = ir->ax - 512; x *= WIIMOTE_FOV_COEFFICIENT / 512.0; return RAD_TO_DEGREE( atanf(x) ); }