def raw_mag_heading(self):
mx = self.raw_data['mx'].astype(np.float32)
my = self.raw_data['my'].astype(np.float32)
mz = self.raw_data['mz'].astype(np.float32)
m_normal = np.sqrt(np.square(mx)+np.square(my)+np.square(mz))
heading = np.arctan2(mx/m_normal, my/m_normal)
roll = np.arctan2(my/m_normal, mz/m_normal)
pitch = np.arctan2(mx/m_normal, mz/m_normal)
plt.plot(np.degrees(heading), "red", label="heading")
#plt.plot(np.degrees(roll), "green", label="roll")
#plt.plot(np.degrees(pitch), "blue", label="pitch")
#plt.plot(m_normal, "yellow", label='m_normal')
plt.legend(loc='upper left')
plt.show()
ShowTrace.py 文件源码
python
阅读 30
收藏 0
点赞 0
评论 0
评论列表
文章目录