《ROS机器人开发实践》学习七——在GAZEBO中仿真

日期:2021/11/11

一、创建模型

1、在机器人工作空间中,新建gazebo功能包bash catkin_create_pkg robot_gazebo urdf xacro
2、新建urdf文件夹:mkdir urdf
然后将前面创建的robot.urdf.xacro和robort_body.urdf.xacro文件移动至该文件夹中,并对robort_body.urdf.xacro作以下修改:
(1)在robot_body.urdf.xacro添加<inertial> <collission>,标签为link添加惯性参数和碰撞参数;
惯性参数的设置可参照以下文章:
https://blog.csdn.net/lzzzzzzm/article/details/119899598
(2)为link添加gazebo标签单独设置link的颜色;
(3)添加transmission标签,为机器人加入驱动的动力源;
3、新建launch文件夹:mkdir launch,创建launch文件。

二、遇到的问题

1、在gazebo中不显示颜色
需要在link中添加,gazebo标签,如果还不行则需要在robot.urdf.xacro中添加如以下链接:

<robot name="testrobot" 
    xmlns:xi="http://www.w3.org/2001/XInclude"
    xmlns:gazebo="http://playerstage.sourceforge.net/gazebo/xmlschema/#gz"
    xmlns:model="http://playerstage.sourceforge.net/gazebo/xmlschema/#model"
    xmlns:sensor="http://playerstage.sourceforge.net/gazebo/xmlschema/#sensor"
    xmlns:body="http://playerstage.sourceforge.net/gazebo/xmlschema/#body"
    xmlns:geom="http://playerstage.sourceforge.net/gazebo/xmlschema/#geom"
    xmlns:joint="http://playerstage.sourceforge.net/gazebo/xmlschema/#joint"
    xmlns:controller="http://playerstage.sourceforge.net/gazebo/xmlschema/#controller"
    xmlns:interface="http://playerstage.sourceforge.net/gazebo/xmlschema/#interface"
    xmlns:rendering="http://playerstage.sourceforge.net/gazebo/xmlschema/#rendering"
    xmlns:renderable="http://playerstage.sourceforge.net/gazebo/xmlschema/#renderable"
    xmlns:physics="http://playerstage.sourceforge.net/gazebo/xmlschema/#physics"
xmlns:xacro="http://ros.org/wiki/xacro">

在遇到无法加载差速控制插件的时候也需要添加以上链接。

2、无法载入模型
先检查自己编写的xacro文件是否有错误,注意格式问题

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值