我试图让传感器以稳定的传感器速率工作。 其中一个传感器事件的示例!
public void onSensorChanged(SensorEvent event)
{
SensorManager.getRotationMatrixFromVector(rotation, event.values);
SensorManager.getOrientation(rotation, orientation);
orientation[0]=(float)Math.toDegrees(orientation[0]);
orientation[1]=(float)Math.toDegrees(orientation[1]);
orientation[2]=(float)Math.toDegrees(orientation[2]);
azimuth.setText(String.valueOf(orientation[0]));
pitch.setText(String.valueOf(orientation[1]));
roll.setText(String.valueOf(orientation[2]));
elapsedTime = (System.currentTimeMillis() /1000.0) - startTime ;
sampleRate = 1 / (elapsedTime - oldElapsedTime);
sampleRateText.setText(String.valueOf(sampleRate));
list.add(String.valueOf(elapsedTime).replace(".", ",") + ";");
list.add(String.valueOf(orientation[0]).replace(".", ",") + ";");
list.add(String.valueOf(orientation[1]).replace(".", ",") + ";");
list.add(String.valueOf(orientation[2]).replace(".", ",") + ";");
oldElapsedTime = elapsedTime;
}
Excel图表SensorRate RotationVector:
Excel图表SensorRate Accelero:
正如您所看到的,Accelero传感器的传感器速率要差得多。 我知道像Android这样的操作系统可以同时完成许多事情,因此无法获得完美稳定的传感器速率。 所以我的问题是,如果有人经历过同样的事情,你做了什么?
此致 布莱希特