code: def pitch_sim(SIMSTATE, GPS_RAW):
      '''estimate pitch from SIMSTATE accels'''
      xacc = SIMSTATE.xacc - lowpass(delta(GPS_RAW.v,"v")*6.6, "v", 0.9)
      zacc = SIMSTATE.zacc
      zacc += SIMSTATE.ygyro * GPS_RAW.v;
      if xacc/zacc >= 1:
          return 0
      if xacc/zacc <= -1:
          return -0
      return degrees(-asin(xacc/zacc)f pitch_sim(SIMSTATE, GPS_RAW):
      '''estimate pitch from SIMSTATE accels'''
      xacc = SIMSTATE.xacc - lowpass(delta(GPS_RAW.v,"v")*6.6, "v", 0.9)
      zacc = SIMSTATE.zacc
      zacc += SIMSTATE.ygyro * GPS_RAW.v;
      if xacc/zacc >= 1:
          return 0
      if xacc/zacc <= -1:
          return -0
      return degrees(-asin(xacc/zacc))
docs: estimate pitch from SIMSTATE accels