丸いプレートが回転しているとき、回転角度(写真を参照)を見つける必要があります。 実際には、回転角は1つのみ必要ですが、Samsung Galaxy S4のSensors2OSCで取得したデータがあります。 このアプリを使用すると、加速度計とジャイロスコープの浮動小数点データをOSCで処理することができます。 Iは、センサ融合のために使用する必要がセンサ最も正確な結果を提供する方法 電話をプレートの背面に搭載されている..アンドロイド携帯からの生データを使った回転角度
https://github.com/SensorApps/Sensors2OSC
?
import oscP5.*;
import netP5.*;
OscP5 oscP5;
NetAddress myRemoteLocation;
LowPass lp;
float number1 = 0.0;
void setup() {
size(1200, 600, P3D);
oscP5 = new OscP5(this, 9000);
lp = new LowPass(10); //The argument is the FIFO queue length
}
void draw() {
background(0);
lights();
pushMatrix();
translate(300, height/2, -100);
rotateZ(-number1);
box(330, 200, 40);
popMatrix();
pushMatrix();
translate(900, height/2, -100);
lp.input(number1);
rotateZ(lp.output);
box(330, 200, 40);
popMatrix();
}
/* incoming osc message are forwarded to the oscEvent method. */
void oscEvent(OscMessage theOscMessage) {
if (theOscMessage.addrPattern().equals("/rotationvector/z"));
number1 = theOscMessage.get(0).floatValue();
}
class LowPass {
ArrayList buffer;
int len;
float output;
LowPass(int len) {
this.len = len;
buffer = new ArrayList(len);
for (int i = 0; i < len; i++) {
buffer.add(new Float(0.0));
}
}
void input(float v) {
buffer.add(new Float(v));
buffer.remove(0);
float sum = 0;
for (int i=0; i<buffer.size(); i++) {
Float fv = (Float)buffer.get(i);
sum += fv.floatValue();
}
output = sum/buffer.size();
}
}
あなたの写真は直角を持っている必要があります –