天天看点

在ROS(indigo)中读取手机GPS用于机器人定位~GPS2BT在ubuntu和window系统下的使用方法~

通过网页快速了解Linux(Ubuntu)和ROS机器人操作系统,请参考实验楼在线系统如下:

初级教程可参考:https://www.shiyanlou.com/courses/854 邀请码:U23ERF8H

中级教程可参考:https://www.shiyanlou.com/courses/938 邀请码:U9SVZMKH

在ROS(indigo)中读取手机GPS用于机器人定位~GPS2BT在ubuntu和window系统下的使用方法~

不需要额外购买GPS设备。

将手机GPS数据通过蓝牙传输给计算机使用,当然通过类似方法也可以使用手机的三轴陀螺和加速度计。

Android Phone:

安装APK:GPS2BT。

1.

在ROS(indigo)中读取手机GPS用于机器人定位~GPS2BT在ubuntu和window系统下的使用方法~

2.

在ROS(indigo)中读取手机GPS用于机器人定位~GPS2BT在ubuntu和window系统下的使用方法~

3.

在ROS(indigo)中读取手机GPS用于机器人定位~GPS2BT在ubuntu和window系统下的使用方法~

Ubuntu 14.04 LTS:

1. 安装蓝牙软件。bluez

在ROS(indigo)中读取手机GPS用于机器人定位~GPS2BT在ubuntu和window系统下的使用方法~

安装好后,就可以将通过蓝牙将计算机和手机配对。

在ROS(indigo)中读取手机GPS用于机器人定位~GPS2BT在ubuntu和window系统下的使用方法~

也可以让计算机通过手机蓝牙上网。

在ROS(indigo)中读取手机GPS用于机器人定位~GPS2BT在ubuntu和window系统下的使用方法~
在ROS(indigo)中读取手机GPS用于机器人定位~GPS2BT在ubuntu和window系统下的使用方法~

言归正传,添加GPS。

2. 添加蓝牙GPS。

~$ hcitool scan 

Scanning ...

00:9A:CD:CF:7D:38ALE-UL00

在ROS(indigo)中读取手机GPS用于机器人定位~GPS2BT在ubuntu和window系统下的使用方法~

~$ 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

在ROS(indigo)中读取手机GPS用于机器人定位~GPS2BT在ubuntu和window系统下的使用方法~

~$ 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";

#}

在ROS(indigo)中读取手机GPS用于机器人定位~GPS2BT在ubuntu和window系统下的使用方法~

重启,就可以在蓝牙配置里启动GPS2BT2了。

3. 用串口调试工具查看GPS数据。

在ROS(indigo)中读取手机GPS用于机器人定位~GPS2BT在ubuntu和window系统下的使用方法~
在ROS(indigo)中读取手机GPS用于机器人定位~GPS2BT在ubuntu和window系统下的使用方法~

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

在ROS(indigo)中读取手机GPS用于机器人定位~GPS2BT在ubuntu和window系统下的使用方法~

~$ rosrun nmea_navsat_driver nmea_topic_serial_reader _port:=/dev/rfcomm0 _baud:=115200

~$ rostopic echo /nmea_sentence

在ROS(indigo)中读取手机GPS用于机器人定位~GPS2BT在ubuntu和window系统下的使用方法~

Windows:

1. 在蓝牙配置中启用SPP。

在ROS(indigo)中读取手机GPS用于机器人定位~GPS2BT在ubuntu和window系统下的使用方法~

2. 测试GPS,选用google earth。

在ROS(indigo)中读取手机GPS用于机器人定位~GPS2BT在ubuntu和window系统下的使用方法~
在ROS(indigo)中读取手机GPS用于机器人定位~GPS2BT在ubuntu和window系统下的使用方法~

由于连接出错,重新连接,端口更新为COM43(原来为COM42)。

~END~