0
$\begingroup$

Rosanswers logo

Hi, everyone!

I’m newbie at ROS, URDF, Rviz, Gazebo... I’m learning about these topics for research. Running Ubuntu 18.04, ROS Melodic Morenia, RViz version 1.13.7 and Gazebo 9.12. I’ve build a model on SolidWorks 2018 and used the sw2urdf plugin to create a urdf file and export the meshes .STL from assembly. Now I can spawn the model on Rviz and Gazebo, but the model appears with a wrong orientation and some links in a different position from the original assembly. I’ve tested some changes in the URDF file, but without success. I’ve tried to use the joint control on Rviz, but the GUI doesn’t appear. How can I fix the wrong position links and orientation from the model? How can I use the joint control GUI?

My URDF file and display.launch

<?xml version="1.0"?>
<!-- This URDF was automatically created by SolidWorks to URDF Exporter! Originally created by Stephen Brawner ([email protected]) 
     Commit Version: 1.5.1-0-g916b5db  Build Version: 1.5.7152.31018
     For more information, please see http://wiki.ros.org/sw_urdf_exporter -->
<robot
  name="roboturdf_4">
  <link
    name="base_link">
    <inertial>
      <origin
        xyz="0.020092 0.30138 -0.0034671"
        rpy="0 0 0" />
      <mass
        value="29.722" />
      <inertia
        ixx="0.65036"
        ixy="1.6601E-16"
        ixz="6.6492E-17"
        iyy="0.31967"
        iyz="2.902E-06"
        izz="0.77965" />
    </inertial>
    <visual>
      <origin
        xyz="0 0 0"
        rpy="0 0 0" />
      <geometry>
        <mesh
          filename="package://roboturdf_4/meshes/base_link.STL" />
      </geometry>
      <material
        name="">
        <color
          rgba="0.79216 0.81961 0.93333 1" />
      </material>
    </visual>
    <collision>
      <origin
        xyz="0 0 0"
        rpy="0 0 0" />
      <geometry>
        <mesh
          filename="package://roboturdf_4/meshes/base_link.STL" />
      </geometry>
    </collision>
  </link>
  <link
    name="pr_link">
    <inertial>
      <origin
        xyz="0.081627 -0.17409 0.10967"
        rpy="0 0 0" />
      <mass
        value="4.7937" />
      <inertia
        ixx="0.06966"
        ixy="3.3077E-07"
        ixz="-2.0109E-07"
        iyy="0.025789"
        iyz="0.027949"
        izz="0.052279" />
    </inertial>
    <visual>
      <origin
        xyz="0 0 0"
        rpy="0 0 0" />
      <geometry>
        <mesh
          filename="package://roboturdf_4/meshes/pr_link.STL" />
      </geometry>
      <material
        name="">
        <color
          rgba="0.79216 0.81961 0.93333 1" />
      </material>
    </visual>
    <collision>
      <origin
        xyz="0 0 0"
        rpy="0 0 0" />
      <geometry>
        <mesh
          filename="package://roboturdf_4/meshes/pr_link.STL" />
      </geometry>
    </collision>
  </link>
  <joint
    name="pr_joint"
    type="revolute">
    <origin
      xyz="-0.17192 0 0"
      rpy="0 0 0" />
    <parent
      link="base_link" />
    <child
      link="pr_link" />
    <axis
      xyz="-1 0 0" />
    <limit
      lower="0"
      upper="0"
      effort="0"
      velocity="0" />
  </joint>
  <link
    name="kr_link">
    <inertial>
      <origin
        xyz="0.079413 -0.23691 -0.055825"
        rpy="0 0 0" />
      <mass
        value="4.1185" />
      <inertia
        ixx="0.07898"
        ixy="-1.132E-17"
        ixz="-2.5386E-18"
        iyy="0.0084476"
        iyz="-0.016566"
        izz="0.074995" />
    </inertial>
    <visual>
      <origin
        xyz="0 0 0"
        rpy="0 0 0" />
      <geometry>
        <mesh
          filename="package://roboturdf_4/meshes/kr_link.STL" />
      </geometry>
      <material
        name="">
        <color
          rgba="0.79216 0.81961 0.93333 1" />
      </material>
    </visual>
    <collision>
      <origin
        xyz="0 0 0"
        rpy="0 0 0" />
      <geometry>
        <mesh
          filename="package://roboturdf_4/meshes/kr_link.STL" />
      </geometry>
    </collision>
  </link>
  <joint
    name="kr_joint"
    type="revolute">
    <origin
      xyz="0 -0.36749 0.23145"
      rpy="0 0 0" />
    <parent
      link="pr_link" />
    <child
      link="kr_link" />
    <axis
      xyz="1 0 0" />
    <limit
      lower="0"
      upper="0"
      effort="0"
      velocity="0" />
  </joint>
  <link
    name="fr_link">
    <inertial>
      <origin
        xyz="0.053361 -0.016779 0.063972"
        rpy="0 0 0" />
      <mass
        value="0.14055" />
      <inertia
        ixx="0.00075962"
        ixy="7.1594E-06"
        ixz="-3.7404E-05"
        iyy="0.00088434"
        iyz="1.2292E-05"
        izz="0.00013186" />
    </inertial>
    <visual>
      <origin
        xyz="0 0 0"
        rpy="0 0 0" />
      <geometry>
        <mesh
          filename="package://roboturdf_4/meshes/fr_link.STL" />
      </geometry>
      <material
        name="">
        <color
          rgba="0.79216 0.81961 0.93333 1" />
      </material>
    </visual>
    <collision>
      <origin
        xyz="0 0 0"
        rpy="0 0 0" />
      <geometry>
        <mesh
          filename="package://roboturdf_4/meshes/fr_link.STL" />
      </geometry>
    </collision>
  </link>
  <joint
    name="fr_joint"
    type="revolute">
    <origin
      xyz="0 -0.4777 -0.1128"
      rpy="0 0 0" />
    <parent
      link="kr_link" />
    <child
      link="fr_link" />
    <axis
      xyz="-1 0 0" />
    <limit
      lower="0"
      upper="0"
      effort="0"
      velocity="0" />
  </joint>
  <link
    name="pl_link">
    <inertial>
      <origin
        xyz="-0.08163 -0.17128 0.114"
        rpy="0 0 0" />
      <mass
        value="4.7937" />
      <inertia
        ixx="0.06966"
        ixy="3.2568E-07"
        ixz="-2.0938E-07"
        iyy="0.027209"
        iyz="0.028579"
        izz="0.050859" />
    </inertial>
    <visual>
      <origin
        xyz="0 0 0"
        rpy="0 0 0" />
      <geometry>
        <mesh
          filename="package://roboturdf_4/meshes/pl_link.STL" />
      </geometry>
      <material
        name="">
        <color
          rgba="0.79216 0.81961 0.93333 1" />
      </material>
    </visual>
    <collision>
      <origin
        xyz="0 0 0"
        rpy="0 0 0" />
      <geometry>
        <mesh
          filename="package://roboturdf_4/meshes/pl_link.STL" />
      </geometry>
    </collision>
  </link>
  <joint
    name="pl_joint"
    type="revolute">
    <origin
      xyz="0.21212 0 0"
      rpy="0 0 0" />
    <parent
      link="base_link" />
    <child
      link="pl_link" />
    <axis
      xyz="-1 0 0" />
    <limit
      lower="0"
      upper="0"
      effort="0"
      velocity="0" />
  </joint>
  <link
    name="kl_link">
    <inertial>
      <origin
        xyz="-0.079416 -0.23964 -0.041429"
        rpy="0 0 0" />
      <mass
        value="4.1185" />
      <inertia
        ixx="0.07898"
        ixy="3.1126E-17"
        ixz="5.4167E-18"
        iyy="0.0067006"
        iyz="-0.012455"
        izz="0.076742" />
    </inertial>
    <visual>
      <origin
        xyz="0 0 0"
        rpy="0 0 0" />
      <geometry>
        <mesh
          filename="package://roboturdf_4/meshes/kl_link.STL" />
      </geometry>
      <material
        name="">
        <color
          rgba="0.79216 0.81961 0.93333 1" />
      </material>
    </visual>
    <collision>
      <origin
        xyz="0 0 0"
        rpy="0 0 0" />
      <geometry>
        <mesh
          filename="package://roboturdf_4/meshes/kl_link.STL" />
      </geometry>
    </collision>
  </link>
  <joint
    name="kl_joint"
    type="revolute">
    <origin
      xyz="0 -0.36157 0.24059"
      rpy="0 0 0" />
    <parent
      link="pl_link" />
    <child
      link="kl_link" />
    <axis
      xyz="-1 0 0" />
    <limit
      lower="0"
      upper="0"
      effort="0"
      velocity="0" />
  </joint>
  <link
    name="fl_link">
    <inertial>
      <origin
        xyz="-0.053361 -0.016779 0.063972"
        rpy="0 0 0" />
      <mass
        value="0.14055" />
      <inertia
        ixx="0.00075962"
        ixy="-7.1594E-06"
        ixz="3.7404E-05"
        iyy="0.00088434"
        iyz="1.2292E-05"
        izz="0.00013186" />
    </inertial>
    <visual>
      <origin
        xyz="0 0 0"
        rpy="0 0 0" />
      <geometry>
        <mesh
          filename="package://roboturdf_4/meshes/fl_link.STL" />
      </geometry>
      <material
        name="">
        <color
          rgba="0.79216 0.81961 0.93333 1" />
      </material>
    </visual>
    <collision>
      <origin
        xyz="0 0 0"
        rpy="0 0 0" />
      <geometry>
        <mesh
          filename="package://roboturdf_4/meshes/fl_link.STL" />
      </geometry>
    </collision>
  </link>
  <joint
    name="fl_joint"
    type="revolute">
    <origin
      xyz="0 -0.48361 -0.083881"
      rpy="0 0 0" />
    <parent
      link="kl_link" />
    <child
      link="fl_link" />
    <axis
      xyz="1 0 0" />
    <limit
      lower="0"
      upper="0"
      effort="0"
      velocity="0" />
  </joint>
</robot>



<?xml version="1.0"?>
<launch>
  <arg
    name="model" />
  <arg
    name="gui"
    default="False" />
  <param
    name="robot_description"
    textfile="$(find roboturdf_4)/urdf/roboturdf_4.urdf" />
  <param
    name="use_gui"
    value="$(arg gui)" />
  <node
    name="joint_state_publisher"
    pkg="joint_state_publisher"
    type="joint_state_publisher" />
  <node
    name="robot_state_publisher"
    pkg="robot_state_publisher"
    type="robot_state_publisher" />
  <node
    name="rviz"
    pkg="rviz"
    type="rviz"
    args="-d $(find roboturdf_4)/urdf.rviz" />
</launch>

Originally posted by sr_louis on ROS Answers with karma: 13 on 2020-02-18

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

Sorry I missed responding to this earlier, but I think the primary issue is using SolidWorks 2018. There is a bug in service pack 1-4 that causes meshes to be exported improperly. Try installing service pack 5 or upgrading to 2019/2020.


Originally posted by brawner with karma: 581 on 2020-02-22

This answer was ACCEPTED on the original site

Post score: 1


Original comments

Comment by sr_louis on 2020-02-23:
Thanks for answering. I installed SP 5.0 and changed the joint coordinate systems to the same, now the robot appears correctly in RViz and Gazebo. Now I will try to resolve the warning about "dummy link" and errors when trying to use GUI to control joints in RViz.

Thank you!

$\endgroup$

Your Answer

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