0
$\begingroup$

Rosanswers logo

Hello everyone,

I have 2 problems the first is I have created an urdf model of Robot(see image) and when I want to visualize the model in rviz it takes more than 15 min to show, but when I visualize the model in gazebo it doesn't take long but it's slow to respond.

the second is when i change the link position and spawn it in gazebo(takes the change correctly) but when i spawn the model in rviz(showed wrong position compared to gazebo) and vice versa

I am using ROS Kinetic Kame, VMware pro 15, Ubuntu 16.04 LTs

someone can help me.

<?xml version="1.0"?>
<launch>
<arg name="model" />
<include file="$(find gazebo_ros)/launch/empty_world.launch"/>
<param name="robot_description" textfile="$(find mybot_descriptions)/src/urdf/turtle.urdf" />

<param name="use_gui" value="true"/>

  <!-- robot state publisher -->
  <node pkg="robot_state_publisher" type="robot_state_publisher" name="robot_state_publisher">
    <param name="publish_frequency" value="30.0"/>
    <param name="use_gui" value="true"/>
  </node>

  <!-- joint state publisher -->
  <node pkg="joint_state_publisher" type="joint_state_publisher" name="joint_state_publisher">
    <param name="rate" value="30.0"/>
    <param name="use_gui" value="true"/>
  </node>

<node pkg="gazebo_ros" type="spawn_model" name="spawn_tb3" respwan="true" args="param robot-description -urdf -model turtle"/>

<node name="rviz" pkg="rviz" type="rviz" args="-d $(find mybot_descriptions)/src/urdf.rviz" required="true" />

</launch>

<?xml version="1.0" ?>
<robot name="turtlebot3_waffle" ><!--xmlns:xacro="http://ros.org/wiki/xacro">
  <xacro:include filename="$(find turtlebot3_description)/urdf/common_properties.xacro"/>
  <xacro:include filename="$(find turtlebot3_description)/urdf/turtlebot3_waffle.gazebo.xacro"/>

  <xacro:property name="r200_cam_rgb_px" value="0.005"/>
  <xacro:property name="r200_cam_rgb_py" value="0.018"/>
  <xacro:property name="r200_cam_rgb_pz" value="0.013"/>
  <xacro:property name="r200_cam_depth_offset" value="0.01"/>-->

  <link name="base_footprint"/>

  <joint name="base_joint" type="fixed">
    <parent link="base_footprint"/>
    <child link="base_link" />
    <origin xyz="0 0 0" rpy="0 0 0"/>
  </joint>

  <link name="base_link">
    <visual>
    <origin xyz="-0.198 -0.136 -0.027" rpy="0 0 0"/>
      <geometry>
        <mesh filename="package://mybot_descriptions/src/meshes/bases/base.stl" scale="0.001 0.001 0.001"/>
      </geometry>
      <material name="orange"/>
    </visual>

   <collision>
    <origin xyz="-0.064 0 0.400" rpy="0 0 0"/>
<!--      <origin xyz="-0.064 0 0.047" rpy="0 0 0"/>-->
      <geometry>
        <box size="0.266 0.266 0.900"/>
      </geometry>
    </collision>
    
    <inertial>
      <origin xyz="0 0 0" rpy="0 0 0"/>
      <mass value="1.3729096e+00"/>
      <inertia ixx="8.7002718e-03" ixy="-4.7576583e-05" ixz="1.1160499e-04"
               iyy="8.6195418e-03" iyz="-3.5422299e-06"
               izz="1.4612727e-02" />
    </inertial>
  </link>

  <joint name="wheel_left_joint" type="continuous">
    <parent link="base_link"/>
    <child link="wheel_left_link"/>
    <origin xyz="0.0 0.144 0.023" rpy="-1.57 0 0"/>
    <axis xyz="0 0 1"/>
  </joint>

  <link name="wheel_left_link">
    <visual>
      <origin xyz="0 0 0" rpy="1.57 0 0"/>
      <geometry>
        <mesh filename="package://mybot_descriptions/src/meshes/left_tire.stl" scale="0.001 0.001 0.001"/>
      </geometry>
      <material name="green">
      <color rgba="0 1.0 1.0 1.0"/>
    </material>
    </visual>

    <collision>
      <origin xyz="0 0 0" rpy="0 0 0"/>
      <geometry>
        <cylinder length="0.018" radius="0.033"/>
      </geometry>
    </collision>

    <inertial>
      <origin xyz="0 0 0" />
      <mass value="2.8498940e-02" />
      <inertia ixx="1.1175580e-05" ixy="-4.2369783e-11" ixz="-5.9381719e-09"
               iyy="1.1192413e-05" iyz="-1.4400107e-11"
               izz="2.0712558e-05" />
      </inertial>
  </link>

  <joint name="wheel_right_joint" type="continuous">
    <parent link="base_link"/>
    <child link="wheel_right_link"/>
    <origin xyz="0.0 -0.144 0.023" rpy="-1.57 0 0"/>
    <axis xyz="0 0 1"/>
  </joint>

  <link name="wheel_right_link">
    <visual>
      <origin xyz="0 0 0" rpy="1.57 0 0"/>
      <geometry>
        <mesh filename="package://mybot_descriptions/src/meshes/right_tire.stl" scale="0.001 0.001 0.001"/>
      </geometry>
      <material name="green"/>
    </visual>

    <collision>
      <origin xyz="0 0 0" rpy="0 0 0"/>
      <geometry>
        <cylinder length="0.018" radius="0.033"/>
      </geometry>
    </collision>

    <inertial>
      <origin xyz="0 0 0" />
      <mass value="2.8498940e-02" />
      <inertia ixx="1.1175580e-05" ixy="-4.2369783e-11" ixz="-5.9381719e-09"
               iyy="1.1192413e-05" iyz="-1.4400107e-11"
               izz="2.0712558e-05" />
      </inertial>
  </link>
 
  <joint name="wheel_back_left_joint" type="continuous">
    <parent link="base_link"/>
    <child link="wheel_back_left_link"/>
    <!-- <origin xyz="-0.177 0.064 -0.004" rpy="-1.57 0 0"/>-->
    <origin xyz="-0.120 0.145 0.020" rpy="-1.57 0 0"/>
    <axis xyz="0 0 1"/>
  </joint>

  <link name="wheel_back_left_link">
    <visual>
    <origin xyz="0 0 0" rpy="1.57 0 0"/>
     <!-- <origin xyz="0.040 -0.01 0.079" rpy="-1.57 0 0"/>-->
      <geometry>
        <mesh filename="package://mybot_descriptions/src/meshes/left_tire.stl" scale="0.001 0.001 0.001"/>
      </geometry>
      <material name="green">
      <color rgba="0 1.0 1.0 1.0"/>
    </material>
    </visual>

    <collision>
      <origin xyz="0 0 0" rpy="0 0 0"/>
      <geometry>
        <cylinder length="0.018" radius="0.033"/>
      </geometry>
    </collision>

    <inertial>
      <origin xyz="0 0 0" />
      <mass value="2.8498940e-02" />
      <inertia ixx="1.1175580e-05" ixy="-4.2369783e-11" ixz="-5.9381719e-09"
               iyy="1.1192413e-05" iyz="-1.4400107e-11"
               izz="2.0712558e-05" />
      </inertial>
  </link>

  <joint name="wheel_back_right_joint" type="continuous">
    <parent link="base_link"/>
    <child link="wheel_back_right_link"/>
    <origin xyz="-0.120 -0.145 0.020" rpy="-1.57 0 0"/>
    <axis xyz="0 0 1"/>
  </joint>

  <link name="wheel_back_right_link">
    <visual>
    <origin xyz="0 0 0" rpy="-1.57 0 0"/>
    <!--<origin xyz="-0.120 -0.145 0.023" rpy="-1.57 0 0"/>-->
      <geometry>
        <mesh filename="package://mybot_descriptions/src/meshes/right_tire.stl" scale="0.001 0.001 0.001"/>
      </geometry>
      <material name="green"/>
    </visual>

    <collision>
      <origin xyz="0 0 0" rpy="0 0 0"/>
      <geometry>
        <cylinder length="0.018" radius="0.033"/>
      </geometry>
    </collision>

    <inertial>
      <origin xyz="0 0 0" />
      <mass value="2.8498940e-02" />
      <inertia ixx="1.1175580e-05" ixy="-4.2369783e-11" ixz="-5.9381719e-09"
               iyy="1.1192413e-05" iyz="-1.4400107e-11"
               izz="2.0712558e-05" />
      </inertial>
  </link>


  <joint name="imu_joint" type="fixed">
    <parent link="base_link"/>
    <child link="imu_link"/>
    <origin xyz="0.0 0 0.068" rpy="0 0 0"/>
  </joint>

  <link name="imu_link"/>

  <joint name="scan_joint" type="fixed">
    <parent link="base_link"/>
    <child link="base_scan"/>
    <origin xyz="-0.064 0 0.122" rpy="0 0 0"/>
  </joint>

  <link name="base_scan">
    <visual>
      <origin xyz="0 0 0" rpy="0 0 0"/>
      <geometry>
        <mesh filename="package://mybot_descriptions/src/meshes/lds.dae" scale="0.001 0.001 0.001"/>
      </geometry>
        <material name="Orange">
    <color rgba="${255/255} ${108/255} ${10/255} 1.0"/>
  </material>
    </visual>

    <collision>
      <origin xyz="0.015 0 -0.0065" rpy="0 0 0"/>
      <geometry>
        <cylinder length="0.0315" radius="0.055"/>
      </geometry>
    </collision>

    <inertial>
      <mass value="0.114" />
      <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_joint" type="fixed">
        <!--<origin xyz="0.035 0 0.172" rpy="0 0 0"/>-->
    <origin xyz="0.064 -0.065 0.500" rpy="0 0 0"/>
    <parent link="base_link"/>
    <child link="camera_link"/>
  </joint>

  <link name="camera_link">
    <visual>
     <origin xyz="0 0 0" rpy="1.57 0 1.57"/>
      <geometry>
       <mesh filename="package://mybot_descriptions/src/meshes/sensors/astra.dae" />
      </geometry>
    </visual>
    <collision>
      <origin xyz="0.003 0.065 0.007" rpy="0 0 0"/>
      <geometry>
        <box size="0.012 0.132 0.020"/>
      </geometry>
    </collision>

    <!-- This inertial field needs doesn't contain reliable data!! -->
<!--   <inertial>
      <mass value="0.564" />
      <origin xyz="0 0 0" />
      <inertia ixx="0.003881243" ixy="0.0" ixz="0.0"
               iyy="0.000498940" iyz="0.0"
               izz="0.003879257" />
    </inertial>-->
  </link>

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

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

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

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

</robot>

Originally posted by dhaour9x on ROS Answers with karma: 35 on 2019-12-08

Post score: 0

$\endgroup$

2 Answers 2

0
$\begingroup$

Rosanswers logo

You don't supply us with this information, but: did you create the .stl files yourself? If you did: what are their sizes? Could you show us the output of du -csh $(rospack find mybot_descriptions)/src/meshes and ls -al $(rospack find mybot_descriptions)/src/meshes?

Very long loading times are often caused by meshes that are way too detailed, which can happen if you've edited them in tools like SolidWorks (or similar) and then exported them without any further post-processing.

Also:

I am using ROS Kinetic Kame, VMware pro 15, Ubuntu 16.04 LTs

This is not going to help either: VMs are often slow and can have difficulty providing properly accelerated 3D graphics. Both RViz and Gazebo are heavy 3D applications and running them in VMs has caused problems for other users in the past.

It could be RViz is forced to use Software OpenGL, which would make it very slow.

Finally:

the first is I have created an urdf model of Robot(see image)

there is no image in your post.


Originally posted by gvdhoorn with karma: 86574 on 2019-12-08

This answer was ACCEPTED on the original site

Post score: 5

$\endgroup$
0
$\begingroup$

Rosanswers logo

How many triangles are in your meshes? I've only seen delays like this when my robot was way over specified (but even then, maybe 30 seconds to show up).

If it takes you that long, you've probably generated your meshes way too finely. Export them again or downsample them in Meshlab to a reasonable number. Keep in mind rviz is just for visualization and gazebo is (mostly) for that as well, unless you're trying to do some really fancy contact dynamics / generate images with robots in it.

Also running things in a VM is going to be a nightmare and extremely slow with gazebo. I would not recommend this path for any serious development or length of time.


Originally posted by stevemacenski with karma: 8272 on 2019-12-09

This answer was NOT ACCEPTED on the original site

Post score: 1


Original comments

Comment by gvdhoorn on 2019-12-09:
And how is this not exactly what I wrote in my comment? :)

Comment by stevemacenski on 2019-12-09:
Uh, um, some additional context (meshlab, triangles, the fact the mesh doesn't need to be huge)

But yeah, mostly the same. I didn't see your comment until after I answered, then I added the VMWare comment after I read yours and I'd glanced over that in the question.

Comment by gvdhoorn on 2019-12-09:
I posted it as a comment as without more information from the OP, it's all speculation.

Comment by dhaour9x on 2019-12-10:
you're right the problem was the mesh of the robot was very fine and detailed. i just simplified mesh and it works fine. thank you very much

Comment by dhaour9x on 2019-12-10:
the problem was the mesh of the robot was very fine and detailed. i just simplified mesh and it works fine. thank you very much

$\endgroup$

Your Answer

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