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>

文件结构

相关推荐
sulikey4 小时前
Linux ext2文件系统结构
linux·操作系统·文件系统·linux文件系统·ext2·ext2文件系统
白菜欣5 小时前
Linux — 进程控制
android·linux·运维
JoneBB5 小时前
ABAP Webservice连接
运维·开发语言·数据库·学习
皮卡狮5 小时前
Linux开发专属工具
linux
weixin_421725266 小时前
Linux 编程语言全解析:C、C++、Python、Go、Rust 谁更强?
linux·python·go·c·编程语言
Tolalal6 小时前
Vmware Ubuntu虚拟机扩容
linux·运维·ubuntu
咚为6 小时前
比AccessLog更全面的原生Nginx 日志记录
运维·nginx·junit
我星期八休息6 小时前
Linux系统编程—基础IO
linux·运维·服务器·c语言·c++·人工智能·算法
Shingmc36 小时前
【Linux】数据链路层
linux·服务器·网络
a752066287 小时前
零基础实操:小龙虾 AI OpenClaw 接入 Kimi 详细步骤
运维·服务器