LMS+cartogapher+turtlebot2实践

一、需要的安装的包和硬件

ROS lms1XX cartographer_turtlebot,其他的小的ros依赖包如果在用的时候找不到文档会有详细的介绍的
两台pc,turtlebot2 lms1xx激光雷达,一部能开热点的智能手机
注单纯的跑包可以用:https://www.jianshu.com/p/00f6631b53e5

二.系统版本

pc:ros版本–ubuntu 16.04 linux版本–kinetic 机器人型号–turtlebot2 激光传感器–lms1xx

三.lms1XX的安装

安装
1.deb包安装
sudo apt-get install ros-indigo-lms1xx
2.源码安装
$ mkdir -p ~/turtlebot_ws/src
$ cd ~/turtlebot_ws/src
$ git clone https://github.com/ncnynl/LMS1xx.git
3.#编译
$cd ~/turtlebot_ws
$catkin_make
4.修改IP 激光雷达的IP
我们实验室LMS111激光雷达的的默认IP地址是169.254.125.187
Ubuntu的IP
在Ubuntu下“编辑连接”——“以太网”——“添加”创建一个名为lmsxxx的有线连接
手动设定子网掩码为255.255.255.0,手动设定IP为169.254.125.189(IP与LMSxxx设备IP就处于同一网段就行了)
5.测试 激光雷达通过网线连接到ubuntu电脑
新终端,执行 $ roscore
新终端,执行 $ rosrun lms1xx LMS1xx_node _host:=169.254.125.187
新终端,执行 $ rosrun rviz rviz
左击ADD–>by topic–>选择LaserScan
这时会发现status error,再将FixedFrame后面的值改为laser即可

四、制作雷达驱动启动文件

在computer/opt/ros/kinetic/share查看有没有turtlebot_navigation文件夹
没有的话,先安装
打开终端 s u d o a p t − g e t i n s t a l l r o s − k i n e t i c − t u r t l e b o t − n a v i g a t i o n 建 立 一 个 L M S 1 x x . l a u n c h 文 件 , 内 容 ( 记 得 改 成 自 己 的 I P ) < l a u n c h > < a r g n a m e = " h o s t " d e f a u l t = " 169.254.125.187 " / > < n o d e p k g = " l m s 1 x x " n a m e = " l m s 1 x x " t y p e = " L M S 1 x x n o d e " > < p a r a m n a m e = " h o s t " v a l u e = " sudo apt-get install ros-kinetic-turtlebot-navigation 建立一个LMS1xx.launch文件,内容(记得改成自己的IP) <launch> <arg name="host" default="169.254.125.187" /> <node pkg="lms1xx" name="lms1xx" type="LMS1xx_node"> <param name="host" value=" sudoaptgetinstallroskineticturtlebotnavigationLMS1xx.launchIP<launch><argname="host"default="169.254.125.187"/><nodepkg="lms1xx"name="lms1xx"type="LMS1xxnode"><paramname="host"value="(arg host)" />




打开终端 $sudo nautilus
将lms1xx.launch放在了/opt/ros/kinetic/share/turtlebot_navigation/laser/driver里面了,成功运行
关闭终端

五、cartographer_turtlebot的安装

kinetic+turtlebot3参考网址(按照步骤来就行了)
https://www.ncnynl.com/archives/201801/2230.html
indigo版本可以按照
https://www.ncnynl.com/archives/201801/2230.html
能安装成功cartographer_turtlebot

六、turtlebot_pc与远程终端pc通讯

两台pc执行
$sudo apt-get install chrony
$sudo apt-get install ntpdate
$sudo ntpdate ntp.ubuntu.com
$sudo apt-get install openssh-server
$sudo service ssh status
打开手机热点,两台电脑都连接热点
$ifconfig -a
记下两台pc的网络IP
1.turtlebot_pc上的配置
打开终端 运行 gedit ~/.bashrc
在文档末端写上
export ROS_MASTER_URI=http://turtlebot_pc_ip:11311
export ROS_HOSTNAME= turtlebot_pc_ip
2.远程终端pc上的配置
打开终端 运行 gedit ~/.bashrc
在文档末端写上
export ROS_MASTER_URI=http://turtlebot_pc_ip:11311
export ROS_HOSTNAME= 远程终端pc_ip
3.ping一下
Ping对方pc的ip

七、turtlebot_pc与远程终端pc配置

1.turtlebot_pc的配置
在cartographer_ws中进行配置
① 增加 turtlebot_lidar.launch
进入 ~/cartographer_ws/src/cartographer_turtlebot/cartographer_turtlebot/launch
写下代码为(正确的无需修改):






② 新增启动文件 turtlebot_lidar_2d.launch $ cd ~/catkin_ws/src/cartographer_turtlebot/cartographer_turtlebot/launch

写下代码:

③重新编译

$ cd ~/cartographer_ws
$ catkin_make_isolated --install --use-ninja

2.远程终端pc配置
主要配置可视化界面rviz的launch的文件
打开终端输入sudo nautilus
将写好的view_navigation_cartographer.launch文件粘贴到/opt/ros/indigo/share/turtlebot_rviz_launchers/launch中
如果找不到turtlebot_rviz_launchers运行代码
sudo apt-get install ros-kinetic-turtlebot-rviz-launchers
view_navigation_cartographer.launch文件


八、turtlebot_pc与远程终端pc跑turtlebot指令

1.turtlebot_pc的配置
①启动lms111雷达
打开一个新终端,输入:
$ roslaunch turtlebot_navigation LMS1xx.launch
②启动cartographer
打开一个新终端,输入:
$roslaunch cartographer_turtlebot turtlebot_lidar_2d.launch

2.远程终端pc配置
③打开可视化界面rviz
打开一个新终端,输入:
$ roslaunch turtlebot_rviz_launchers view_navigation_cartographer.launch
④打开键盘控制
roslaunch turtlebot_teleop keyboard_teleop.launch

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值