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

[ROS1, Gazebo] URDF doesn't work on Gazebo

asked 2022-05-26 02:48:05 -0500

richaard19 gravatar image

Hi everyone, I'm quietly new to Gazebo, and I need to spawn my robot in it. I wrote the URDF file by hand, and it works fine in MATLAB, and also in Rviz, where I can actuate the joints without any issue. By the way, trying to import it in Gazebo, it just appears as a model (on the left, through the true structure of the system), but it doesn't spawn in the simulation. I tried to launch it both with the "manual" method (launching an empty world before and then spwaning the robot) and with a complete launch file. Can anyone help me?

<?xml version="1.0"?>

<robot name="my_robot" xmlns:xacro="http://ros.org/wiki/xacro">

   <material name="red">
          <color rgba="1.0 0 0 1.0"/>
      </material>



<material name="qbmove/flange">
    <color rgba="0.0 0.5 0.8 1.0"/>
  </material>

  <material name="qbmove/cube">
    <color rgba="0.35 0.35 0.35 1.0"/>
  </material>

  <material name="qbmove/shaft">
    <color rgba="0.8 0.8 0.8 1.0"/>
  </material>

  <material name="qbmove/default">
    <color rgba="0.35 0.35 0.35 1.0"/>
  </material>

  <material name="SoftBlue">
    <color rgba="0.0 0.0 0.8 0.9"/>
  </material>

  <material name="SoftLightBlue">
    <color rgba="0.0 0.4 1.0 1.0"/>
  </material>

  <material name="wheel">
    <color rgba="0.50 0.50 0.50 1.0"/>
  </material>


  <link name="base_link">
    <inertial>
      <mass value="0.00000001"/>
      <inertia ixx="0.00000001" ixy="0" ixz="0" iyy="0.00000001" iyz="0" izz="0.00000001"/>
      <origin rpy="0 0 0" xyz="0 0 0"/>
    </inertial>
  </link>

  <joint name="rot_x" type="revolute">
    <axis xyz="1 0 0"/>
    <limit effort="50.0" lower="0" upper="+1.57075" velocity="50.0"/>
    <origin rpy="0 0 0" xyz="0 0 0"/>
    <parent link="base_link"/>
    <child link="body"/>
  </joint>

  <link name="body">
    <visual>
      <material name="SoftBlue"/>
      <geometry>
        <cylinder radius="0.04" length="0.74"/>
      </geometry>
      <origin rpy="0 0 0" xyz="0 0.248 0.50"/>
    </visual>
    <inertial>
      <origin xyz="0 0.248 0.50"/>
      <mass value="12.787"/>
      <inertia ixx="0" ixy="0" ixz="0" iyy="2.33" iyz="0" izz="2.33"/>
    </inertial>
    <collision>
      <geometry>
        <cylinder radius="0.04" length="0.74"/>
      </geometry>
      <origin rpy="0 0 0" xyz="0 0.248 0.50"/>
    </collision>
  </link>
  <gazebo reference="body">
    <material>Gazebo/Blue</material>    
  </gazebo> 

  <link name="upper_axle">
    <visual>
      <material name="SoftBlue"/>
      <geometry>
        <cylinder radius="0.02" length="0.368"/>
      </geometry>
      <origin rpy="-1.57075 0 0" xyz="0 0 0"/>
    </visual>
    <inertial>
      <mass value="1e-8"/>
      <inertia ixx="1e-8" ixy="0" ixz="0" iyy="1e-8" iyz="0" izz ...
(more)
edit retag flag offensive close merge delete

Comments

1

Can you check this when "Collisions" is marked as visible? Maybe it's not loading the materials correctly. Please add your launch file and an empty Gazebo world with the model added.

ljaniec gravatar image ljaniec  ( 2022-05-29 11:36:15 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted
0

answered 2022-05-30 08:38:41 -0500

richaard19 gravatar image

Thanks for your answers. I solved the problem just changing the root link from "base_link" to "world". Now it's working fine, thanks for your help. I am still wondering if it is important to have the root's tag (at least the inertial one), but right now I am using it without tags. Do you mind if I point out another issue? Wheels are allowed to rotate, but they have any effects, both in Gazebo and Rviz. Any suggestions, please?

edit flag offensive delete link more

Comments

2

It would be best to just ask a new question and link it here

ljaniec gravatar image ljaniec  ( 2022-05-30 08:44:37 -0500 )edit
0

answered 2022-05-29 05:01:21 -0500

Robo_guy gravatar image

Hi @richaard19, your urdf files looks fine so I think there could be some issue in the launch file due to which the robot is not spawning in the simulation. Did you refer to any tutorials before doing this? If not then refer to this - http://wiki.ros.org/simulator_gazebo/.... Also please share your launch file so that if there is any issue in that we can solve it.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2022-05-25 10:56:57 -0500

Seen: 152 times

Last updated: May 30 '22