ICode9

精准搜索请尝试: 精确搜索
首页 > 编程语言> 文章详细

Python-归一化地球磁场磁场

2019-12-11 04:58:23  阅读:669  来源: 互联网

标签:3d raspberry-pi physics wgs84 python


我和我的团队正在参加ESA Astro Pi挑战赛.我们的程序将在ISS上运行3个小时,我们将返回结果并对其进行分析.

我们想研究Sense HAT磁力计的磁强度测量值与世界磁模型(WMM)的预测之间的联系.我们想研究Sense HAT磁力计的准确性.

该程序将从Sense HAT中获取微特斯拉中的原始磁力计数据(X,Y和Z),并按照British geological survey’s article(第2.1节)中的描述计算值H和F.然后,将它们连同使用ephem计算的时间戳和位置一起保存到CSV文件中.

然后,我们将比较来自ISS和WMM的Z,H和F值,并使用我们的数据和差异创建映射(如图6、8和10所示).然后,我们将研究Sense HAT磁力计数据的准确性.

我们想将我们的数据与WMM数据进行比较,以了解Sense HAT磁力计的准确性,但是我们有一个问题,磁力计的方向总是不同的.因此,我们的数据将总是(非常)不同于WMM,因此我们将无法正确比较它们.

我们与Astro Pi支持团队进行了交谈,他们建议“对角度测量进行归一化,以使其看起来像是由对准北/南的设备进行的测量”.

不幸的是,我们(和他们)不知道该怎么做,所以他们建议在Stack Exchange上问这个问题.我在Math Stack ExchangePhysics Stack ExchangeRaspberry Pi Forums上提出了这个问题.无奈地,他们没有收到任何答复,所以我再次提出这个问题.

我们应该怎么做?我们有时间戳,ISS位置(纬度,经度,海拔),磁数据(X,Y和Z)以及从北方的方向的数据.

我们希望对数据进行归一化,以便能够将它们与WMM中的数据正确比较.

这是我们的程序的一部分,该程序计算磁力计的值(未获得归一化的数据):

compass = sense.get_compass_raw()

try:
    # Get raw data (values are swapped because Sense HAT on ISS is in different position)
    # x: northerly intensity
    # y: easterly intensity
    #  z: vertical intensity
    x = float(compass['z'])
    y = float(compass['y'])
    z = float(compass['x'])

except (ValueError, KeyError) as err:
    # Write error to log (excluded from this snippet)
    pass

try:
    # h: horizontal intensity
    # f: total intensity
    # d: declination
    # i: inclination
    h = sqrt(x ** 2 + y ** 2)
    f = sqrt(h ** 2 + z ** 2)
    d = degrees(atan(y / x))
    i = degrees(atan(z / h))

except (TypeError, ValueError, ZeroDivisionError) as err:
    # Write error to log (excluded from this snippet)
    pass

我们的代码中还有一些简单的模拟器可用:https://trinket.io/library/trinkets/cc87813ce7

来自Astro Pi团队的有关磁力计位置和位置的电子邮件的一部分:

  • Z is going down through the middle of the Sense Hat.
  • X runs between the USB ports and SD card slot.
  • Y runs across from the HDMI port to the 40 way pin header.

On the ISS the AstroPi orientation is that the Ethernet + USB ports face the deck and the SD card slot is towards the sky.
So, that’s basically a rotation around the Y axis from flat. So you keep the Y axis the same and swap around Z and X.


It can help to look at the Google Street view of the interior of the ISS Columbus module to get a better idea how the AstroPi is positioned;
07007

If you pan the camera down and to the right, you’ll see a green light – that’s the AstroPi. The direction of travel for the whole space station is towards the inflatable Earth ball you can see on the left.

07008

So, broadly speaking, the SD card slot points towards azimuth as in away from the centre of the Earth (so the X axis).
The LED matrix is facing the direction of travel of the space station (the Z axis).

Because of the orbital path of the ISS the Z and Y axes will continually change direction relative to the poles as it moves around the Earth.

07009

So, I am guessing you want to normalise the angled measurements so it looks like they were taken by a device aligned North/South?

解决方法:

我认为您需要创建类似于NEH(北,东,高/海拔/上)的局部参考坐标系,例如

> Representing Points on a Circular Radar Math approach.

它在航空中通常用作参考系(标题是从中得出的),因此参考系是根据地理位置及其指向北,东和上的轴计算的.

现在的问题是,北/南对齐并正常化是什么意思?

如果参考设备仅测量投影,则您需要执行以下操作:

dot(measured_vector,reference_unit_direction)

方向为北向,但为单位向量.

如果参考设备也测量了完整的3D,则需要将参考数据和经过测试的测量数据都转换为同一坐标系.通过使用完成

> transform matrices

因此,简单的矩阵*向量乘法就可以了…然后才计算H,F,Z值,而我不知道它们是什么,而且太懒了而无法通过论文……会期望使用E,H或B向量.

但是,如果在测量时刻没有地理位置,则相对于国际空间站的欧拉角就是欧拉角,因此根本无法构建3D参考系(除非获得2个已知矢量,而不仅仅是一个像UP).在这种情况下,您需要使用选项1投影(使用点积和北向矢量).因此,之后您将只处理标量值而不是3D向量.

[Edit1]

从您的链接:

The geomagnetic field vector, B, is described by the orthogonal
components X (northerly intensity), Y (easterly intensity) and Z
(vertical intensity, positive downwards);

这不是我的专业领域,所以我在这里可能是错的,但这是我的理解方式:

B(Bx,By,Bz)-磁场矢量
a(ax,ay,az)-加速度

现在F是B的大小,因此其旋转不变:

F = |B| = sqrt( Bx*Bx + By*By + Bz*Bz )

您需要计算NED参考帧(北,东,下)中B的X,Y,Z值,因此首先需要基向量:

Down = a/|a|  // gravity points down
North = B/|B| // north is close to B direction
East = cross(Down,North) // East is perpendicular to Down and North
North = cross(East,Down) // north is perpendicular to Down and East, this should convert North to the horizontal plane

您应该使它们可视化地检查它们是否指向正确的方向,如果不通过对交叉操作数进行重新排序来取反它们(我可能使用了错误的顺序,而我习惯使用Up向量).现在只需将B转换为NED即可:

X = dot(North,B)
Y = dot(East,B)
Z = dot(Down,B)

现在您可以计算H

H = sqrt( X*X +Y*Y )

为此所需的矢量数学将在上面的转换矩阵链接中找到.

请注意,只有在不存在加速度的情况下(传感器在操作过程中未将机械臂放在机械臂上,或者ISS没有在燃烧)时,此方法才起作用.

如果这不能正常工作,则可以从ISS位置计算NED,但是为此,您需要知道传感器相对于提供位置的仿真模型的确切方向和位移.我不知道国际空间站的轮换工作,因此除非万不得已,否则我不会触及该主题.

恐怕我将没有时间编码…总之,如果没有样本输入数据也没有坐标系统说明,并且所有输入/输出变量都是疯狂的,那么编码…简单地否定轴将使整个过程无效.沿途有很多重复,要覆盖所有这些重复,您最终会有很多版本尝试…

应逐步构建应用程序,但恐怕无法访问仿真或实际硬件.还有很多事情可能会出错…使即使简单的程序也难以编写代码…我将首先检查F,因为它首先不需要任何“规范化”,看看结果是否正确或不.如果关闭,则可能表明其他单位或上帝知道…

标签:3d,raspberry-pi,physics,wgs84,python
来源: https://codeday.me/bug/20191211/2106695.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有