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>

文件结构

相关推荐
珠海西格电力科技1 小时前
微电网能量平衡理论的实现条件在不同场景下有哪些差异?
运维·服务器·网络·人工智能·云计算·智慧城市
A星空1231 小时前
一、Linux嵌入式的I2C驱动开发
linux·c++·驱动开发·i2c
释怀不想释怀1 小时前
Linux环境变量
linux·运维·服务器
zzzsde1 小时前
【Linux】进程(4):进程优先级&&调度队列
linux·运维·服务器
凡人叶枫1 小时前
C++中智能指针详解(Linux实战版)| 彻底解决内存泄漏,新手也能吃透
java·linux·c语言·开发语言·c++·嵌入式开发
yuanmenghao2 小时前
Linux 性能实战 | 第 7 篇 CPU 核心负载与调度器概念
linux·网络·性能优化·unix
qq_297574672 小时前
Linux 服务器 Java 开发环境搭建保姆级教程
java·linux·服务器
70asunflower2 小时前
Emulation,Simulation,Virtualization,Imitation 的区别?
linux·docker
聆风吟º3 小时前
CANN开源项目实战指南:使用oam-tools构建自动化故障诊断与运维可观测性体系
运维·开源·自动化·cann
神梦流3 小时前
ops-math 算子库的扩展能力:高精度与复数运算的硬件映射策略
服务器·数据库