当前位置:网站首页>基于ROS的SLAM建图、自动导航、避障(冰达机器人)
基于ROS的SLAM建图、自动导航、避障(冰达机器人)
2022-06-30 04:03:00 【01年的摸鱼老手】
SLAM是Simultaneous localization and mapping缩写,意为“同步定位与建图”,主要用于解决机器人在未知环境运动时的定位与地图构建问题。机器人在未知环境中从一个未知位置开始移动,在移动过程中根据位置和地图进行自身定位,同时在自身定位的基础上建造增量式地图,实现机器人的自主定位和导航。
小车可以运行ros中激光雷达功能包,在PC端的rviz中可以查看;在启动底盘、键盘控制后可以控制小车移动;根据SLAM算法对实验室的环境进行建图;可以保存、读取地图,在PC端控制小车从A点到B点实现路径规划并自动避障。
本文以冰达机器人小车为例,在实际使用过程中遇到了一些问题,总结出的较为详细的教程。
软件平台:Linux(Ubuntu18.04.6)。
硬件平台:冰达机器人。
语言版本:Python 2.7
一.安装ROS及配置环境
1.ROS安装
个人推荐使用小鱼的一键安装,可以解决99%的问题
一键安装指令:
wget http://fishros.com/install -O fishros && . fishros官网:主页 | 鱼香ROS(但是教学以ROS2为主,冰达机器人只能用ROS1)
开源地址:https://github.com/fishros/install
2.工作区安装
首先从git上下载所需要的功能包到你的工作空间,我们还是以catkin_ws工作空间为例
mkdir -p ~/catkin_ws/src/
cd ~/catkin_ws/src/
git clone https://gitee.com/bingda-robot/base_control.git
git clone https://gitee.com/bingda-robot/lidar.git
git clone https://gitee.com/bingda-robot/robot_vision.git
git clone https://gitee.com/bingda-robot/robot_navigation.git
git clone https://gitee.com/bingda-robot/robot_simulation.git拉取完成后编译工作空间
cd ~/catkin_ws/
catkin_make
然后来解决功能包依赖
如果你的rosdep可以正常使用(按照这个教程都可以正常使用),那么可以通过rosdep来检查依赖的包是否都满足
cd ~/catkin_ws/
rosdep check --from-path src
如果执行结果为“All system dependencies have been satisfied”,则所有依赖项目已经满足,无需安装
否则,再执行下面指令安装依赖包
rosdep install --from-path src -y
如果你的rosdep无法正常工作,那么你可以通过安装我们所提供的依赖清单来手动安装
sudo apt-get update
sudo apt-get install ros-$ROS_DISTRO-teleop-twist-keyboard ros-$ROS_DISTRO-amcl ros-$ROS_DISTRO-move-base ros-$ROS_DISTRO-slam-gmapping ros-$ROS_DISTRO-slam-karto ros-$ROS_DISTRO-cartographer ros-$ROS_DISTRO-cartographer-ros ros-$ROS_DISTRO-dwa-local-planner ros-$ROS_DISTRO-teb-local-planner ros-$ROS_DISTRO-uvc-camera ros-$ROS_DISTRO-map-server ros-$ROS_DISTRO-hector-slam* ros-$ROS_DISTRO-global-planner ros-$ROS_DISTRO-navfn -y设置环境变量
cd /catkin_ws/devel
source setup.bash二.配置分布式
- 连接机器人:ssh [email protected]
- 打开虚拟机终端输入,ifconfig查看Ubuntu的IP地址,让两个机器互ping,确保可以收到数据。
- 在PC端输入gedit .bashrc 对 .bashrc进行修改(名字、机器人ip),添加相关信息,如下图所示。

图1 .bashrc文件新增内容
三.同步小车时间
.因为robot没有断电保护,所以每次关机重启后,它的时间不能与真实时间对应上,而我们的pc是能够连接外网,能够通过ntp服务器进行时间校准
如果在实验中pc没有外网环境,先帮pc获取一个外网环境,然后安装一个ntp服务器:
[email protected]:sudo apt install ntp把我们的pc当成一个ntp服务器,robot去根据pc进行自身的时间校准:
[email protected]:sudo ntpdate 192.168.x.x //每个人电脑分配的ip不同,这里以自己的pc的ip为准如果发现robot无法通过pc进行时间校准,则手动校准时间:
[email protected]:sudo date --s=" 2022-06-21 11:12:00"四.启动激光雷达
- 启动激光雷达:
[email protected]:roslaunch robot_navigation lidar.launch- 查看发布的话题,寻找雷达:
[email protected]:rostopic list 3.打印雷达扫描的数据:
[email protected]:rostopic echo /scan4.pc:用rviz查看图像:
[email protected]:roslaunch robot_navigation lidar_rviz.launch
图2 运行激光雷达
五.运行激光雷达和激光SLAM建图
1.运行激光雷达:
[email protected]:roslaunch robot_navigation robot_slam_laser.launch2.启动底盘:
[email protected]:roslaunch base_control base_control.launch3.启动键盘控制:
rosrun teleop_twist_keyboard teleop_twist_keyboard.py4.用rviz查看图像:
[email protected]:roslaunch robot_navigation slam_rviz.launch5.查看地图文件:
[email protected]:roscd robot_navigation/maps6.保存map:
[email protected]:rosrun map_server map_saver -f map
图3 保存后的地图及结点
六.运行激光雷达和避障
1.运行激光雷达避障(会读取之前保存的地图):
[email protected]:roslaunch robot_navigation robot_navigation.launch2.用rviz查看:
[email protected]:roslaunch robot_navigation navigation_rviz.launch3.用2D Pose Estimate改变初试位置,让小车的雷达范围与之前保存的地图基本一致。
4.用2D Nav Goal指向我们的目标地,小车会自动规划路径并行驶到目标点处。

图4 读取地图

图5 路径规划
七.其他问题
1.没有地图数据
检查分布式配置(互ping);
检查Python版本,一定是Python2。
2.xxx is neither a launch file in package nor xxx is a launch file name
没有把工作区环境添加到.bashrc,或者在每次运行前去工作区目录source一下。
本文仅代表个人观点,如有错误,望读者指出。
边栏推荐
- I spent three years in a big factory outsourcing, which subverted my understanding!
- How to view Tencent's 2022 school recruitment salary, the total contract of cabbage is 40W?
- 第九天 脚本与资源管理
- Ubuntu20.04 PostgreSQL 14 installation configuration record
- 技术分享| 融合调度中的广播功能设计
- 将DataBinding整合到Activity/Fragment的一种极简方式
- 尝试链接数据库时出现链接超时报错,如何解决?
- Grasp grpc communication framework in simple terms
- [frequently asked questions] modularization of browser environment and node environment
- Postman learning sharing
猜你喜欢

December2020 - true questions and analysis of C language (Level 2) in the youth level examination of the Electronic Society

From 2500 a month, no one wants to go to the programming road of the technical director of a large factory | my ten years

【筆記】AB測試和方差分析

技术分享| 融合调度中的广播功能设计

Error encountered in SQL statement, solve

《机器人SLAM导航核心技术与实战》第1季:第0章_SLAM发展综述
![[cloud native] AI cloud development platform - Introduction to AI model foundry (developers can experience AI training model for free)](/img/08/b390810d457af5e4470d9743b01ca1.png)
[cloud native] AI cloud development platform - Introduction to AI model foundry (developers can experience AI training model for free)

EasyCVR部署服务器集群时,出现一台在线一台不在线是什么原因?
![[Thesis reading | deep reading] dane:deep attributed network embedding](/img/c7/60f36c2748b8cd7544b7ef14dc309e.png)
[Thesis reading | deep reading] dane:deep attributed network embedding

如何利用FME 创建自己的功能软件
随机推荐
Unity when entering a string in the editor, escape the input of characters
When easycvr deploys a server cluster, what is the reason why one is online and the other is offline?
Graduation project EMS office management system (b/s structure) +j2ee+sqlserver8.0
DRF -- nested serializer (multi table joint query)
你清楚AI、数据库与计算机体系
Play with algorithm interview together, nanny level strategy (with high-definition codeless algorithm summary map), recommended collection
[Thesis reading | deep reading] dane:deep attributed network embedding
Version correspondence table of tensorflow, CUDA and bazel
EasyCVR部署服务器集群时,出现一台在线一台不在线是什么原因?
Hash design and memory saving data structure design in redis
Titanic(POJ2361)
What does the hyphen mean for a block in Twig like in {% block body -%}?
Radiant energy, irradiance and radiance
Introduction to cloud native + container concept
在大厂外包呆了三年,颠覆了我的认知!
【笔记】2022.5.28 从网页获取数据并写入数据库
Wang Shuang - assembly language learning summary
SQLyog导入数据库时报错,求帮解决!
[fuzzy neural network prediction] water quality prediction based on fuzzy neural network, including Matlab source code
Huawei cloud native - data development and datafactory