简体   繁体   English

如何使用多点连接(Wifi 网络)计算两个 iOS 设备之间的距离?

[英]How to calculate distance between two iOS devices using Multipeer connectivity(Wifi network)?

How to calculate the distance between two iOS devices using a wireless connection.如何使用无线连接计算两个 iOS 设备之间的距离。

I figure out we can calculate using BLE , using RSSI number.我发现我们可以使用BLE计算,使用RSSI编号。

But the range of the device varies and the device placed in the room far away cannot be discovered.但是设备的范围不同,放置在房间较远的设备是无法被发现的。

My requirement is to calculate the distance device present in the room.我的要求是计算房间中存在的距离设备。

I have looked into the Multi-peer connectivity framework , but there is no such thing as the RSSI number.我已经查看了Multi-peer 连接框架,但没有RSSI号码之类的东西。

Thanks in advance.提前致谢。

You can check the new NearbyInteraction https://www.reddit.com/r/iOSProgramming/comments/hfq5w8/nearbyinteraction_guide_and_github_repository/?utm_source=share&utm_medium=web2x&context=3您可以查看新的 NearbyInteraction https://www.reddit.com/r/iOSProgramming/comments/hfq5w8/nearbyinteraction_guide_and_github_repository/?utm_source=share&utm_medium=web2x&context=3

but will works on iphone 11 and above, bcz thes devices have the U1 chip但适用于 iphone 11 及更高版本,bcz 这些设备具有 U1 芯片

@Lance Samaria and @ Bassem Halawa here is the code using iBeacon. @Lance Samaria 和 @Bassem Halawa 这里是使用 iBeacon 的代码。 I was able to achieve distance proximity 85% to 90%.我能够实现 85% 到 90% 的距离接近度。 I have used Kalman filter to reduce background noise.我使用卡尔曼滤波器来减少背景噪声。

Here is the link for Kalman filter: - [https://stackoverflow.com/q/29027824/9673374][1]这是卡尔曼滤波器的链接:-[https://stackoverflow.com/q/29027824/9673374][1]

I have calculated distance using RSSI value here is the code supporting that.我已经使用 RSSI 值计算了距离,这是支持该值的代码。

 func calculateNewDistance(_ txCalibratedPower: Int, rssi: Int) -> Double {
        if rssi == 0 {
            return -1
        }
        let ratio = Double(exactly:rssi)!/Double(txCalibratedPower)
        if ratio < 1.0 {
            return pow(10.0, ratio)
        }
        else {
            let accuracy = 0.89976 * pow(ratio, 7.7095) + 0.111
            return accuracy
        }
    }

Let me know if this was helpful.让我知道这是否有帮助。 [1]: Kalman filter for RSSI in iOS [1]: iOS 中用于 RSSI 的卡尔曼滤波器

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM