3.1 Hector_mapping初体验

1.初体验

下载依赖

复制代码
sudo apt install ros-noetic-hector-mapping

构建仿真环境

复制代码
roslaunch wpr_simulation wpb_stage_slam.launch 

运行SLAM

复制代码
rosrun hector_mapping hector_mapping 

再新建终端

复制代码
rosrun rviz rviz

注意终端管理

新建终端,打开操作杆

复制代码
osrun rqt_robot_steering rqt_robot_steering 

可视化效果

2.launch启动

新建SLAM包

复制代码
catkin_create_pkg slam_pkg roscpp rospy std_msgs

新建launch'文件,键入以下代码

复制代码
<launch>

<includev file="$(find wpr_simulation)/launch/wpb_stage_slam.launch"/>
<node pkg="hector_mapping" type="hector_mapping" name="hector_mapping"/>
<node pkg="rviz" type="rviz" name="rviz"/>
<node pkg="rqt_robot_steering" type="rqt_robot_steering" name="rqt_robot_steering"/>

</launch>

保存后编译,并运行命令

复制代码
roslaunch slam_pkg hector.launch

使用配置文件启动rviz

复制代码
rosrun rviz rviz -d /home/wisdom/catkin_ws/src/slam_pkg/rviz/slam.rviz

或者直接launch文件,增加rviz参数args

复制代码
<launch>

<include file="$(find wpr_simulation)/launch/wpb_stage_slam.launch"/>
<node pkg="hector_mapping" type="hector_mapping" name="hector_mapping"/>
<node pkg="rviz" type="rviz" name="rviz" args="-d $(find slam_pkg)/rviz/slam.rviz"/>
<node pkg="rqt_robot_steering" type="rqt_robot_steering" name="rqt_robot_steering"/>

</launch>

实现一条指令实现所有平台加载对应参数启动

3.参数设置

复制代码
<launch>

<include file="$(find wpr_simulation)/launch/wpb_stage_slam.launch"/>
<node pkg="hector_mapping" type="hector_mapping" name="hector_mapping" output="screen">
    <param name="map_update_distance_thresh" value="0.1"/>
    <param name="map_update_angle_thresh" value="0.1"/>
    <param name="map_pub_period" value="0.1"/>
</node>

<node pkg="rviz" type="rviz" name="rviz" args="-d $(find slam_pkg)/rviz/slam.rviz"/>
<node pkg="rqt_robot_steering" type="rqt_robot_steering" name="rqt_robot_steering"/>

</launch>

文件结构

相关推荐
Heavy sea3 小时前
Linux串口应用编程
linux·c语言·1024程序员节
Justin_193 小时前
Galera Cluster部署
linux·服务器·nginx
洛克大航海5 小时前
虚拟机 Ubuntu 中安装 Google Chrome 浏览器
linux·chrome·ubuntu
java_logo5 小时前
Docker 部署 WordPress 全流程
运维·docker·容器·word·php·1024程序员节
小小的木头人5 小时前
Ubuntu 自动挂载移动硬盘
运维
DeeplyMind5 小时前
AMD rocr-libhsakmt分析系列3-4:svm-reserve模式实现分析
linux·驱动开发·1024程序员节·amdgpu·kfd·rocr
神秘的土鸡5 小时前
从数据仓库到数据中台再到数据飞轮:我的数据技术成长之路
java·服务器·aigc·数据库架构·1024程序员节
大米粥哥哥6 小时前
Qt QProcess基于Linux的命令管道符号无效问题【已解决】
linux·qt·shell·qprocess·1024程序员节·管道符号
Mr. Sun_6 小时前
Dell Networking SmartFabric OS10 如何设置虚拟链路中继 (VLT)
运维·网络·dell vlt
北京迅为6 小时前
【北京迅为】iTOP-4412精英版使用手册-第六十七章 USB鼠标驱动详解
linux·人工智能·嵌入式·4412