【问题标题】:Finding Positions Using Trilateration and Filtering them using Monte Carlo Theorem In Python / Jupyter Lab在 Python / Jupyter Lab 中使用三边测量法查找位置并使用蒙特卡洛定理过滤它们
【发布时间】:2023-02-09 04:31:49
【问题描述】:

我是 Python 的新手。最近我刚开始使用 Jupyter Lab。因此,我在 Excel CSV 文件中收集了一个 RSS 提要值。我想在其中应用**三边测量**公式来找到位置。但我完全不知道我该怎么做。任何人都可以帮助我了解事实吗?所以数据是像附图一样收集的。 enter image description here

下面还给出了收集的数据样本。

https://aiubedu60714-my.sharepoint.com/:x:/g/personal/18-36632-1_student_aiub_edu/EZx44mosc7pInAsxAFX5J1wBylO7rmtmxNqW8SIAXRoIyw?e=92L8v8

我也想试试蒙特卡洛求精度值的定理。

非常感谢您指导我完成整个过程。

【问题讨论】:

  • 请提供足够的代码,以便其他人可以更好地理解或重现问题。

标签: python-3.x rss jupyter-lab montecarlo trilateration


【解决方案1】:

我没有使用 monte carlo 定理,但要在这种情况下使用三边测量,您首先需要使用信号传播路径损耗公式将 RSS 值转换为距离:

def rss_to_meters(rss: float, c: float, phi: float) -> float:
    return Math.Log10(10, (c - rss) / (10 * phi))

其中 c 是在发送和接收天线之间一米距离处测得的平均 RSS。在我的例子中,它通常接近 -50dB。 phi 是路径损耗指数,一个介于 1 和 4 之间的值,其中 4 是噪音很大的环境(例如,有很多家具)。在许多情况下,3 可能是一个很好的猜测。

由于 RSSI 波动很大,因此输入此方法的 rss 最好是多个样本的平均值。您仍然不太可能使用三边测量公式获得准确的预测,但这里是:

def get_a(d2: float, d3: float, x2: float, x3: float, y2: float, y3: float) -> float:
    return ((d2 ** d2 - d3 ** d3) - (x2 ** x2 - x3 ** x3) - (y2 ** y2 - y3 ** y3)) / 2

def get_b(d1, d2, x1, x2, y1, y2) -> float:
    return ((d2 ** d2 - d1 ** d1) - (x2 ** x2 - x1 ** x1) - (y2 ** y2 - y1 ** y1)) / 2

def get_position_y(a: float, b: float, x1: float, x2: float, x3: float, y1: float, y2: float, y3: float) -> float:
    return (b * (x3 - x2) - a * (x1 - x2) ) / ( (y1 - y2) * (x3 - x2) - (y3 - y2) * (x1 - x2) )

def get_position_x(a: float, y: float, y3: float, y2: float, x3: float, x2: float) -> float:
    return (a - (y * (y3 - y2) ) ) / (x3 - x2)

您应该选择三个最近的锚点来进行计算,因为 RSS 在距离越远的地方波动越大。 d1 表示 (x, y) 处的未知节点与 (x1, y1) 处的第一个锚点之间的距离。 'd2' 是 (x, y) 处的未知节点与 (x2, y2) 处的第二个锚点之间的距离。 'd2' 是 (x, y) 处的未知节点与 (x3, y3) 处的第二个锚点之间的距离。因此,您还需要知道每个锚点(或图像中的“主题”)的二维坐标。您可以使用 get_position_x()get_position_y() 获得最终坐标 (x, y)。 a 和 b 并不重要,只是计算 x 和 y 坐标的间歇步骤。

这种三边测量方法源自以下论文:https://ieeexplore.ieee.org/document/1391018

通常,RSS 结合三边测量算法会产生极差的定位精度,因为 RSS 测​​量结果的噪声很大,即使在计算平均 RSS 之后也是如此。三边测量需要良好的距离近似值才能正常运行。更好的替代方法是使用本文中介绍的“修改后的加权质心定位”算法:https://ieeexplore.ieee.org/document/4447528。当使用嘈杂的 RSS 样本时,此算法通常更宽容。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-02-06
    • 2021-01-06
    • 2014-12-09
    • 2019-08-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多