MoveIt+ Gazebo 联合仿真环境搭建(巨简单版)

2023-05-16

MoveIt!+ Gazebo 联合仿真环境搭建(巨简单版)

参考书籍和大佬们的贴子,笔者将MoveIt!实现机器人控制的方法总结为以下四个步骤:

1)创建机器人URDF模型(改为xacro格式也行),并添加运动插件。

在已建立的URDF模型里面,为 joints 添加传动装置 (add transmission for every joint),添加 gazebo 插件(add one gazebo plugin),可参考以下代码。

<!--add transmission for every joint-->
<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>
    <transmission name="trans_joint6">
        <type>transmission_interface/SimpleTransmission</type>
        <joint name="joint6">
            <hardwareInterface>hardware_interface/PositionJointInterface</hardwareInterface>
        </joint>
        <actuator name="joint6_motor">
            <hardwareInterface>hardware_interface/PositionJointInterface</hardwareInterface>
            <mechanicalReduction>1</mechanicalReduction>
        </actuator>
    </transmission>
<!-- add one gazebo plugin-->
    <gazebo>
        <plugin name="gazebo_ros_control" filename="libgazebo_ros_control.so">
            <robotNamespace>/</robotNamespace>
            <robotSimType>gazebo_ros_control/DefaultRobotHWSim</robotSimType>
            <legacyModeNS>true</legacyModeNS>
        </plugin>
    </gazebo>

2)使用 MoveIt!Setup Assistant 工具生成配置文件。

就不详细说了,网上很多教程,按照教程一步一步来就行。

可以参考这篇moveit规划机器人轨迹控制gazebo里的仿真 ,参考配置 moveit 包这部分就够了,该作者的教程能走通但是更复杂。(感谢大佬的教程)

3)添加机器人控制器或控制插件

修改由 MoveIt!Setup Assistant 创建的功能包_moveit_config/config/ros_controllers.yaml, 在最末尾添加控制器或控制插件。(# the blow lines are added for need!)后面部分是需要添加的,可以参考然后为自己的机器人添加插件。

# Simulation settings for using moveit_sim_controllers
moveit_sim_hw_interface:
  joint_model_group: arm
  joint_model_group_pose: home
# Settings for ros_control_boilerplate control loop
generic_hw_control_loop:
  loop_hz: 300
  cycle_time_error_threshold: 0.01
# Settings for ros_control hardware interface
hardware_interface:
  joints:
    - joint1
    - joint2
    - joint3
    - joint4
    - joint5
    - joint6
  sim_control_mode: 1  # 0: position, 1: velocity
# Publish all joint states
# Creates the /joint_states topic necessary in ROS
joint_state_controller:
  type: joint_state_controller/JointStateController
  publish_rate: 50
controller_list:
  - name: arm_controller
    action_ns: follow_joint_trajectory
    default: True
    type: FollowJointTrajectory
    joints:
      - joint1
      - joint2
      - joint3
      - joint4
      - joint5
  - name: gripper_controller
    action_ns: follow_joint_trajectory
    default: True
    type: FollowJointTrajectory
    joints:
      - joint6
# the blow lines are added for need!
arm_controller: 
  type: position_controllers/JointTrajectoryController
  joints:
      - joint1
      - joint2
      - joint3
      - joint4
      - joint5
  gains: 
    joint1: 
      p: 100
      d: 1
      i: 1 
      i_clamp: 1
    joint2: 
      p: 100
      d: 1
      i: 1 
      i_clamp: 1
    joint3: 
      p: 100
      d: 1
      i: 1 
      i_clamp: 1
    joint4: 
      p: 100
      d: 1
      i: 1 
      i_clamp: 1
    joint5: 
      p: 100
      d: 1
      i: 1 
      i_clamp: 1
gripper_controller:
  type: position_controllers/JointTrajectoryController
  joints:
      - joint6
  gains: 
    joint6: 
      p: 100
      d: 1
      i: 1 
      i_clamp: 1

修改 _moveit_config/launch/ros_controllers.launch。 args=“joint_state_controller arm_controller gripper_controller” 双引号里面的内容是自己添加的。注意这几个控制器名字必须和ros_controllers.yaml文件里面的名字一样。

<?xml version="1.0"?>
<launch>

  <!-- Load joint controller configurations from YAML file to parameter server -->
  <rosparam file="$(find arm_g2_moveit_config)/config/ros_controllers.yaml" command="load"/>

  <!-- Load the controllers -->
  <node name="controller_spawner" pkg="controller_manager" type="spawner" respawn="false"
    output="screen" args="joint_state_controller arm_controller gripper_controller"/>

</launch>

4)运行demo_gazebo.launch,使用MoveIt! 控制机器人运动。

使用以上教程,顺利完成的联合仿真,如下图所示。

在这里插入图片描述

一些会出现的bug, 可忽略不影响。

[TERROR][1648205080.5748877891: Could not find the planner confiquration ‘None’ on the param server
在这里插入图片描述
修改方法:找到创建的功能包_moveit_config/config/ompl_planning.yaml,修改对应代码:

arm:
  default_planner_config: None   # None 改为 RRT 或者 RRTConnect 等
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

MoveIt+ Gazebo 联合仿真环境搭建(巨简单版) 的相关文章

  • SLAM综述:激光雷达与视觉SLAM(2019.10.12)

    本文基于https arxiv org pdf 1909 05214v2 pdf 进行阐述 xff08 其实差不多就是精简版翻译 xff09 第一节概述 第二节讲述激光SLAM xff1a 激光传感器 xff0c 开源系统 xff0c 深度
  • HAL库串口收发

    1 通讯方式介绍 在微处理器和外部通信模块之间主要有并行通信和串行通信两种 并行通讯传输速率快 xff0c 但是占用引脚较多 xff0c 串行通信与之相反 串行通讯分别有单工 半双工 全双工三种模式 单工 xff1a 只能发送数据或者只能接
  • ros 启动

    绑定usb设备端口号 11条消息 Ubuntu下绑定串口的两种方式ID法和serial法 haley du的博客 CSDN博客 11条消息 Ubuntu usb设备端口号绑定 一抹烟霞的博客 CSDN博客 2 2执行 1 执行相关launc
  • c++中“::“表示含义

    1 表示 域操作符 例 xff1a 声明了一个类A xff0c 类A里声明了一个成员函数void f xff0c 但没有在类的声明里给出f的定义 xff0c 那么在类外定义f时 xff0c 就要写成void A f xff0c 表示这个f
  • ROS自学笔记整合-串口通信篇

    ROS自学笔记整合 串口通信篇 最近也是刚开始接触ROS xff0c 然后买了一本古月大神的 ROS机器人开发实践 自己在捣鼓 本人编程小白 xff0c 只能做代码的搬运工 书本上的仿真基本都看的差不多了 xff0c 也动手做了不少例子 x
  • docker宿主机ssh免密

    若要实现免密登陆 xff0c 意味着无论是宿主机 xff0c 还是容器都要彼此交互公钥 xff1a 容器A发送自身公钥给中心机器 xff0c 统一由中心机器 xff0c 回发全部需要ssh到容器A的公钥信息 xff0c 任何一个新加入的容器
  • redis指定配置文件启动失败

    redis指定配置文件启动失败 redis指定配置文件启动失败 redis server redis conf失败 但是直接执行redis server是可以成功的 之所以没有启动成功 xff0c 且没有报错的原因是 在自己的redis c
  • Ubuntu 查看磁盘空间及目录容量

    Ubuntu 查看磁盘空间及目录容量 http www zhcn org 548 Df命令是linux系统以磁盘分区为单位查看文件系统 xff0c 可以加上参数查看磁盘剩余空间 xff1a df hl 显示格式为 xff1a 文件系统 容量
  • VS(Visual Studio)与VC(Visual C++)版本对应关系

    VS全名是Microsoft Visual Studio xff0c 是很大的一个开发环境 xff0c 包含很多高级语言的开发环境 xff0c VC只是VS其中的一个开发环境 VC版本与VS版本对应关系如下所示 xff1a Visual S
  • docker 状态Removal In Progress,rm提示无法删除

    docker 无法删除场景 docker 进入Removal In Progress状态 xff0c 无法直接删除 1 docker rm f 容器 提示文件无权限操作 2 xxxx 表示上图的文件路径 需要登录到宿主机上 xff0c 执行
  • windows上安装启动pgsql,postgres

    windows上安装启动pgsql postgres 1 在官网下载pgsql2 进入pgsql的安装目录 bin 下面3 windows 启动 pgsql server cmd窗口退出 server关闭4 注册成服务 cmd窗口退出 se
  • django调试问题django.core.exceptions.ImproperlyConfigured

    django项目调试子应用app时提示缺少配置 1 项目的settings文件里面设置的有子app xff0c 依旧提示下面问题 django core exceptions ImproperlyConfigured Requested s
  • Python 数据描述符

    今天看到一篇文档介绍了Python描述符 xff0c 转发学习下 1 默认的属相访问是从对象的字典中 get set 或者 delete 属性 xff1b 例如a x的查找顺序是 a x gt a dict x gt type a dict
  • pycharm中terminal中使用git bash替换cmd(无弹窗)

    pycharm中terminal中使用git bash替换cmd 1 背景 系统 xff1a windows 想要在pycharm上的terminal中使用git bash而不是系统自带的cmd 可以调用基础的Linux命令 比如ls 等
  • linux安装 python3-pip没有安装候选项

    问题 环境 xff1a linux ubuntu span class token number 22 04 span 版本 LTS windows xff1a 使用vmware 执行以下命令报错 span class token func
  • django连接elasticsearch失败Failed to establish a new connection: [Errno 113] No route to host[Errno 111]

    做django商城项目时报错 错误信息 urllib3 exceptions NewConnectionError lt urllib3 connection HTTPConnection object at 0x7fa6b2537390
  • python爬虫数据采集使用的三种匹配方式:正则re,xpath,beautifulsoup4

    一般情况下三种方式都是可以匹配到结果的 xff0c 只是复杂程度不一致 xff0c 根据情况进行选择re xpath bs4 先进行简单的比较 xff1a 一 正则re的使用二 lxml三 bs4 的使用 先进行简单的比较 xff1a 抓取
  • 实现微信扫码登录-OAuth2-授权框架

    x1f646 OAuth2 xff1a 是一种授权框架 xff0c 仅用于授权代理 xff0c 针对特定问题的一种解决方案 主要可以解决两个问题 xff0c 一种是开放系统间的授权 xff0c 另一种是分布式之间的访问问题 x1f646 开
  • yolov5报错:RuntimeError: a view of a leaf Variable that requires grad is being used in an in-place

    在执行下面代码时 python train span class token punctuation span py span class token operator span img span class token number 64
  • Android界面刷新的方法

    Android界面刷新的方法 Android 提供了 Invalidate 方法实现界面刷新 xff0c 但是 Invalidate 不能直接在线程中调用 xff0c 因为他是违背了单线程模型 xff1a Android UI 操作并不是线

随机推荐