URDF error in the code

user:~/catkin_ws/src/my_mira_description/urdf$ rosrun my_mira_description mira_simple_collisions_inertias.urdf
/home/user/catkin_ws/src/my_mira_description/urdf/mira_simple_collisions_inertias.urdf: line 1: syntax error near unexpected token newline' /home/user/catkin_ws/src/my_mira_description/urdf/mira_simple_collisions_inertias.urdf: line 1: <?xml version="1.0"?>’

Error I got while executing the code. Code for reference is below.

<?xml version="1.0"?>
<link name = "base_link">

    <visual>

        <material name = "grey">

            <color rgba = "0.75 0.75 0.75 1"/>

        </material>

        <origin xyz = "0 0 0" rpy = "0 0 0"/>

        <geometry>

    <cylinder radius = "0.06" length = "0.09"/>

        </geometry>

    </visual>

    

    <inertial>

        <origin xyz = "0 0 0" rpy = "0 0 0"/>

        <mass value = "0.18"/>

        <inertia ixx = "0.0002835" ixy = "0.0" ixz = "0.0" iyy = "0.0002835" iyz = "0.0" izz = "0.000324"/>

    </inertial>



    <collision>

        <origin xyz = "0 0 0" rpy = "0 0 0"/>

        <geometry>

            <cylinder radius = "0.06" length = "0.09"/>

        </geometry>

    </collision>            

</link>       

<gazebo reference="base_link">

    <kp>100000.0</kp>

    <kd>100000.0</kd>

    <mu1>10.0</mu1>

    <mu2>10.0</mu2>

    <material>Gazebo/Grey</material>

</gazebo>

<link name = "roll_M1_link">

    <visual>

        <material name = "red">

            <color rgba = "0.8 0 0 1"/>

        </material>  

        <origin xyz = "0 0 0" rpy = "0 0 0"/>

        <geometry>

            <cylinder radius = "0.01" length = "0.005"/>

        </geometry>

    </visual>

    <inertial>

        <origin xyz = "0 0 0" rpy = "0 0 0"/>

        <mass value = "0.001"/>

        <inertia ixx="2.70833333333e-08" ixy="0.0" ixz="0.0" iyy="2.70833333333e-08" iyz="0.0" izz="5e-08"/>

    </inertial>  

</link>

<gazebo reference="roll_M1_link">

    <kp>1000.0</kp>

    <kd>10.0</kd>

    <mu1>10.0</mu1>

    <mu2>10.0</mu2>

    <material>Gazebo/Red</material>

</gazebo>

<joint name = "roll_joint" type = "revolute">

    <parent link = "base_link"/>

    <child link = "roll_M1_link"/>

    <origin xyz = "0.0023 0 -0.0005" rpy = "0 0 0"/>

    <limit lower = "-0.2" upper = "0.2" effort = "0.1" velocity = "0.005"/>

    <axis xyz = "1 0 0"/>

</joint>

Hi,

Have you tested with the solutions? Because at least I see in this example of urdf that the robot tag is missing. Have a look at the solutions: URDF_COURSE_SOLUTIONS