日期: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文件是否有错误,注意格式问题


版权声明:本文为qq_34828179原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
原文链接:https://blog.csdn.net/qq_34828179/article/details/121273552