ros xacro启动的时候总是显示no link,求大神解决下

在urdf目录下建立mbot.xacro mabot_base.xacro两个文件

这个是 mbot_base.xacro 文件内容

<?xml version="1.0"?>
<!-- PROPERTY LIST -->
<xacro:property name="base_length" value="0.26"/>
<xacro:property name="base_width" value="0.26"/>
<xacro:property name="base_height" value="0.10"/>

<xacro:property name="M_PI" value="3.1415926"/>
<xacro:property name="rplidar_radius" value="0.04"/>
<xacro:property name="rplidar_length" value="0.06"/>

<xacro:property name="wheel_radius" value="0.026"/>
<xacro:property name="wheel_length" value="0.02" />
<xacro:property name="wheel_joint_x" value="0.11"/>
<xacro:property name="wheel_joint_y" value="0.143"/>
<xacro:property name="wheel_joint_z" value="0.05"/>

<xacro:property name="camera_length" value="0.04"/>

<!-- Defining the colors used in this robot -->
<material name="yellow">
    <color rgba="1 0.4 0 1"/>
</material>
<material name="black">
    <color rgba="0 0 0 0.95"/>
</material>
<material name="gray">
    <color rgba="0.75 0.75 0.75 1"/>
</material>

<!-- Macro for robot wheel -->
<xacro:macro name="wheel" params="prefix reflect direction">
    <joint name="${prefix}_wheel_joint" type="continuous">
        <origin xyz="${direction*wheel_joint_x} ${reflect*wheel_joint_y} ${-wheel_joint_z}" rpy="0 0 0"/>
        <parent link="base_link"/>
        <child link="${prefix}_wheel_link"/>
        <axis xyz="0 1 0"/>
    </joint>

    <link name="${prefix}_wheel_link">
        <visual>
            <origin xyz="0 0 0" rpy="${M_PI/2} 0 0" />
            <geometry>
                <cylinder radius="${wheel_radius}" length = "${wheel_length}"/>
            </geometry>
            <material name="gray" />
        </visual>
    </link>
</xacro:macro>

<!--macro for robot rplidar-->

<xacro:macro name="mbot_base">
    <link name="rplidar_link">
        <visual>
            <origin xyz="0 0 0" rpy="0 0 0" />
            <geometry>
                <cylinder radius="${rplidar_radius}" length="${rplidar_length}"/>
            </geometry>
	<material name="black" />
        </visual>
    </link>

    <joint name="rplidar_joint" type="fixed">
        <origin xyz="0 0 ${base_height/2 + rplidar_length/2}" rpy="0 0 0" />        
        <parent link="base_link"/>
        <child link="rplidar_link" />
    </joint>

    <link name="base_link">
        <visual>
            <origin xyz=" 0 0 0" rpy="0 0 0" />
            <geometry>
                <box size="${base_length} ${base_width} ${base_height}"/>
            </geometry>
            <material name="yellow" />
        </visual>
    </link>

<link name="camera_link">
    <visual>
	<origin xyz="0 0 0" rpy="0 0 0" />
	<geometry>
	    <box size="${camera_length/2} ${camera_length} ${camera_length}" />
	</geometry>
	<material name="black" />
    </visual>
</link>
<joint name="camera_joint" type="fixed">
    <origin xyz="${base_length/2 + camera_length/2} 0 0" rpy="0 0 0" /> 
    <parent link="base_link"/>
    <child link="camera_link"/>
</joint>
</xacro:macro>



<wheel prefix="front_left" reflect="-1" direction="1"/>
<wheel prefix="front_right" reflect="1" direction="1"/>
<wheel prefix="back_left" reflect="-1" direction="-1"/>
<wheel prefix="back_right" reflect="1" direction="-1"/>

这个是mbot.xacro的内容

<?xml version="1.0"?>
<xacro:include filename="$(find mbot_description)/urdf/mbot_base.xacro" />

<xacro:mbot_base/>

这个是错误

[ERROR] [1592907636.615416962]: No link elements found in urdf file
[robot_state_publisher-3] process has died [pid 30094, exit code 255, cmd /opt/ros/kinetic/lib/robot_state_publisher/state_publisher __name:=robot_state_publisher __log:=/home/hnf/.ros/log/2d6e5b04-b53b-11ea-a025-18cf5ebf00f8/robot_state_publisher-3.log].
log file: /home/hnf/.ros/log/2d6e5b04-b53b-11ea-a025-18cf5ebf00f8/robot_state_publisher-3*.log
[WARN] [1592907636.931556]: The ‘use_gui’ parameter was specified, which is deprecated. We’ll attempt to find and run the GUI, but if this fails you should install the ‘joint_state_publisher_gui’ package instead and run that. This backwards compatibility option will be removed in Noetic.
[ERROR] [1592907642.546882492]: No link elements found in urdf file

you should install the ‘joint_state_publisher_gui’ package instead and run that.看提醒应该缺少包,你装下这个包试试

launch文件:

mbot.xacro:

mbot_base.xacro:

运行结果:

把包名替换成自己的包。