def heading(self):
(x, y, z) = self.raw_data()
headingRad = math.atan2(y, x)
headingRad += self.__declination
# Correct for reversed heading
if headingRad < 0:
headingRad += 2 * math.pi
# Check for wrap and compensate
elif headingRad > 2 * math.pi:
headingRad -= 2 * math.pi
# Convert to degrees from radians
headingDeg = headingRad * 180 / math.pi
return headingDeg
评论列表
文章目录