0
$\begingroup$

I have a problem in spawning the robot which is made with solidworks_urdf_exporter. The robot is able to view in RVIZ but gazebo was crash when i spawned it. I dont know is that the problem with the urdf file or gazebo. Does anyone have the same problem? I have tried to write the urdf file which have simple shape and doesnt contain any mesh file, and It run quite well. Here are some files in my package:

URDF of the robot:

<?xml version="1.0" encoding="utf-8"?>
<robot
  name="assem_robot_v2">
  <link
    name="base_link">
    <inertial>
      <origin
        xyz="8.9816E-05 0.0041274 -4.164E-19"
        rpy="0 0 0" />
      <mass
        value="15" />
      <inertia
        ixx="0.3595"
        ixy="3.3572E-06"
        ixz="1.6641E-19"
        iyy="0.35965"
        iyz="2.2506E-17"
        izz="0.71855" />
    </inertial>
    <visual>
      <origin
        xyz="0 0 0"
        rpy="0 0 0" />
      <geometry>
        <mesh
          filename="package://assem_robot_v2/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://assem_robot_v2/meshes/base_link.STL" />
      </geometry>
    </collision>
  </link>
  <link
    name="link_1">
    <inertial>
      <origin
        xyz="0 -0.052824 0.00048194"
        rpy="0 0 0" />
      <mass
        value="5" />
      <inertia
        ixx="0.011147"
        ixy="1.025E-19"
        ixz="-4.4496E-20"
        iyy="0.0037437"
        iyz="-8.1217E-05"
        izz="0.011713" />
    </inertial>
    <visual>
      <origin
        xyz="0 0 0"
        rpy="0 0 0" />
      <geometry>
        <mesh
          filename="package://assem_robot_v2/meshes/link_1.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://assem_robot_v2/meshes/link_1.STL" />
      </geometry>
    </collision>
  </link>
  <joint
    name="joint_base_1"
    type="continuous">
    <origin
      xyz="-0.21213 -0.21213 0"
      rpy="1.5708 0 0" />
    <parent
      link="base_link" />
    <child
      link="link_1" />
    <axis
      xyz="0 1 0" />
  </joint>
  <link
    name="wheel_1">
    <inertial>
      <origin
        xyz="0 -1.3878E-17 -5.5511E-17"
        rpy="0 0 0" />
      <mass
        value="2" />
      <inertia
        ixx="0.0012954"
        ixy="1.9991E-20"
        ixz="-1.846E-20"
        iyy="0.00077087"
        iyz="8.1315E-20"
        izz="0.00077087" />
    </inertial>
    <visual>
      <origin
        xyz="0 0 0"
        rpy="0 0 0" />
      <geometry>
        <mesh
          filename="package://assem_robot_v2/meshes/wheel_1.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://assem_robot_v2/meshes/wheel_1.STL" />
      </geometry>
    </collision>
  </link>
  <joint
    name="joint_wheel_1"
    type="continuous">
    <origin
      xyz="0 -0.19 0"
      rpy="0.34644 0 0" />
    <parent
      link="link_1" />
    <child
      link="wheel_1" />
    <axis
      xyz="1 0 0" />
  </joint>
  <link
    name="link_2">
    <inertial>
      <origin
        xyz="0 -0.052824 0.00048194"
        rpy="0 0 0" />
      <mass
        value="5" />
      <inertia
        ixx="0.011147"
        ixy="8.0762E-20"
        ixz="3.928E-19"
        iyy="0.0037437"
        iyz="-8.1217E-05"
        izz="0.011713" />
    </inertial>
    <visual>
      <origin
        xyz="0 0 0"
        rpy="0 0 0" />
      <geometry>
        <mesh
          filename="package://assem_robot_v2/meshes/link_2.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://assem_robot_v2/meshes/link_2.STL" />
      </geometry>
    </collision>
  </link>
  <joint
    name="joint_base_2"
    type="continuous">
    <origin
      xyz="0.212132034355964 -0.212132034355964 0"
      rpy="1.5707963267949 0 0" />
    <parent
      link="base_link" />
    <child
      link="link_2" />
    <axis
      xyz="0 1 0" />
  </joint>
  <link
    name="wheel_2">
    <inertial>
      <origin
        xyz="5.5511E-17 -1.1102E-16 0"
        rpy="0 0 0" />
      <mass
        value="2" />
      <inertia
        ixx="0.0012954"
        ixy="4.8218E-20"
        ixz="2.1759E-20"
        iyy="0.00077087"
        iyz="5.421E-20"
        izz="0.00077087" />
    </inertial>
    <visual>
      <origin
        xyz="0 0 0"
        rpy="0 0 0" />
      <geometry>
        <mesh
          filename="package://assem_robot_v2/meshes/wheel_2.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://assem_robot_v2/meshes/wheel_2.STL" />
      </geometry>
    </collision>
  </link>
  <joint
    name="joint_wheel_2"
    type="continuous">
    <origin
      xyz="0 -0.19 0"
      rpy="-0.377057232399195 0 0" />
    <parent
      link="link_2" />
    <child
      link="wheel_2" />
    <axis
      xyz="1 0 0" />
  </joint>
  <link
    name="link_3">
    <inertial>
      <origin
        xyz="0 -0.052824 0.00048194"
        rpy="0 0 0" />
      <mass
        value="5" />
      <inertia
        ixx="0.011147"
        ixy="4.3167E-20"
        ixz="1.1491E-19"
        iyy="0.0037437"
        iyz="-8.1217E-05"
        izz="0.011713" />
    </inertial>
    <visual>
      <origin
        xyz="0 0 0"
        rpy="0 0 0" />
      <geometry>
        <mesh
          filename="package://assem_robot_v2/meshes/link_3.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://assem_robot_v2/meshes/link_3.STL" />
      </geometry>
    </collision>
  </link>
  <joint
    name="joint_base_3"
    type="continuous">
    <origin
      xyz="-0.212132034355964 0.212132034355964 0"
      rpy="1.5707963267949 0 0" />
    <parent
      link="base_link" />
    <child
      link="link_3" />
    <axis
      xyz="0 1 0" />
  </joint>
  <link
    name="wheel_3">
    <inertial>
      <origin
        xyz="0 9.7145E-17 -5.5511E-17"
        rpy="0 0 0" />
      <mass
        value="2" />
      <inertia
        ixx="0.0012954"
        ixy="-3.5382E-20"
        ixz="9.898E-21"
        iyy="0.00077087"
        iyz="-5.421E-20"
        izz="0.00077087" />
    </inertial>
    <visual>
      <origin
        xyz="0 0 0"
        rpy="0 0 0" />
      <geometry>
        <mesh
          filename="package://assem_robot_v2/meshes/wheel_3.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://assem_robot_v2/meshes/wheel_3.STL" />
      </geometry>
    </collision>
  </link>
  <joint
    name="joint_wheel_3"
    type="continuous">
    <origin
      xyz="0 -0.19 0"
      rpy="-1.00039004378222 0 0" />
    <parent
      link="link_3" />
    <child
      link="wheel_3" />
    <axis
      xyz="1 0 0" />
  </joint>
  <link
    name="link_4">
    <inertial>
      <origin
        xyz="0 -0.052824 0.00048194"
        rpy="0 0 0" />
      <mass
        value="5" />
      <inertia
        ixx="0.011147"
        ixy="1.0676E-19"
        ixz="4.041E-19"
        iyy="0.0037437"
        iyz="-8.1217E-05"
        izz="0.011713" />
    </inertial>
    <visual>
      <origin
        xyz="0 0 0"
        rpy="0 0 0" />
      <geometry>
        <mesh
          filename="package://assem_robot_v2/meshes/link_4.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://assem_robot_v2/meshes/link_4.STL" />
      </geometry>
    </collision>
  </link>
  <joint
    name="joint_base_4"
    type="continuous">
    <origin
      xyz="0.21213 0.21213 0"
      rpy="1.5708 0 0" />
    <parent
      link="base_link" />
    <child
      link="link_4" />
    <axis
      xyz="0 1 0" />
  </joint>
  <link
    name="wheel_4">
    <inertial>
      <origin
        xyz="-5.5511E-17 5.5511E-17 2.7756E-17"
        rpy="0 0 0" />
      <mass
        value="2" />
      <inertia
        ixx="0.0012954"
        ixy="-3.1801E-20"
        ixz="-6.3444E-21"
        iyy="0.00077087"
        iyz="-2.0329E-20"
        izz="0.00077087" />
    </inertial>
    <visual>
      <origin
        xyz="0 0 0"
        rpy="0 0 0" />
      <geometry>
        <mesh
          filename="package://assem_robot_v2/meshes/wheel_4.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://assem_robot_v2/meshes/wheel_4.STL" />
      </geometry>
    </collision>
  </link>
  <joint
    name="joint_wheel_4"
    type="continuous">
    <origin
      xyz="0 -0.19 0"
      rpy="-1.6462 0 0" />
    <parent
      link="link_4" />
    <child
      link="wheel_4" />
    <axis
      xyz="1 0 0" />
  </joint>
</robot>

Rviz launch file:

<launch>
    <let name="urdf_path"
        value="$(find-pkg-share assem_robot_v2)/urdf/assem_robot_v2.urdf" />
    <node pkg="robot_state_publisher" exec="robot_state_publisher">
        <param name="robot_description"
                value="$(command 'xacro $(var urdf_path)')" />
    </node>

    <node pkg="joint_state_publisher_gui" exec="joint_state_publisher_gui" />

    <node pkg="rviz2" exec="rviz2" output="screen" />
</launch>

Gazebo launch file:

[![<launch>
    <let name="urdf_path"
        value="$(find-pkg-share assem_robot_v2)/urdf/assem_robot_v2.urdf" />
    <node pkg="robot_state_publisher" exec="robot_state_publisher">
        <param name="robot_description"
                value="$(command 'xacro $(var urdf_path)')" />
    </node>

    <include file="$(find-pkg-share gazebo_ros)/launch/gazebo.launch.py" />

    <node pkg="gazebo_ros" exec="spawn_entity.py"
        args="-topic robot_description -entity assem_robot_v2" />
</launch>][1]][1]

RVIZ

$\endgroup$
1
  • $\begingroup$ Hello! You should remove the joint state publisher gui from the rviz launch file and add just the joint state publisher(not GUI) if you are launching the gazebo. Gazebo will publish the joint state. and also use sim_time = true, as you are using the simulation. $\endgroup$
    – Hem92j
    Feb 19 at 11:06

0

Your Answer

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