0
$\begingroup$

Rosanswers logo

link text

And i dont know how to connect other links to chassis

urdf file is properly formed, gazebo file is not, says:

Error: No name given for the robot. at line 89 in /build/urdfdom-ACOcA8/urdfdom-1.0.0/urdf_parser/src/model.cpp ERROR: Model Parsing the xml failed

gazebo code:

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


  <gazebo>
    <plugin name="differential_drive_controller" filename="libgazebo_ros_diff_drive.so">
      <legacyMode>false</legacyMode>
      <alwaysOn>true</alwaysOn>
      <updateRate>20</updateRate>
      <leftJoint>left_wheel_hinge</leftJoint>
      <rightJoint>right_wheel_hinge</rightJoint>
      <wheelSeparation>0.4</wheelSeparation>
      <wheelDiameter>0.1</wheelDiameter>
      <torque>20</torque>
      <commandTopic>cmd_vel</commandTopic>
      <odometryTopic>odom</odometryTopic>
      <odometryFrame>odom</odometryFrame>
      <robotBaseFrame>chassis</robotBaseFrame>
    </plugin>
  </gazebo>

  <gazebo reference="chassis">
      <material>Gazebo/Orange</material>
    </gazebo>
  <gazebo reference="left_wheel">
      <material>Gazebo/Blue</material>
  </gazebo>
  <gazebo reference="right_wheel">
      <material>Gazebo/Blue</material>
  </gazebo>

  <gazebo reference="camera_link">
  <sensor name="kinect_camera" type="depth">
    <!--update_rate>40</update_rate-->
    <visualize>true</visualize>
    <camera>
      <horizontal_fov>1.047198</horizontal_fov>
      <image>
        <width>640</width>
        <height>480</height>
        <format>R8G8B8</format>
      </image>
      <clip>
        <near>0.1</near>
        <far>100</far>
      </clip>
    </camera>
    <plugin name="kinect_controller" filename="libgazebo_ros_openni_kinect.so">
      <baseline>0.2</baseline>
      <alwaysOn>true</alwaysOn>
      <updateRate>0.0</updateRate>
      <cameraName>kinect_camera_ir</cameraName>
      <imageTopicName>/kinect_camera/image_raw</imageTopicName>
      <cameraInfoTopicName>/kinect_camera/depth/camera_info</cameraInfoTopicName>
      <depthImageTopicName>/kinect_camera/depth/image_raw</depthImageTopicName>
      <depthImageInfoTopicName>/kinect_camera/depth/camera_info</depthImageInfoTopicName>
      <pointCloudTopicName>/kinect_camera/depth/points</pointCloudTopicName>
      <frameName>kinect_frame</frameName>
      <pointCloudCutoff>0.5</pointCloudCutoff>
      <pointCloudCutoffMax>3.0</pointCloudCutoffMax>
      <distortionK1>0</distortionK1>
      <distortionK2>0</distortionK2>
      <distortionK3>0</distortionK3>
      <distortionT1>0</distortionT1>
      <distortionT2>0</distortionT2>
      <CxPrime>0</CxPrime>
      <Cx>0</Cx>
      <Cy>0</Cy>
      <focalLength>0</focalLength>
      <hackBaseline>0</hackBaseline>
    </plugin>
  </sensor>
</gazebo>
</robot>

xacro file:

<?xml version='1.0'?>

<robot name="myrobot" 
    
    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">



  <xacro:include filename="$(find mybot_description)/urdf/mybot.gazebo" />
  <xacro:include filename="$(find mybot_description)/urdf/materials.xacro" />
  <xacro:include filename="$(find mybot_description)/urdf/macros.xacro" />


  <link name='chassis'>
    <pose>0 0 0.1 0 0 0</pose>

    <inertial>
      <mass value="10.0"/>
      <origin xyz="0.0 0 0.1" rpy=" 0 0 0"/>
      <inertia
          ixx="0.5" ixy="0" ixz="0"
          iyy="1.0" iyz="0"
          izz="0.1" />
      
    </inertial>

    <collision name='collision'>
      <geometry>
        <cylinder radius=".3" length="0.1"/>
      </geometry>
    </collision>

    <visual name='chassis_visual'>
      <origin xyz="0 0 0" rpy=" 0 0 0"/>
      <geometry>
        <cylinder radius=".3" length ="0.1"/>
      </geometry>
    </visual>


    <collision name='caster_collision'>
      <origin xyz="-0.2 0 -0.05" rpy=" 0 0 0"/>
      <geometry>
        <sphere radius="0.05"/>
      </geometry>
      <surface>
        <friction>
          <ode>
            <mu>0</mu>
            <mu2>0</mu2>
            <slip1>1.0</slip1>
            <slip2>1.0</slip2>
          </ode>
        </friction>
      </surface>
    </collision>

    <visual name='caster_visual'>
      <origin xyz="-0.2 0 -0.05" rpy=" 0 0 0"/>
      <geometry>
        <sphere radius="0.05"/>
      </geometry>
    </visual>

    <collision name='caster2_collision'>
      <origin xyz="0.2 0 -0.05" rpy=" 0 0 0"/>
      <geometry>
        <sphere radius="0.05"/>
      </geometry>
      <surface>
        <friction>
          <ode>
            <mu>0</mu>
            <mu2>0</mu2>
            <slip1>1.0</slip1>
            <slip2>1.0</slip2>
          </ode>
        </friction>
      </surface>
    </collision>

    <visual name='caster2_visual'>
      <origin xyz="0.2 0 -0.05" rpy=" 0 0 0"/>
      <geometry>
        <sphere radius="0.05"/>
      </geometry>
    </visual>
  </link>


  <link name="left_wheel">
    <origin xyz="0.1 0.13 0.1" rpy="0 1.5707 1.5707"/>
    <collision name="collision">
      <origin xyz="0 0 0.0" rpy="0 1.5707 1.5707"/>
      <geometry>
        <cylinder radius="0.1" length="0.05"/>
      </geometry>
    </collision>
    <visual name="left_wheel_visual">
      <origin xyz="0 0 0.0" rpy="0 1.5707 1.5707"/>
      <geometry>
        <cylinder radius="0.1" length="0.05"/>
      </geometry>
    </visual>
    <inertial>
      <origin xyz="0 0 0.0" rpy="0 1.5707 1.5707"/>
      <mass value="5"/>
      <cylinder_inertia m="5" r="0.1" h="0.05"/>
      <inertia
        ixx="1.0" ixy="0.0" ixz="0.0"
        iyy="1.0" iyz="0.0"
        izz="1.0"/>
    </inertial>
  </link>

  <link name="right_wheel">
    <origin xyz="0.1 -0.13 0.1" rpy="0 1.5707 1.5707"/>
    <collision name="collision">
      <origin xyz="0 0 0.0" rpy="0 1.5707 1.5707"/>
      <geometry>
        <cylinder radius="0.1" length="0.05"/>
      </geometry>
    </collision>
    <visual name="right_wheel_visual">
      <origin xyz="0 0 0.0" rpy="0 1.5707 1.5707"/>
      <geometry>
        <cylinder radius="0.1" length="0.05"/>
      </geometry>
    </visual>
    <inertial>
      <origin xyz="0 0 0.0" rpy="0 1.5707 1.5707"/>
      <mass value="5"/>
      <cylinder_inertia m="5" r="0.1" h="0.05"/>
      <inertia
        ixx="1.0" ixy="0.0" ixz="0.0"
        iyy="1.0" iyz="0.0"
        izz="1.0"/>
    </inertial>
  </link>


  <joint type="continuous" name="left_wheel_hinge">
    <origin xyz="0.0 -0.29 0" rpy="0 0 0"/>
    <child link="left_wheel"/>
    <parent link="chassis"/>
    <axis xyz="0 1 0" rpy="0 0 0"/>
    <limit effort="100" velocity="100"/>
    <joint_properties damping="0.0" friction="0.0"/>
  </joint>

  <joint type="continuous" name="right_wheel_hinge">
    <origin xyz="0.0 0.29 0" rpy="0 0 0"/>
    <child link="right_wheel"/>
    <parent link="chassis"/>
    <axis xyz="0 1 0" rpy="0 0 0"/>
    <limit effort="100" velocity="100"/>
    <joint_properties damping="0.0" friction="0.0"/>
  </joint>
 <joint name="base_camera_joint" type="fixed">
    <origin xyz="0.2 0 0.1" rpy="0 0 0 " />
    <parent link="chassis" />
    <origin xyz="0 0 0" rpy="0 0 0" />
    <child link="camera_link" />
  </joint>

  <link name="camera_link">
    <inertial>
      <mass value="0.01" />
      <origin xyz="0 0 0" />
      <inertia ixx="0.001" ixy="0.0" ixz="0.0"
        iyy="0.001" iyz="0.0"
        izz="0.001" />
    </inertial>

    <visual>
      <origin xyz=" 0 0 0 " rpy="0 0 0" />
      <geometry>
        <mesh filename="package://mybot_description/meshes/kinect.dae"/>
      </geometry>
    </visual>

    <collision>
      <origin xyz="0.0 0.0 0.0" rpy="0 0 0" />
      <geometry>
        <box size="0.0730 .2760 0.0720"/>
      </geometry>
    </collision>

  </link>
  
  <joint name="camera_depth_joint" type="fixed">
    <origin xyz="0 0.011 0" rpy="0 0 0" />
    <parent link="camera_link" />
    <child link="camera_depth_frame" />
  </joint>

  <link name="camera_depth_frame">
    <inertial>
      <mass value="0.01" />
      <origin xyz="0 0 0" />
      <inertia ixx="0.001" ixy="0.0" ixz="0.0"
        iyy="0.001" iyz="0.0"
        izz="0.001" />
    </inertial>
  </link>

  <joint name="camera_depth_optical_joint" type="fixed">
    <origin xyz="0 0 0" rpy="1.5707 0 1.5707" />
    <parent link="camera_depth_frame" />
    <child link="camera_depth_optical_frame" />
  </joint>

  <link name="camera_depth_optical_frame">
    <inertial>
      <mass value="0.001" />
      <origin xyz="0 0 0" />
      <inertia ixx="0.0001" ixy="0.0" ixz="0.0"
        iyy="0.0001" iyz="0.0"
        izz="0.0001" />
    </inertial>
  </link>

  <joint name="camera_rgb_joint" type="fixed">
    <origin xyz="0 -0.012 0" rpy="0 0 0" />
    <parent link="camera_link" />
    <child link="camera_rgb_frame" />
  </joint>

  <link name="camera_rgb_frame">
    <inertial>
      <mass value="0.001" />
      <origin xyz="0 0 0" />
      <inertia ixx="0.0001" ixy="0.0" ixz="0.0"
        iyy="0.0001" iyz="0.0"
        izz="0.0001" />
    </inertial>
  </link>

  <joint name="camera_rgb_optical_joint" type="fixed">
    <origin xyz="0 0 0" rpy="1.5707 0 1.5707" />
    <parent link="camera_rgb_frame" />
    <child link="camera_rgb_optical_frame" />
  </joint>

  <link name="camera_rgb_optical_frame">
    <inertial>
      <mass value="0.001" />
      <origin xyz="0 0 0" />
      <inertia ixx="0.0001" ixy="0.0" ixz="0.0"
        iyy="0.0001" iyz="0.0"
        izz="0.0001" />
    </inertial>
  </link>




</robot>

Originally posted by Marseiliais on ROS Answers with karma: 31 on 2019-09-05

Post score: 0


Original comments

Comment by Delb on 2019-09-05:
We can't really help only with a screenshot from rviz, can you detail what you have launched to get this result ? Also have you checked that your urdf is properly formed ? You can try this :

check_urdf /PATH/TO/YOUR/URDF/FILE

Comment by Marseiliais on 2019-09-05:
Yes is its, says robot name is: myrobot ---------- Successfully Parsed XML --------------- root Link: chassis has 3 child(ren) child(1): camera_link child(1): camera_depth_frame child(1): camera_depth_optical_frame child(2): camera_rgb_frame child(1): camera_rgb_optical_frame child(2): left_wheel child(3): right_wheel I added code to the question

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

You should include your launch file too so that we can reproduce your error.

I manage to get the same error as in your image by omitting to launch the node robot_state_publisher you seem to be launching just the joint_state_publisher node but you need both.

So a basic launch file without gazebo should be like this and wouldn't give you the same error :

<launch>

  <arg name="model" default="$(find myrobot)/urdf/myrobot.urdf.xacro"/>

  <!--  ******************** Robot Model ********************  -->
  <param name="robot_description" command="$(find xacro)/xacro --inorder $(arg model)" />

  <!--  ******************** Joint State Publisher ********************  -->
  <node name="joint_state_publisher" pkg="joint_state_publisher" type="joint_state_publisher" />

  <!--  ******************** Robot State Publisher ********************  -->
  <node name="robot_state_publisher" pkg="robot_state_publisher" type="state_publisher" />

  <!--  ******************** Rviz ********************  -->
  <node name="rviz" pkg="rviz" type="rviz" required="true" />

</launch>

Originally posted by Delb with karma: 3907 on 2019-09-06

This answer was ACCEPTED on the original site

Post score: 1


Original comments

Comment by Marseiliais on 2019-09-06:
Your right! Thanks a lot!

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.