All Classes Namespaces Files Functions Variables Enumerations Enumerator
libs/controller/WiiUtils.cpp
Go to the documentation of this file.
00001 
00010 #include "WiiUtils.h"
00011 #include "Angle.h"
00012 #include "MathUtils.h"
00013 
00014 using namespace qrk;
00015 
00016 
00017 void qrk::estimateWiiPose(Angle& vertical_direction, Angle& rotation,
00018                           const Point3d<double>& acceleration)
00019 {
00020   // 描画情報の更新
00021   double length = sqrt((acceleration.x * acceleration.x) +
00022                        (acceleration.z * acceleration.z));
00023   double x_rad = atan2(-acceleration.y, length);
00024   double z_rad = atan2(acceleration.z, acceleration.x) - (M_PI / 2.0);
00025 
00026   vertical_direction = rad(x_rad);
00027   rotation = rad(z_rad);
00028 }