daily pastebin goal
34%
SHARE
TWEET

Untitled

a guest Jul 11th, 2018 60 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. private void computeOrientation() {
  2.     if (SensorManager.getRotationMatrix(m_rotationMatrix, null,
  3.                                         m_lastMagFields, m_lastAccels)) {
  4.         SensorManager.getOrientation(m_rotationMatrix, m_orientation);
  5.  
  6.         /* 1 radian = 57.2957795 degrees */
  7.         /* [0] : yaw, rotation around z axis
  8.          * [1] : pitch, rotation around x axis
  9.          * [2] : roll, rotation around y axis */
  10.         float yaw = m_orientation[0] * 57.2957795f;
  11.         float pitch = m_orientation[1] * 57.2957795f;
  12.         float roll = m_orientation[2] * 57.2957795f;
  13.  
  14.         /* append returns an average of the last 10 values */
  15.         m_lastYaw = m_filters[0].append(yaw);
  16.         m_lastPitch = m_filters[1].append(pitch);
  17.         m_lastRoll = m_filters[2].append(roll);
  18.         TextView rt = (TextView) findViewById(R.id.roll);
  19.         TextView pt = (TextView) findViewById(R.id.pitch);
  20.         TextView yt = (TextView) findViewById(R.id.yaw);
  21.         yt.setText("azi z: " + m_lastYaw);
  22.         pt.setText("pitch x: " + m_lastPitch);
  23.         rt.setText("roll y: " + m_lastRoll);
  24.     }
  25. }
  26.    
  27. if (SensorManager.getRotationMatrix(m_rotationMatrix, null,
  28.                                     m_lastAccels, m_lastMagFields)) {
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top