Python-归一化地球磁场磁场

前端之家收集整理的这篇文章主要介绍了Python-归一化地球磁场磁场 前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

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

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

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

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

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

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

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

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

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

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

@H_403_2@

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@H_403_2@

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

@H_403_2@

  • 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.@H_403_2@


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@H_403_2@

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.@H_403_2@

07008@H_403_2@

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).@H_403_2@

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.@H_403_2@

07009@H_403_2@

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

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

> Representing Points on a Circular Radar Math approach.@H_403_2@

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

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

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

@H_403_2@

dot(measured_vector,reference_unit_direction)

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

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

> @L_301_8@@H_403_2@

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

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

[Edit1]@H_403_2@

从您的链接:@H_403_2@

@H_403_2@

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

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

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

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

@H_403_2@

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

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

@H_403_2@

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即可:@H_403_2@

@H_403_2@

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

现在您可以计算H@H_403_2@

@H_403_2@

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

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

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

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

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

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

猜你在找的Python相关文章