1. 原理
http://people.csail.mit.edu/bkph/ftmrtt_intro
优点是AP和phone不需要是同步。
The round trip time measurements are not perfectly accurate, being subject to various types of measurement error, RF interference as well as the positions and motions of objects in the environment. Repeated measurements may improve the quality a bit.
The agreed upon IEEE 802.11mc (a.k.a. IEEE 802.11-2016) WiFi standard provides methods for performing such measurements (with an expected accuracy of perhaps a meter or two). Android Pie (Android 9.0) and later support such IEEE 802.11mc based RTT measurements (API level 28 or later).
2. 环境
2.1硬件:
ESP32-S2-Saola-1
测距至少需要2个(一个AP,一个STA)
定位至少需要4个(三个AP,一个STA)
https://item.taobao.com/item.htm?spm=a1z10.5-c-s.w4002-22443450244.14.17fc27e6u5ebuE&id=612711016956
https://www.espressif.com/sites/default/files/documentation/esp32-s2_datasheet_en.pdf
2.2软件:
Arduino
https://www.arduino.cc/en/software
安装espressif库文件
参考
https://docs.espressif.com/projects/arduino-esp32/en/latest/installing.html
Currently, the support for new chips (ESP32-S2 and ESP32-C3) is in the development release. Consider installing the development release if you need to test the new supported SoC in beta.
设置第三方开发板的源, 将
https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_dev_index.json
黏贴到:
中的
更新开发板:
搜索esp32,选择2.0.0-rc1
安装过程比较长,如果超时,重试。
配置硬件
选择ESP32S2 Dev Module
通过microUSB连接PC,生成COMX端口
找到例程
编译下载程序
运行监控程序(串口速率115200)
3. 测试程序
参考:
C:\Users\XXX\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.0-rc1\libraries\WiFi\examples\FTM\FTM_Initiator\README.md
3.1 信道不匹配问题
首次运行示例代码中会发现信道不匹配
3.2 Wi-Fi FTM Initiator(STA)
在C:\Users\XXX\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.0-rc1\libraries\WiFi\src\WiFiGeneric.h中
channel Primary channel of the FTM Responder
信道默认为0,FTM_Initiator.ino中使用默认值
3.3 Wi-Fi FTM Responder(AP)
https://docs.espressif.com/projects/arduino-esp32/en/latest/api/wifi.html?highlight=ftm#softap
bool softAP(const char* ssid, const char* passphrase = NULL, int channel = 1, int ssid_hidden = 0, int max_connection = 4, bool ftm_responder = false);
在FTM_Initiator.ino的initiateFTM中设置信道为1
3.4 正常运行结果
Responder
Initiator
3.4 关于CONF_REJECTED
在运行一定事件后会出现:FTM Error: CONF_REJECTED
请问谁有好的解决方案?欢迎留言。谢谢!