当前位置: 首页 > news >正文

ros1仿真导航机器人 hector_mapping gmapping

仅为学习记录和一些自己的思考,不具有参考意义。

1 hector_mapping

建图过程

(1)gazebo仿真

roslaunch why_simulation why_slam.launch 

<launch><!-- We resume the logic in empty_world.launch, changing only the name of the world to be launched --><include file="$(find gazebo_ros)/launch/empty_world.launch"><arg name="world_name" value="$(find why_simulation)/worlds/slam_simple.world"/><arg name="paused" value="false"/><arg name="use_sim_time" value="true"/><arg name="gui" value="true"/><arg name="recording" value="false"/><arg name="debug" value="false"/></include><!-- Spawn a robot into Gazebo --><node name="spawn_urdf" pkg="gazebo_ros" type="spawn_model" args="-file $(find why_simulation)/models/wpb_home.model -urdf -x -0.0 -y -0.0 -model wpb_home" /><!-- tf --><arg name="model" default="$(find why_simulation)/models/wpb_home.model"/><param name="robot_description" command="$(find xacro)/xacro $(arg model)" /><node name="robot_state_publisher" pkg="robot_state_publisher" type="robot_state_publisher" /><node name="joint_state_publisher" pkg="joint_state_publisher" type="joint_state_publisher" /></launch>

(2)启动建图节点

rosrun hector_mapping hector_mapping

(3)rviz

rviz

将所需要的模块添加进去之后,保存为hector.rviz文件。

(4)控制机器人运动

rosrun rqt_robot_steering rqt_robot_steering

建图结果

launch

新建一个launch文件,将以上四条指令添加到launch文件中。

<launch><include file="$(find why_simulation)/launch/why_slam.launch"/><node name="hector_mapping" pkg="hector_mapping" type="hector_mapping" /><node name="rviz" pkg="rviz" type="rviz" args="-d $(find why_simulation)/rviz/hector.rviz"/><node name="rqt_robot_steering" pkg="rqt_robot_steering " type="rqt_robot_steering " /></launch>

查找参数

ROS Indexa community-maintained index of robotics softwareicon-default.png?t=N7T8https://index.ros.org/

(1)搜索hector_mapping

(2)选择Website

即可查看到有哪些参数可以设置

设置参数

<launch><include file="$(find why_simulation)/launch/why_slam.launch"/><node name="hector_mapping" pkg="hector_mapping" type="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 name="rviz" pkg="rviz" type="rviz" args="-d $(find why_simulation)/rviz/hector.rviz"/><node name="rqt_robot_steering" pkg="rqt_robot_steering " type="rqt_robot_steering " /></launch>

2 gmapping

建图过程

(1)gazebo环境

roslaunch why_simulation why_robocup.launch 

<launch><!-- We resume the logic in empty_world.launch, changing only the name of the world to be launched --><include file="$(find gazebo_ros)/launch/empty_world.launch"><arg name="world_name" value="$(find why_simulation)/worlds/why_robocup.world"/><arg name="paused" value="false"/><arg name="use_sim_time" value="true"/><arg name="gui" value="true"/><arg name="recording" value="false"/><arg name="debug" value="false"/></include><!-- Spawn the objects into Gazebo --><node name="bed" pkg="gazebo_ros" type="spawn_model" args="-file $(find why_simulation)/models/bed.model -x 5.0 -y -3.9 -z 0 -Y 3.14159 -urdf -model bed" /><node name="sofa" pkg="gazebo_ros" type="spawn_model" args="-file $(find why_simulation)/models/sofa.model -x -1.0 -y -3.9 -z 0 -Y 1.57 -urdf -model sofa" /><node name="tea_table" pkg="gazebo_ros" type="spawn_model" args="-file $(find why_simulation)/models/tea_table.model -x -2.1 -y -2.2 -z 0 -Y 1.57 -urdf -model tea_table" /><node name="bookshelft" pkg="gazebo_ros" type="spawn_model" args="-file $(find why_simulation)/models/bookshelft.model -x 2.0 -y -0.55 -z 0 -Y -1.57 -urdf -model bookshelft" /><node name="kitchen_table" pkg="gazebo_ros" type="spawn_model" args="-file $(find why_simulation)/models/table.model -x -3.5 -y 3.7 -z 0 -Y 1.57 -urdf -model kitchen_table" /> <node name="cupboard_0" pkg="gazebo_ros" type="spawn_model" args="-file $(find why_simulation)/models/cupboard.model -x -2.0 -y 0.7 -z 0 -Y 1.57 -urdf -model cupboard_0" /><node name="cupboard_1" pkg="gazebo_ros" type="spawn_model" args="-file $(find why_simulation)/models/cupboard.model -x -1.3 -y 3.7 -z 0 -Y -1.57 -urdf -model cupboard_1" /> <node name="dinning_table_0" pkg="gazebo_ros" type="spawn_model" args="-file $(find why_simulation)/models/table.model -x 1.5 -y 1.5 -z 0 -Y 1.57 -urdf -model dinning_table_0" /><node name="dinning_table_1" pkg="gazebo_ros" type="spawn_model" args="-file $(find why_simulation)/models/table.model -x 1.5 -y 2.0 -z 0 -Y 1.57 -urdf -model dinning_table_1" /><node name="dinning_table_2" pkg="gazebo_ros" type="spawn_model" args="-file $(find why_simulation)/models/table.model -x 2.7 -y 1.5 -z 0 -Y 1.57 -urdf -model dinning_table_2" /><node name="dinning_table_3" pkg="gazebo_ros" type="spawn_model" args="-file $(find why_simulation)/models/table.model -x 2.7 -y 2.0 -z 0 -Y 1.57 -urdf -model dinning_table_3" /><node name="chair_0" pkg="gazebo_ros" type="spawn_model" args="-file $(find why_simulation)/models/chair.model -x 1.5 -y 1.2 -z 0 -Y 1.57 -urdf -model chair_0" /><node name="chair_1" pkg="gazebo_ros" type="spawn_model" args="-file $(find why_simulation)/models/chair.model -x 1.5 -y 2.3 -z 0 -Y -1.57 -urdf -model chair_1" /><node name="chair_2" pkg="gazebo_ros" type="spawn_model" args="-file $(find why_simulation)/models/chair.model -x 2.7 -y 1.2 -z 0 -Y 1.57 -urdf -model chair_2" /><node name="chair_3" pkg="gazebo_ros" type="spawn_model" args="-file $(find why_simulation)/models/chair.model -x 2.7 -y 2.3 -z 0 -Y -1.57 -urdf -model chair_3" /><!-- Spawn a robot into Gazebo --><node name="spawn_urdf" pkg="gazebo_ros" type="spawn_model" args="-file $(find why_simulation)/models/wpb_home.model -urdf -x 0.0 -y -0.0 -model wpb_home" /><!-- tf --><arg name="model" default="$(find why_simulation)/models/wpb_home.model"/><param name="robot_description" command="$(find xacro)/xacro $(arg model)" /><node name="robot_state_publisher" pkg="robot_state_publisher" type="robot_state_publisher" /><node name="joint_state_publisher" pkg="joint_state_publisher" type="joint_state_publisher" /><!-- lidar filter--><node pkg="why_simulation" type="lidar_filter" name="lidar_filter" /></launch>

(2)启动gmapping节点

rosrun gmapping slam_gmapping

(3)rviz

rviz

保存成gmapping.rviz

(4)控制机器人移动

rosrun why_simulation keyboard_vel_ctrl

建图结果

launch

新建launch文件gmapping.launch,接上述指令添加到launch文件里

<launch><include file="$(find why_simulation)/launch/why_robocup.launch"/><node pkg="gmapping" type="slam_gmapping" name="slam_gmapping"/><node name="rviz" pkg="rviz" type="rviz" args="-d $(find why_simulation)/rviz/gmapping.rviz"/><node name="why_simulation" pkg="keyboard_vel_ctrl " type="keyboard_vel_ctrl " /></launch>

设置参数

<launch><include file="$(find why_simulation)/launch/why_robocup.launch"/><node pkg="gmapping" type="slam_gmapping" name="slam_gmapping"><param name="map_update_interval" value="0.5"/><param name="linearUpdate " value="0.1"/></node><node name="rviz" pkg="rviz" type="rviz" args="-d $(find why_simulation)/rviz/gmapping.rviz"/><node name="why_simulation" pkg="keyboard_vel_ctrl " type="keyboard_vel_ctrl " /></launch>

3保存地图

rosrun map_server map_saver -f map

4加载地图

roscore

rosrun map_server map_server map.yaml

rviz

5 对比

hector_mapping不使用里程计,长直的路径存在建图错误,gmapping使用里程计。

相关文章:

ros1仿真导航机器人 hector_mapping gmapping

仅为学习记录和一些自己的思考&#xff0c;不具有参考意义。 1 hector_mapping 建图过程 &#xff08;1&#xff09;gazebo仿真 roslaunch why_simulation why_slam.launch <launch><!-- We resume the logic in empty_world.launch, changing only the name of t…...

嵌入式实验---实验五 串口数据接收实验

一、实验目的 1、掌握STM32F103串口数据接收程序设计流程&#xff1b; 2、熟悉STM32固件库的基本使用。 二、实验原理 1、STM32F103R6能通过查询中断方式接收数据&#xff0c;每接收到一个字节&#xff0c;立即向对方发送一个相同内容的字节&#xff0c;并把该字节的十六进…...

ubuntu 22.04下编译安装glog共享库

笔者是完美主义者&#xff0c;在编译opencv4.9时,有个有关glog的warn&#xff0c;就下载编译google的glog库并把它编译成shared libaray。重新编译opencv4.9时&#xff0c;该warn解除。现把编译安装glog过程记录&#xff0c;以备后查。 以下操作全程以root身份或sudo执行。 cd…...

Linux环境安装配置nginx服务流程

Linux环境的Centos、麒麟、统信操作系统安装配置nginx服务流程操作&#xff1a; 1、官网下载 下载地址 或者通过命令下载 wget http://nginx.org/download/nginx-1.20.2.tar.gz 2、上传到指定的服务器并解压 tar -zxvf nginx-1.20.1.tar.gzcd nginx-1.20.1 3、编译并安装到…...

设计模式-模板模式

简介 模板方法模式是一种行为设计模式&#xff0c;它在父类中定义了一个操作的算法框架&#xff0c;允许子类在不改变算法结构的情况下重定义算法的某些步骤。这种模式是基于继承的&#xff0c;通过抽象类将通用的代码抽取到超类中&#xff0c;同时通过具体类实现或者改写算法…...

物理删除和逻辑删除区别

物理删除和逻辑删除是数据库管理中针对记录删除操作的两种不同方式&#xff0c;它们的主要区别在于数据的实际处理和后续影响&#xff1a; 物理删除&#xff1a; 操作实质&#xff1a;物理删除会将数据记录从数据库表中彻底移除&#xff0c;包括记录所占的磁盘空间都会被释放。…...

C# 警告 warning MSB3884: 无法找到规则集文件“MinimumRecommendedRules.ruleset”

警告 warning MSB3884: 无法找到规则集文件“MinimumRecommendedRules.ruleset” C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Current\Bin\amd64\Microsoft.CSharp.CurrentVersion.targets(129,9): warning MSB3884: 无法找到规则集文件“MinimumRe…...

Lua网站开发之文件表单上传

这个代码示例演示如何上传文件或图片&#xff0c;获取上传信息及保存文件到本地。 local fw require("fastweb") local request require("fastweb.request") local response require("fastweb.response") local cjson require("cjson&q…...

千益畅行,旅游卡,如何赚钱?

​ 赚钱这件事情&#xff0c;只有自己努力执行才会有结果。生活中没有幸运二字&#xff0c;每个光鲜亮丽的背后&#xff0c;都是不为人知的付出&#xff01; #旅游卡服务#...

Element-plus点击当前行之后获取数据显示跟随行数据

要实现点击当前行后&#xff0c;在当前行的下方显示数据&#xff0c;可以通过以下步骤来实现&#xff1a; 在表格的行点击事件中获取当前点击行的位置信息。根据位置信息动态计算并设置需要显示数据区域的位置。 下面是一个更新后的示例代码&#xff0c;演示如何在 Element-P…...

Docker与微服务实战2022 尚

Docker与微服务实战2022 尚硅谷讲师:周阳 1. 基础篇(零基小白) 1 1.1. Docker简介 2 1.2. Docker安装 15 1.3. Docker常用命令 29 1.4. Docker镜像 43 1.5. 本地镜像发布到阿里云 50 1.6. 本地镜像发布到私有库 57 1.7. Docker容器数据卷 64 1.8. Docker常规安装简介 …...

Spring @Cacheable缓存注解用法说明

注解Cacheable 是 Spring 框架中用于缓存数据的方法或类的注解。通过使用这个注解&#xff0c;你可以避免重复计算和重复获取数据&#xff0c;从而提高应用程序的性能。 基本用法 引入依赖 确保在你的项目中引入了 Spring Cache 相关的依赖。如果你使用的是 Spring Boot&…...

Redis如何实现主从复制

Redis主从复制包括全量复制和增量复制。主是主服务器&#xff0c;从是从服务器&#xff0c;主服务器(master &#xff09;的数据如果更新了也会同步到从服务器(slave)&#xff0c;一个主服务器可以搭配很多个从服务器&#xff0c;主服务器负责写入&#xff0c;从服务器只能读取…...

正则表达式以及文本三剑客grep、sed、awk

正则表达式匹配的是文本内容&#xff0c;文本三剑客都是针对文本内容。 grep&#xff1a;过滤文本内容 sed&#xff1a;针对文本内容进行增删改查 awk&#xff1a;按行取列 一、grep grep的作用使用正则表达式来匹配文本内容 1、grep选项 -m&#xff1a;匹配几次之后停止…...

HSRP热备份路由协议(VRRP虚拟路由冗余协议)配置以及实现负载均衡

1、相关原理 在网络中&#xff0c;如果一台作为默认网关的三层交换机或者路由器损坏&#xff0c;所有使用该网关为下一跳的主机通信必然中断&#xff0c;即使配置多个默认网关&#xff0c;在不重启终端的情况下&#xff0c;也不能彻底换到新网关。Cisco提出了HSRP热备份路由协…...

不同集成学习算法的比较:随机森林、AdaBoost、XGBoost、LightGBM

好的&#xff0c;我来为您比较一些常见的集成学习算法&#xff0c;并生成表格形式以便于对比&#xff1a; 算法主要思想和特点应用场景并行处理支持稳定性和鲁棒性主要优化策略和技术AdaBoost使用加权投票组合多个弱分类器&#xff0c;逐步提升分类器性能二分类和多分类问题&a…...

【聊聊原子性,中断,以及nodejs中的具体示例】

什么是原子性 从一个例子说起&#xff0c; x &#xff0c;读和写 &#xff0c; 如图假设多线程&#xff0c;线程1和线程2同时操作变量x&#xff0c;进行x的操作&#xff0c;那么由于写的过程中&#xff0c;都会先读一份x数据到cpu的寄存器中&#xff0c;所以这个时候cpu1 和 c…...

常见网络端口号

在网络工程领域&#xff0c;了解和掌握默认端口号是至关重要的。端口号是计算机网络中最基本的概念之 一&#xff0c;用于标识特定的网络服务或应用程序。 1、什么是端口号&#xff1f; 端口号是计算机网络中的一种标识&#xff0c;用于区分不同的网络服务和应用程序。每个端…...

【数值计算库-超长笔记】Python-Mpmath库:高精度数值计算

原文链接&#xff1a;https://www.cnblogs.com/aksoam/p/18279394 更多精彩&#xff0c;关注博客园主页&#xff0c;不断学习&#xff01;不断进步&#xff01; 我的主页 csdn很少看私信&#xff0c;有事请b站私信 博客园主页-发文字笔记-常用 有限元鹰的主页 内容&#xf…...

昇思25天学习打卡营第6天|函数式自动微分

函数式自动微分 相关前置知识复习 深度学习的重点之一是神经网络。而神经网络很重要的一环是反向传播算法&#xff0c;这个算法用于调整神经网络的权重。 反向传播算法 这里举例说明反向传播在做什么。 假设你是一个学生&#xff0c;一次考试过后&#xff0c;你收到了一份老…...

UE5 学习系列(二)用户操作界面及介绍

这篇博客是 UE5 学习系列博客的第二篇&#xff0c;在第一篇的基础上展开这篇内容。博客参考的 B 站视频资料和第一篇的链接如下&#xff1a; 【Note】&#xff1a;如果你已经完成安装等操作&#xff0c;可以只执行第一篇博客中 2. 新建一个空白游戏项目 章节操作&#xff0c;重…...

Java 8 Stream API 入门到实践详解

一、告别 for 循环&#xff01; 传统痛点&#xff1a; Java 8 之前&#xff0c;集合操作离不开冗长的 for 循环和匿名类。例如&#xff0c;过滤列表中的偶数&#xff1a; List<Integer> list Arrays.asList(1, 2, 3, 4, 5); List<Integer> evens new ArrayList…...

CMake基础:构建流程详解

目录 1.CMake构建过程的基本流程 2.CMake构建的具体步骤 2.1.创建构建目录 2.2.使用 CMake 生成构建文件 2.3.编译和构建 2.4.清理构建文件 2.5.重新配置和构建 3.跨平台构建示例 4.工具链与交叉编译 5.CMake构建后的项目结构解析 5.1.CMake构建后的目录结构 5.2.构…...

解锁数据库简洁之道:FastAPI与SQLModel实战指南

在构建现代Web应用程序时&#xff0c;与数据库的交互无疑是核心环节。虽然传统的数据库操作方式&#xff08;如直接编写SQL语句与psycopg2交互&#xff09;赋予了我们精细的控制权&#xff0c;但在面对日益复杂的业务逻辑和快速迭代的需求时&#xff0c;这种方式的开发效率和可…...

工程地质软件市场:发展现状、趋势与策略建议

一、引言 在工程建设领域&#xff0c;准确把握地质条件是确保项目顺利推进和安全运营的关键。工程地质软件作为处理、分析、模拟和展示工程地质数据的重要工具&#xff0c;正发挥着日益重要的作用。它凭借强大的数据处理能力、三维建模功能、空间分析工具和可视化展示手段&…...

CocosCreator 之 JavaScript/TypeScript和Java的相互交互

引擎版本&#xff1a; 3.8.1 语言&#xff1a; JavaScript/TypeScript、C、Java 环境&#xff1a;Window 参考&#xff1a;Java原生反射机制 您好&#xff0c;我是鹤九日&#xff01; 回顾 在上篇文章中&#xff1a;CocosCreator Android项目接入UnityAds 广告SDK。 我们简单讲…...

TRS收益互换:跨境资本流动的金融创新工具与系统化解决方案

一、TRS收益互换的本质与业务逻辑 &#xff08;一&#xff09;概念解析 TRS&#xff08;Total Return Swap&#xff09;收益互换是一种金融衍生工具&#xff0c;指交易双方约定在未来一定期限内&#xff0c;基于特定资产或指数的表现进行现金流交换的协议。其核心特征包括&am…...

【决胜公务员考试】求职OMG——见面课测验1

2025最新版&#xff01;&#xff01;&#xff01;6.8截至答题&#xff0c;大家注意呀&#xff01; 博主码字不易点个关注吧,祝期末顺利~~ 1.单选题(2分) 下列说法错误的是:&#xff08; B &#xff09; A.选调生属于公务员系统 B.公务员属于事业编 C.选调生有基层锻炼的要求 D…...

【HTML-16】深入理解HTML中的块元素与行内元素

HTML元素根据其显示特性可以分为两大类&#xff1a;块元素(Block-level Elements)和行内元素(Inline Elements)。理解这两者的区别对于构建良好的网页布局至关重要。本文将全面解析这两种元素的特性、区别以及实际应用场景。 1. 块元素(Block-level Elements) 1.1 基本特性 …...

前端开发面试题总结-JavaScript篇(一)

文章目录 JavaScript高频问答一、作用域与闭包1.什么是闭包&#xff08;Closure&#xff09;&#xff1f;闭包有什么应用场景和潜在问题&#xff1f;2.解释 JavaScript 的作用域链&#xff08;Scope Chain&#xff09; 二、原型与继承3.原型链是什么&#xff1f;如何实现继承&a…...