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

MoveIT Rviz和Gazebo联合仿真

文章目录

    • 环境
    • 安装
    • 概述
      • ros_control框架
      • ros_control数据流
    • 文件配置
    • 附加工具
    • 故障问题解决
    • 参考

接前两篇:

ROS MoveIT1(Noetic)安装总结
Solidworks导出为URDF用于MoveIT总结(带prismatic)
MoveIT1 Assistant 总结

环境

  • Ubuntu20.04;
  • ROS1 Noetic;
  • VMware

安装

sudo apt-get install ros-noetic-joint-state-controller
sudo apt-get install ros-noetic-effort-controllers
sudo apt-get install ros-noetic-position-controllers
sudo apt-get install ros-noetic-joint-trajectory-controller
sudo apt-get install ros-noetic-controller-manager
sudo apt-get install ros-noetic-gazebo-ros-control
sudo apt-get install ros-noetic-ros-controllers

概述

URDF 用于创建机器人模型、Rviz 可以显示机器人感知到的环境信息,Gazebo 用于物理环境仿真。

先在Moveit!端配置关节和传感器接口yaml文件,将其加载到rviz端;再在机器人端配置ros_control和接口yaml文件,将机器人加载到Gazebo。

最后同时启动加载有ros_control的Gazebo和加载有Moveit的rviz,达到联合仿真的目的。

ros_control框架

在这里插入图片描述
在这里插入图片描述
ros_control包由以下几部分:

  • combined_robot_hw(硬件包):一个允许将多个RobotHW组合成一个“RobotHW”的软件包。

  • controller_interface(controller接口)

  • controller_manager(controller管理器):提供了一个近乎实时的controller管理器,用于管理(加载、卸载、启停)controllers。

  • controller_manager_msg(controller管理器的消息类型):定义了controller的状态消息类型msg,以及调用controller_manager的服务类型srv。

  • hardware_interface(硬件底层的接口):向硬件发送(write())命令并从硬件接收(read())联合状态。
    https://github.com/ros-controls/ros_control/wiki/hardware_interface
    在这里插入图片描述

  • joint_limits_interface(joints限制接口):根据URDF中的limit标签,将joint limit载入到硬件层中。

  • transmission_interface(传动接口):根据URDF中的transmission标签将该关系载入到硬件层中。

  • realtime_tools(实时控制工具):包含一组可以从硬实时线程中使用的工具,而不会破坏实时行为。

ros_control数据流

在这里插入图片描述

  • Controller Manager:每个机器人可能有多个controller,所以这里有一个控制器管理器的概念,提供一种通用的接口来管理不同的controller。controller manager的输入就是ROS上层应用的输出。

  • Controller:controller可以完成每个joint的控制,请求下层的硬件资源,并且提供了PID控制器,读取硬件资源接口中的状态,在发布控制命令。
    在这里插入图片描述

  • Hardware Rescource:为上下两层提供硬件资源的接口。

  • RobotHW:硬件抽象层和硬件直接打交道,通过write和read方法来完成硬件的操作,这一层也包含关节限位、力矩转换、状态转换等功能。

  • Real Robot:实际的机器人上也需要有自己的嵌入式控制器,接收到命令后需要反映到执行器上,比如接收到位置1的命令后,那就需要让执行器快速、稳定的到达位置1。

【控制流】
ROS中的Controller manager接收load_controller、unload_controller等命令来加载和运行不同类型的controller(例如joint_position),这些controller通过Hardware Resource接口向硬件抽象层RobotHW读取和发布控制命令,这些命令再输入到机器人上的嵌入控制器上,然后有执行器执行。

文件配置

/home/gw2/ws_moveit/src/assis_1/config/robot_controller.yaml中定义的是"position_controllers/JointTrajectoryController",则URDF中定义的transmission中如果使用的是PositionJointInterface必须要对应,否则会提示找不到controller。

    <transmission name="trans_Joint1"><type>transmission_interface/SimpleTransmission</type><joint name="Joint1"><hardwareInterface>hardware_interface/PositionJointInterface</hardwareInterface></joint><actuator name="Joint1_motor"><hardwareInterface>hardware_interface/PositionJointInterface</hardwareInterface><mechanicalReduction>1</mechanicalReduction></actuator></transmission><transmission name="trans_Joint2"><type>transmission_interface/SimpleTransmission</type><joint name="Joint2"><hardwareInterface>hardware_interface/PositionJointInterface</hardwareInterface></joint><actuator name="Joint2_motor"><hardwareInterface>hardware_interface/PositionJointInterface</hardwareInterface><mechanicalReduction>1</mechanicalReduction></actuator></transmission><transmission name="trans_Joint3"><type>transmission_interface/SimpleTransmission</type><joint name="Joint3"><hardwareInterface>hardware_interface/PositionJointInterface</hardwareInterface></joint><actuator name="Joint3_motor"><hardwareInterface>hardware_interface/PositionJointInterface</hardwareInterface><mechanicalReduction>1</mechanicalReduction></actuator></transmission><transmission name="trans_Joint4"><type>transmission_interface/SimpleTransmission</type><joint name="Joint4"><hardwareInterface>hardware_interface/PositionJointInterface</hardwareInterface></joint><actuator name="Joint4_motor"><hardwareInterface>hardware_interface/PositionJointInterface</hardwareInterface><mechanicalReduction>1</mechanicalReduction></actuator></transmission><transmission name="trans_Joint5"><type>transmission_interface/SimpleTransmission</type><joint name="Joint5"><hardwareInterface>hardware_interface/PositionJointInterface</hardwareInterface></joint><actuator name="Joint5_motor"><hardwareInterface>hardware_interface/PositionJointInterface</hardwareInterface><mechanicalReduction>1</mechanicalReduction></actuator></transmission>

在urdf中加入gazebo的ros_control插件,如果不加,运行gazebo会显示机械臂都耷拉在地上,仿佛电机没有使能一样。

    <gazebo><plugin name="gazebo_ros_control"  filename="libgazebo_ros_control.so"><plugin name="joint_state_publisher" filename="libgazebo_ros_joint_state_publisher.so"><jointName>Joint1,Joint2,Joint3,Joint4,Joint5</jointName></plugin><robotNamespace>/</robotNamespace></plugin></gazebo>

检查ros_controllers.launch的args="control"不要有空格。

修改ros_controllers.yaml:

control:type: position_controllers/JointTrajectoryControllerjoints:- Joint1- Joint2- Joint3- Joint4- Joint5gains:Joint1: { p: 12000, d: 50, i: 0.0, i_clamp: 10000 }Joint2: { p: 12000, d: 50, i: 0.0, i_clamp: 10000 }Joint3: { p: 12000, d: 50, i: 0.0, i_clamp: 10000 }Joint4: { p: 12000, d: 50, i: 0.0, i_clamp: 10000 }Joint5: { p: 12000, d: 50, i: 0.0, i_clamp: 10000 }

运行rviz和gazebo:

source ~/ws_moveit/devel/setup.bash
roslaunch assis_1 demo_gazebo.launch

可以看到Rviz中的运动在Gazebo中可以同步运动。
在这里插入图片描述

在这里插入图片描述

附加工具

rqt_graph
创建一个显示当前系统ROS程序运行情况的动态图形

安装:

sudo apt install ros-noetic-rqt
sudo apt install ros-noetic-rqt-common-plugins

运行:

rosrun rqt_graph rqt_graph

可以看到结果:
在这里插入图片描述

在这里插入图片描述
通过这个图可以看到:
/move_group发送/control/follow_joint_trajectory/goal【目标位置】到机器人,机器人发送/joint_states【轴状态】到/move_group和/robot_state_publisher

rqt_joint_trajectory_controller
安装:

sudo apt-get install ros-noetic-rqt-joint-trajectory-controller

运行:

roslaunch assis_1 demo_gazebo.launch 或 roslaunch assis_1 gazebo.launch
rosrun rqt_joint_trajectory_controller rqt_joint_trajectory_controller

效果:拖动进度条可以在Gazebo实现各个关节的运动。

在这里插入图片描述

rqt_controller_manager
rqt插件,该插件以图形化方式加载,卸载,启动和停止控制器;同时用来显示加载的控制器的信息。

安装:

sudo apt-get install ros-noetic-rqt-controller-manager

运行:可以看到control和joint_state_controller两个控制器。

rosrun rqt_controller_manager rqt_controller_manager

在这里插入图片描述

故障问题解决

Spawn service failed. Exiting.
cmd /opt/ros/noetic/lib/gazebo_ros/gzserver -e ode worlds/empty.world
parse as old deprecated model file failed.
这三个错误往往一起出现,最后通过在urdf文件中添加解决:
filename=“libgazebo_ros_control.so”

https://blog.csdn.net/qq_60018807/article/details/128543981

ERROR: cannot launch node of type [controller_manager/spawner]: controller_manager接着一堆错误。

sudo apt-get install ros-kinetic-controller-manager

https://blog.csdn.net/weixin_45839124/article/details/106589576

模型自己转动,乱跑

sudo apt-get install ros-noetic-gazebo-ros-control

[ERROR] [1675950367.646886773, 0.307000000]: Failed to initialize the controller
[ERROR] [1675950367.649888591, 0.308000000]: Initializing controller ‘control’ failed
[ERROR] [1675950368.653177, 0.650000]: Failed to load control

在ros_controllers.yaml中添加前述代码。

[ERROR] [1675950605.984213275]: No p gain specified for pid. Namespace: /gazebo_ros_control/pid_gains/Joint1
[ERROR] [1675950605.988813331]: No p gain specified for pid. Namespace: /gazebo_ros_control/pid_gains/Joint2
[ERROR] [1675950605.991700327]: No p gain specified for pid. Namespace: /gazebo_ros_control/pid_gains/Joint3
[ERROR] [1675950605.995635439]: No p gain specified for pid. Namespace: /gazebo_ros_control/pid_gains/Joint4
[ERROR] [1675950605.999769977]: No p gain specified for pid. Namespace: /gazebo_ros_control/pid_gains/Joint5

添加修改ros_controllers.yaml文件:
/gazebo_ros_control:
pid_gains:

control:type: position_controllers/JointTrajectoryControllerjoints:- Joint1- Joint2- Joint3- Joint4- Joint5/gazebo_ros_control:pid_gains:Joint1: {p: 12000, d: 50, i: 0.0, i_clamp: 10000 }Joint2: {p: 12000, d: 50, i: 0.0, i_clamp: 10000 }Joint3: {p: 12000, d: 50, i: 0.0, i_clamp: 10000 }Joint4: {p: 12000, d: 50, i: 0.0, i_clamp: 10000 }Joint5: {p: 12000, d: 50, i: 0.0, i_clamp: 10000 }

但是加上以后发现Gazebo模型开始扭动起来,没眼看。最终无视这个错误即可。

https://blog.csdn.net/qq_32896521/article/details/111143282?spm=1001.2014.3001.5501
https://zhuanlan.zhihu.com/p/392635284

参考

https://blog.csdn.net/qq_34935373/article/details/95886151
https://ros-planning.github.io/moveit_tutorials/doc/gazebo_simulation/gazebo_simulation.html
http://www.guyuehome.com/890
https://blog.csdn.net/qq_41035283/article/details/120572465
http://wiki.ros.org/ros_control?distro=noetic

相关文章:

MoveIT Rviz和Gazebo联合仿真

文章目录环境安装概述ros_control框架ros_control数据流文件配置附加工具故障问题解决参考接前两篇&#xff1a;ROS MoveIT1&#xff08;Noetic&#xff09;安装总结 Solidworks导出为URDF用于MoveIT总结&#xff08;带prismatic&#xff09; MoveIT1 Assistant 总结 环境 Ubu…...

ESP32S2(12K)-DS18B20数码管显示温度

一、物料清单: NODEMCU-32-S2 (ESP32-12K)四段数码管(共阴)DS18B20(VCC/DQ/GND)Arduino-IDE 2.0.3二、实现方法及效果图: 2.1 引用库 // #include <OneWire.h> //可以不引入,因为DallasTemperature.h中已经引入了OneWire.h #include <DallasTemperature.h>#…...

linux栈溢出定位

一、编译选项定位堆栈溢出 来源&#xff1a;堆栈溢出检测机制 - SkrSky - 博客园 1、栈溢出可能打印 unhandled level 1 translation fault (11) at 0x7f8d0347, esr 0x92000005 2、栈溢出保护机制 gcc提供了栈保护机制stack-protector&#xff08;编译选项-fstack-protec…...

CSS基础:选择器和声明样式

CSS概念 CSS&#xff08;Cascading Style Sheets&#xff09;层叠样式表&#xff0c;又叫级联样式表&#xff0c;简称样式表 CSS用于HTML文档中元素样式的定义 使用css让网页具有美观一致的页面 语法 CSS 规则由两个主要的部分构成&#xff1a;选择器和声明样式 选择器通常…...

VS中安装gismo库

文章目录前言一、下载安装paraview直接下载压缩包安装就可以了解压后按步骤安装即可二、gismo库的安装gismo库网址第一种方法&#xff1a;第二种方法第三种方法&#xff1a;用Cmake软件直接安装首先下载cmake软件[网址](https://cmake.org/download/)安装gismo库三、gismo库的使…...

元学习方法解决CDFSL以及两篇SOTA论文讲解

来源&#xff1a;投稿 作者&#xff1a;橡皮 编辑&#xff1a;学姐 带你学习跨域小样本系列1-简介篇 跨域小样本系列2-常用数据集与任务设定详解 跨域小样本系列3&#xff1a;元学习方法解决CDFSL以及两篇SOTA论文讲解&#xff08;本篇&#xff09; 跨域小样本系列4&#xf…...

大数据之------------数据中台

一、什么是数据中台 **数据中台是指通过数据技术&#xff0c;对海量数据进行采集、计算、存储、加工&#xff0c;同时统一标准和口径。**数据中台的目标是让数据持续用起来&#xff0c;通过数据中台提供的工具、方法和运行机制&#xff0c;把数据变为一种服务能力&#xff0c;…...

Python 中 字符串是什么?

字符串是 Python 中最常用的数据类型。我们可以使用引号 ( ’ 或 " ) 来创建字符串。 创建字符串很简单&#xff0c;只要为变量分配一个值即可。例如&#xff1a; var1 ‘Hello World!’ var2 “Python Runoob” Python 访问字符串中的值 Python 不支持单字符类型&…...

OJ刷题Day1 · 一维数组的动态和 · 将数字变成 0 的操作次数 · 最富有的客户资产总量 · Fizz Buzz · 链表的中间结点 · 赎金信

一、一维数组的动态和二、将数字变成 0 的操作次数三、最富有的客户资产总量四、Fizz Buzz五、链表的中间结点六、赎金信一、一维数组的动态和 给你一个数组 nums 。数组「动态和」的计算公式为&#xff1a;runningSum[i] sum(nums[0]…nums[i]) 。 请返回 nums 的动态和。 示…...

【数据结构】栈——必做题

逆波兰表达式后缀表达式的出现是为了方便计算机处理&#xff0c;它的运算符是按照一定的顺序出现&#xff0c;所以求值过程中并不需要使用括号来指定运算顺序&#xff0c;也不需要考虑运算符号&#xff08;比如加减乘除&#xff09;的优先级。先介绍中简单的人工转化方法&#…...

LearnOpenGL 笔记 - 入门 04 你好,三角形

系列文章目录 LearnOpenGL 笔记 - 入门 01 OpenGLLearnOpenGL 笔记 - 入门 02 创建窗口LearnOpenGL 笔记 - 入门 03 你好&#xff0c;窗口 文章目录系列文章目录前言你好&#xff0c;三角形顶点输入顶点着色器&#xff08;Vertex Shader&#xff09;编译着色器片段着色器&…...

keepalived+mysql高可用

一.设置mysql同步信息两节点安装msyql略#配置节点11.配置权限允许远程访问mysql -u root -p grant all on *.* to root% identified by Root1212# with grant option; flush privileges;2.修改my.cnf#作为主节点配置(节点1)#作为主节点配置 server-id 1 …...

JAVA工具篇--1 Idea中 Gradle的使用

前言&#xff1a; 既然我们已经使用Maven 来完成对项目的构建&#xff0c;为什么还要使用Gradle 进行项目的构建&#xff1b;gradle和maven都可以作为java程序的构建工具&#xff0c;但两者还是有很大的不同之处的&#xff1a;1.可扩展性&#xff0c;gradle比较灵活&#xff0c…...

弄懂自定义 Hooks 不难,改变开发认知有点不习惯

前言 我之前总结逻辑重用的时候&#xff0c;就一直在思考一个问题。 对于逻辑复用&#xff0c;render props 和 高阶组件都可以实现&#xff0c;同样官方说 Hooks 也可以实现&#xff0c;且还是在不增加额外的组件的情况下。 但是我在项目代码中&#xff0c;没有找到自定义 …...

Java面向对象基础

文章目录面向对象类注意事项内存机制构造器this关键字封装javabean格式成员变量和局部变量区别static静态关键字使用成员方法使用场景内存机制注意事项static应用&#xff1a;工具类static应用&#xff1a;代码块静态代码块实例代码块&#xff08;用的比较少&#xff09;static…...

基于python下selenium库实现交互式图片保存操作(批量保存浏览器中的图片)

Selenium是最广泛使用的开源Web UI&#xff08;用户界面&#xff09;自动化测试套件之一&#xff0c;可以通过编程与浏览量的交互式操作对网页进行自动化控制。基于这种操作进行数据保存操作&#xff0c;尤其是在图像数据的批量保存上占据优势。本博文基于selenium 与jupyterla…...

一:Datart的下载、本地运行

前言&#xff1a;本文只是个人在使用datart的一个记录&#xff0c;仅供参考。如果有不一样的地方&#xff0c;欢迎评论或私信进行交流。datart 是新一代数据可视化开放平台&#xff0c;支持各类企业数据可视化场景需求&#xff0c;如创建和使用报表、仪表板和大屏&#xff0c;进…...

Docker-compose

一.Docker-compose概述Docker-Compose项目是Docker官方的开源项目&#xff0c;负责实现对Docker容器集群的快速编排。Docker-Compose将所管理的容器分为三层&#xff0c;分别是 工程&#xff08;project&#xff09;&#xff0c;服务&#xff08;service&#xff09;以及容器&a…...

经典文献阅读之--PLC-LiSLAM(面,线圆柱SLAM)

0. 简介 对于激光SLAM来说&#xff0c;现在越来越多的算法不仅仅局限于点线等简答特征的场景了&#xff0c;文章《PLC-LiSLAM: LiDAR SLAM With Planes, Lines,and Cylinders》说到&#xff0c;平面、线段与圆柱体广泛存在于人造环境中。为此作者提出了一个使用这些landmark的…...

计算组合数Cnk即从n个不同数中选出k个不同数共有多少种方法math.comb(n,k)

【小白从小学Python、C、Java】 【计算机等级考试500强双证书】 【Python-数据分析】 计算组合数Cnk 即从n个不同数中选出k个不同数共有多少种方法 math.comb(n,k) 以下python代码输出结果是? import math print("【执行】print(math.comb(3,1))") print(math.comb(…...

基于大模型的 UI 自动化系统

基于大模型的 UI 自动化系统 下面是一个完整的 Python 系统,利用大模型实现智能 UI 自动化,结合计算机视觉和自然语言处理技术,实现"看屏操作"的能力。 系统架构设计 #mermaid-svg-2gn2GRvh5WCP2ktF {font-family:"trebuchet ms",verdana,arial,sans-…...

解决Ubuntu22.04 VMware失败的问题 ubuntu入门之二十八

现象1 打开VMware失败 Ubuntu升级之后打开VMware上报需要安装vmmon和vmnet&#xff0c;点击确认后如下提示 最终上报fail 解决方法 内核升级导致&#xff0c;需要在新内核下重新下载编译安装 查看版本 $ vmware -v VMware Workstation 17.5.1 build-23298084$ lsb_release…...

Linux简单的操作

ls ls 查看当前目录 ll 查看详细内容 ls -a 查看所有的内容 ls --help 查看方法文档 pwd pwd 查看当前路径 cd cd 转路径 cd .. 转上一级路径 cd 名 转换路径 …...

el-switch文字内置

el-switch文字内置 效果 vue <div style"color:#ffffff;font-size:14px;float:left;margin-bottom:5px;margin-right:5px;">自动加载</div> <el-switch v-model"value" active-color"#3E99FB" inactive-color"#DCDFE6"…...

Ascend NPU上适配Step-Audio模型

1 概述 1.1 简述 Step-Audio 是业界首个集语音理解与生成控制一体化的产品级开源实时语音对话系统&#xff0c;支持多语言对话&#xff08;如 中文&#xff0c;英文&#xff0c;日语&#xff09;&#xff0c;语音情感&#xff08;如 开心&#xff0c;悲伤&#xff09;&#x…...

Android Bitmap治理全解析:从加载优化到泄漏防控的全生命周期管理

引言 Bitmap&#xff08;位图&#xff09;是Android应用内存占用的“头号杀手”。一张1080P&#xff08;1920x1080&#xff09;的图片以ARGB_8888格式加载时&#xff0c;内存占用高达8MB&#xff08;192010804字节&#xff09;。据统计&#xff0c;超过60%的应用OOM崩溃与Bitm…...

sipsak:SIP瑞士军刀!全参数详细教程!Kali Linux教程!

简介 sipsak 是一个面向会话初始协议 (SIP) 应用程序开发人员和管理员的小型命令行工具。它可以用于对 SIP 应用程序和设备进行一些简单的测试。 sipsak 是一款 SIP 压力和诊断实用程序。它通过 sip-uri 向服务器发送 SIP 请求&#xff0c;并检查收到的响应。它以以下模式之一…...

CSS设置元素的宽度根据其内容自动调整

width: fit-content 是 CSS 中的一个属性值&#xff0c;用于设置元素的宽度根据其内容自动调整&#xff0c;确保宽度刚好容纳内容而不会超出。 效果对比 默认情况&#xff08;width: auto&#xff09;&#xff1a; 块级元素&#xff08;如 <div>&#xff09;会占满父容器…...

技术栈RabbitMq的介绍和使用

目录 1. 什么是消息队列&#xff1f;2. 消息队列的优点3. RabbitMQ 消息队列概述4. RabbitMQ 安装5. Exchange 四种类型5.1 direct 精准匹配5.2 fanout 广播5.3 topic 正则匹配 6. RabbitMQ 队列模式6.1 简单队列模式6.2 工作队列模式6.3 发布/订阅模式6.4 路由模式6.5 主题模式…...

Aspose.PDF 限制绕过方案:Java 字节码技术实战分享(仅供学习)

Aspose.PDF 限制绕过方案&#xff1a;Java 字节码技术实战分享&#xff08;仅供学习&#xff09; 一、Aspose.PDF 简介二、说明&#xff08;⚠️仅供学习与研究使用&#xff09;三、技术流程总览四、准备工作1. 下载 Jar 包2. Maven 项目依赖配置 五、字节码修改实现代码&#…...