Member #941255

Member Since: April 9, 2017

Country: United States

  • This isn't working. I have converted the code to Arduino and, if I rotate (yaw) the BNO080, then the both X and Y are thrown off and then settle back to 0.

    // Return the Euler angle structure from a Quanterion structure 
    Euler getAngles(Quant q, bool degrees){
      Euler ret_val;
    
      float x; float y;
    
      // YAW 
      x = 2 * ((q.i * q.j) + (q.real * q.k)); 
      y = sq(q.real) - sq(q.k) - sq(q.j) + sq(q.i); 
      ret_val.yaw = degrees(atan2(y, x));
    
      // PITCH 
      ret_val.pitch = degrees(asin(-2 * (q.i * q.k - q.j * q.real)));
    
      // ROLL
      x = 2 * ((q.j * q.k) + (q.i * q.real)); 
      y = sq(q.real) + sq(q.k) - sq(q.j) - sq(q.i); 
      ret_val.roll = degrees(atan2(y , x));
    
    return ret_val;
    
    }
    

No public wish lists :(