在ROS(indigo)中讀取手機GPS用於機器人定位~GPS2BT在ubuntu和window系統下的使用方法~
不需要額外購買GPS設備。
將手機GPS數據通過藍牙傳輸給計算機使用,當然通過類似方法也可以使用手機的三軸陀螺和加速度計。
Android Phone:安裝APK:GPS2BT。
1.

2.

3.
Ubuntu 14.04 LTS:1. 安裝藍牙軟件。bluez

安裝好後,就可以將通過藍牙將計算機和手機配對。

也可以讓計算機通過手機藍牙上網。


言歸正傳,添加GPS。
2. 添加藍牙GPS。
~$ hcitool scan
Scanning ...
00:9A:CD:CF:7D:38ALE-UL00

~$ sdptool browse 00:9A:CD:CF:7D:38
Service Name: GPS2BT2
Service RecHandle: 0x1000c
Service Class ID List:
"Serial Port" (0x1101)
Protocol Descriptor List:
"L2CAP" (0x0100)
"RFCOMM" (0x0003)
Channel: 5

~$ sudo gedit /etc/bluetooth/rfcomm.conf
# RFCOMM configuration file.
#
#rfcomm0 {
# # Automatically bind the device at startup
# bind yes;
#
# # Bluetooth address of the device
# device 00:9A:CD:CF:7D:38;
#
# # RFCOMM channel for the connection
# channel 5;
#
# # Description of the connection
# comment "Example Bluetooth GPS device";
#}

重啟,就可以在藍牙配置裡啟動GPS2BT2了。
3. 用串口調試工具查看GPS數據。


4. ROS中查看GPS數據。
需要安裝如下功能包:
~$ sudo apt-get install ros-indigo-nmea-*
安裝完成後,啟動roscore,需要用到下面命令:
~$ rosrun nmea_navsat_driver nmea_serial_driver _port:=/dev/rfcomm0 _baud:=115200
~$ rostopic echo /fix

~$ rosrun nmea_navsat_driver nmea_topic_serial_reader _port:=/dev/rfcomm0 _baud:=115200
~$ rostopic echo /nmea_sentence
Windows:1. 在藍牙配置中啟用SPP。

2. 測試GPS,選用google earth。


由於連接出錯,重新連接,端口更新為COM43(原來為COM42)。
~END~