ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

Black scene in Gazebo when launching robot

asked 2021-03-22 18:14:25 -0500

pablo.arandarod gravatar image

I've been trying to spawn a robot that I designed through SolidWorks in Gazebo through a launch file. I've been able, after testing with other urdf files, to isolate the problem in the urdf file of my robot. I've been checking and rechecking, rebuilt, retried, but I haven't been able to find it. I don't know if there is any additional tag that I need to put or what.

The file is the following one:

    <?xml version="1.0" encoding="utf-8"?>
<!-- This URDF was automatically created by SolidWorks to URDF Exporter! Originally created by Stephen Brawner (brawner@gmail.com)
     Commit Version: 1.6.0-1-g15f4949  Build Version: 1.6.7594.29634
     For more information, please see http://wiki.ros.org/sw_urdf_exporter -->
<robot
  name="robot" xmlns:xacro="http://ros.org/wiki/xacro">

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

  <link
    name="base_link">
    <inertial>
      <origin
        xyz="0.0123124347014089 0.0505768275758483 0.15"
        rpy="0 0 0" />
      <mass
        value="0.630838996758129" />
      <inertia
        ixx="0.000486003425974024"
        ixy="-4.0867892138948E-20"
        ixz="-1.48375522376699E-20"
        iyy="0.00152536968068318"
        iyz="-1.84823168117317E-21"
        izz="0.00132299502191583" />
    </inertial>
    <visual>
      <origin
        xyz="0 0 0"
        rpy="0 0 0" />
      <geometry>
        <mesh
          filename="package://urdf_screencast/meshes/base_link.STL" />
      </geometry>
      <material
        name="">
        <color
          rgba="0.749019607843137 0.749019607843137 0.749019607843137 1" />
      </material>
    </visual>
    <collision>
      <origin
        xyz="0 0 0"
        rpy="0 0 0" />
      <geometry>
        <mesh
          filename="package://urdf_screencast/meshes/base_link.STL" />
      </geometry>
    </collision>
  </link>

  <link
    name="Link_1">
    <inertial>
      <origin
        xyz="0.0494537742604109 0.0123643555558083 0.0416713225379099"
        rpy="0 0 0" />
      <mass
        value="0.0589092038804175" />
      <inertia
        ixx="5.20170683662542E-05"
        ixy="-2.9517247336885E-07"
        ixz="3.25086601912495E-07"
        iyy="0.000116905037934805"
        iyz="1.38108194550258E-08"
        izz="7.57088192052892E-05" />
    </inertial>
    <visual>
      <origin
        xyz="0 0 0"
        rpy="0 0 0" />
      <geometry>
        <mesh
          filename="package://urdf_screencast/meshes/Link_1.STL" />
      </geometry>
      <material
        name="">
        <color
          rgba="0.749019607843137 0.749019607843137 0.749019607843137 1" />
      </material>
    </visual>
    <collision>
      <origin
        xyz="0 0 0"
        rpy="0 0 0" />
      <geometry>
        <mesh
          filename="package://urdf_screencast/meshes/Link_1.STL" />
      </geometry>
    </collision>
  </link>

  <joint
    name="fix_bottom_up"
    type="fixed">
    <origin
      xyz="0.10878 -0.03875 0.09475"
      rpy="1.5708 0 3.1416" />
    <parent
      link="base_link" />
    <child
      link="Link_1" />
    <axis
      xyz="0 0 1" />
  </joint>

  <link
    name="Link_2">
    <inertial>
      <origin
        xyz="-0.0525323569937009 0.051803889250599 0.0412124918069813"
        rpy="0 0 0" />
      <mass
        value="0.0237376231761265" />
      <inertia
        ixx="1.70730388713891E-05"
        ixy="1.06258051836124E-08"
        ixz="4.35505916910561E-07"
        iyy="5.0620665601632E-05"
        iyz="1.32281442514884E-07"
        izz="3.48311372724787E-05" />
    </inertial>
    <visual>
      <origin
        xyz="0 0 0"
        rpy="0 0 0" />
      <geometry>
        <mesh
          filename="package://urdf_screencast/meshes/Link_2.STL" />
      </geometry>
      <material
        name="">
        <color
          rgba="0.749019607843137 0.749019607843137 0.749019607843137 1" />
      </material>
    </visual>
    <collision>
      <origin
        xyz="0 ...
(more)
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2021-03-26 16:34:10 -0500

shonigmann gravatar image

When there isn't any help from the terminal where you're launching gazebo (set the output to verbose and look there first if you haven't already), I tend to find the most reliable way, albeit a bit tedious, is to comment out or remove parts of the URDF until the model is loaded in gazebo properly. You can do this in a sort of "binary search" way to save time (e.g. comment out the second half of the file, if it works you know the problem is in the second half, if not try the first half, then keep sub-dividing until you find the offending lines).

In your case, just taking a quick look, I think you might want to start by taking a look at the gazebo control plugin at the top of your file. Since you tagged your question with ROS2, I think you will want to use gazebo_ros2_control (which may require you to install relevant packages) instead of gazebo_ros_control (the plugin from ROS1). I have had similar issues with gazebo crashing or resulting in a black screen when plugin imports have gone awry.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2021-03-22 18:14:25 -0500

Seen: 447 times

Last updated: Mar 22 '21