ShowTrace.py 文件源码

python
阅读 29 收藏 0 点赞 0 评论 0

项目:GY-91_and_PiCamera_RaspberryPi 作者: mikechan0731 项目源码 文件源码
def threshold_test(self):
        mx_adj, my_adj, mz_adj = self.mag_adj()
        m_normal = np.sqrt(np.square(mx_adj)+np.square(my_adj)+np.square(mz_adj))

        heading = np.degrees(np.arctan2(mx_adj/m_normal, my_adj/m_normal))

        heading_diff = np.diff(heading)

        rotate_index =  np.insert(np.where(np.absolute(heading_diff)>20.0), 0, 0)

        plt.plot(heading_diff)
        plt.show()

        angle_lst = []
        for i in range(rotate_index.size):
            try:
                angle_onestep = np.mean(heading[rotate_index[i]: rotate_index[i+1]])
                angle_lst.append(angle_onestep)
            except:
                pass

        print angle_lst
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号