Ask Your Question
0

Model on RViz / Gazebo with wrong orientation and incorrect links' position! How to fix?

asked 2020-02-18 20:53:15 -0500

sr_louis gravatar image

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 (brawner@gmail.com) 
     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" /> ...
(more)
edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted
1

answered 2020-02-22 16:24:51 -0500

brawner gravatar image

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.

edit flag offensive delete link more

Comments

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!

sr_louis gravatar image sr_louis  ( 2020-02-23 14:47:12 -0500 )edit
0

answered 2020-02-22 16:18:11 -0500

sr_louis gravatar image

I solved this problem partially, changed it and put the same coordinate system for all links. Now the robot appears whole, but it still appears lying in RViz and Gazebo when I connect it to ROS using this code on URDF file

  <gazebo>
    <plugin name="gazebo_ros_control" filename="libgazebo_ros_control.so">
      <robotNamespace>/</robotNamespace>
    </plugin>
  </gazebo>

Without the code, the robot appears standing on Gazebo at least, sliding over simulation time...

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2020-02-18 20:53:15 -0500

Seen: 94 times

Last updated: Feb 22