Classiclll's Blog

an old boy

AttitudeAnalysis with two accerelometers using Wrj4P5

イメージ 1

Proce55ing(Processing)用のWiiリモコンライブラリーWrj4P5による姿勢解析 その3(だっけ?)

まだ、スクリプトは出来てないんだけど、Wrj4P5を作った元々の目的、【リアル3Dポインター】に向けて、theoritical thinkingをしてみた。
IRセンサーを使えば、限定的な範囲で3Dポインターとして使えることは、世の中の常識。【リアル】の意味は範囲を限定しないこと。

同じようなアイデアを持った好人がWiiLi.orgにいたんで、彼のポストにfollowしたのが下記囲み。
ひどい英語なんだけど、英語の用法、論理展開の抜け漏れ誤りがあったら、その都度指摘してくれると非常~にありがたい。

大意は、
Wiiリモコンで検出される加速度(加力)ベクトルは様々なベクトルの合成結果
・回転加速度(接線および遠心方向)、重力加速度、印加加速度を分離するのが目的。
・静かな状態のもとで得られる情報は、roll(横揺れ)、pitch(縦揺れ)のみ。(yaw(偏揺れ)は得られない。)
・二つの加速度計を束ねて得られる二つの観測ベクトルの差をとることで、【自己】回転ベクトルを抽出できるはず。
(いくつかの情報が得られ、いくつかの前提がなりたち、誤差をうまく押さえられれば)所望の分離が可能となるかもしれない。

なので、まずIRセンサを使わないで、静かな状態でのyawの検出にトライしてみようかと思っている。
<the problem definition> 
let 
 * sFt : sensed force vector (at time t), in terms of G's 
 * mFt : moving force vector 
 * tFt : tangent force vector of self-rotation 
 * cFt : centrifugal force vector of self-rotation 
 * gF  : gravitational force vector (always tward the Earth) 
 * dt  : time duration from last sensing (at time t) 
then 
 in general 
    sFt = mFt + tFt + cFt +gFt 
now we want to devide 4 forces from the sensed force vector sFt 
once done, we ca obtain 
  Velocity at t,            wVt <- sum(mFt*dt) 
  Location at t,            wLt <- sum(wVt*dt) 
and 
  Rotational Velocity at t, wRt <- sum(tFt*dt) 
  Attitude at t,            wAt <- sum(wRt*dt) 
   * attitude is consist of two unit vector, toBottom and toFront.

<in case of stable assumption> 
we can suppose mFt=0, cFt<<0, tFt<<0 under the assumption. 
so we obtain sFt==tFt+gF(t-1), gFt == sFt, and 
  attitude at t,      wAt.rotate(axis,angle)
    where axis is a unit vector of cross product of sFt and toBottom
      with my 3D vector class "Loc", wSt.cross(toBottom).unit()
or simply
  roll of wii at t,   roll  == asin(sFt.x) 
  pitch of wii at t,  pitch == asin(sFt.y)

<modeling the TiagoTiago's idea> 
now we have a couple of accelerometers, two remotes, or remote w/t nunchuck. 
let 
 * xXtn : xXt is a previously-defined vectors, and n(=0,1) for distinction 
 * rod  : virtual rod between our accelerometers, rod.norm() is rod length. 
and supposing 
 1. both accelerometers are on the same coordinate. 
 2. each sensing are done simultaneously. 

<using TiagoTiago's model> 
by subtracting sFt1 from sFt0 we can obtain the self-rotatonal force vector of the rod. 
let 
  rFt = sFt0-sFt1, then rFt == (tFt0+tFt1) + (cFt0 +cFt1) 
   (please examine above, by drawing force vectors on 2D space = paper.) 

now if we makeup the 1. and 2. situation, and if we measure the rod vector value, 
we can distinct the tFt0+tFt1 to obtain the self-rotation of wiiremote, by projection of rFt to rod. 

using self-rotation vector, in theory, we can get the gFt without stable assumption. 

and we can distinct the mFt, the target acceleration.


Processing については、
日本語サポートサイトからたどれるP5インフォメーション→言語が参考になる。
(解説してあるのは一昔前の版だから注意が必要だけど、loop()→draw()の読み替えだけで大抵OK)
・山本徹(thoru)さんがFunProce55ingで解説してくれている。(【簡潔】で【わかり易く】、【楽しい】解説)
例題集は習作集と区別するためにこちらに置いている。
・P5のスケッチからアプレットを作り、【ジオシティーズ】にアップする手順をまとめたので、参考に。
WiiRemoteアクセスライブラリWrj4P5はここ