0
$\begingroup$

My Robot is not loading on Gazebo although loading fine on rviz2. Below is my code. On gazebo, only leg_link is loading not any other links. Although on the side panel under models all the links and the joints are showing fine. This is my first time modelling a robot. Any solution will be appreciated. Thank you.

URDF FILE:

<?xml version="1.0"?>
<robot name="giraff_robot">
    <material name="red">
        <color rgba="1 0 0 1"/>
    </material>
    <material name="blue">
        <color rgba="0 0 1 1"/>
    </material>


    <link name="world">
        <origin rpy="0 0 0" xyz="0 0 0"/>
    </link>
    <link name="base_link">
        <visual> 
            <geometry>
                <box size="0.1 0.1 0.1"/>
            </geometry>
            <material name="red"/>
        </visual>
        <collision>
            <geometry>
                <box size="0.1 0.1 0.1"/>
            </geometry>
            <origin xyz="0 0 0"/>
        </collision>
        <inertial>
            <mass value="1.0"/>
            <origin xyz="0 0 0"/>
            <inertia ixx="0.1" ixy="0" ixz="0" iyy="0.1" iyz="0" izz="0.1"/>
        </inertial>
    </link>
    <link name="leg_link">
        <visual>
            <geometry>
                <cylinder length="0.6" radius="0.5"/>
            </geometry>
            <material name="red"/>
        </visual>
        <collision>
            <geometry>
                <cylinder length="0.6" radius="0.5"/>
            </geometry>
            <origin xyz="0 0 0"/>
        </collision>
        <inertial>
            <mass value="1.0"/>
            <origin xyz="0 0 0"/>
            <inertia ixx="0.1" ixy="0" ixz="0" iyy="0.1" iyz="0" izz="0.1"/>
        </inertial>
    </link> 
    <link name="arm_link">
        <visual>
            <geometry>
                <cylinder length="0.6" radius="0.5"/>
            </geometry>
            <material name="red"/>
        </visual> 
        <collision>
            <geometry>
                <cylinder length="0.6" radius="0.5"/>
            </geometry>
            <origin xyz="0 0 0"/>
        </collision>
        <inertial>
            <mass value="1.0"/>
            <origin xyz="0 0 0"/>
            <inertia ixx="0.1" ixy="0" ixz="0" iyy="0.1" iyz="0" izz="0.1"/>
        </inertial>
    </link>
    <link name="end_effector">
        <visual>
            <geometry>
                <cylinder length="0.6" radius="0.5"/>
            </geometry>
            <material name="red"/>
        </visual> 
        <collision>
            <geometry>
                <cylinder length="0.6" radius="0.5"/>
            </geometry>
            <origin xyz="0 0 0"/>
        </collision>
        <inertial>
            <mass value="1.0"/>
            <origin xyz="0 0 0"/>
            <inertia ixx="0.1" ixy="0" ixz="0" iyy="0.1" iyz="0" izz="0.1"/>
        </inertial>
    </link>
    <link name="tool_mic">
        <visual>
            <geometry>
                <cylinder length="0.6" radius="0.5"/>
            </geometry>
            <material name="red"/>
        </visual> 
        <collision>
            <geometry>
                <cylinder length="0.6" radius="0.5"/>
            </geometry>
            <origin xyz="0 0 0"/>
        </collision>
        <inertial>
            <mass value="1.0"/>
            <origin xyz="0 0 0"/>
            <inertia ixx="0.1" ixy="0" ixz="0" iyy="0.1" iyz="0" izz="0.1"/>
        </inertial>
    </link>


    <joint name="base_joint" type="revolute">
        <parent link="world"/>
        <child link="base_link"/>
        <origin rpy="0 0 0" xyz="0 0 0"/>
        <axis xyz="1 0 0" />
        <safety_controller k_position="3.1416" k_velocity="1000.0" k_effort="1000.0"/>
        <calibration rising="0.0" falling="0.0"/>
        <dynamics damping="0.0" friction="0.0"/>
        <limit lower="-3.1416" upper="3.1416" effort="1000.0" velocity="1000.0" />
        <visual>
            <geometry>
                <sphere radius="0.5"/>
            </geometry>
            <material name="blue"/>
        </visual> 
    </joint>
    <joint name="base_spherical_joint" type="revolute">
        <parent link="base_link"/>
        <child link="leg_link"/>
        <origin xyz="0 0 0" rpy="0 0 0"/>
        <axis xyz="1 0 0" />
        <safety_controller k_position="3.1416" k_velocity="1000.0" k_effort="1000.0"/>
        <calibration rising="0.0" falling="0.0"/>
        <dynamics damping="0.0" friction="0.0"/>
        <limit lower="-3.1416" upper="3.1416" effort="1000.0" velocity="1000.0" />
        <visual>
            <geometry>
                <sphere radius="0.5"/>
            </geometry>
            <material name="blue"/>
        </visual> 
    </joint>
    <joint name="leg_joint" type="prismatic">
        <parent link="leg_link"/>
        <child link="arm_link"/>
        <origin xyz="0 0 0" rpy="0 0 0"/>
        <limit lower="0.0" upper="100.0" effort="1000.0" velocity="1000.0" />
        <safety_controller k_position="100.0" k_velocity="1000.0" k_effort="1000.0"/>
        <calibration rising="0.0" falling="0.0"/>
        <dynamics damping="0.1" friction="0.0"/>
        <visual>
            <geometry>
                <box size="0.1 0.2 0.6"/>
            </geometry>
            <material name="blue"/>
        </visual> 
    </joint>
    <joint name="arm_joint" type="revolute">
        <parent link="arm_link"/>
        <child link="end_effector"/>
        <axis xyz="1 0 0" />
        <origin xyz="0 0 0" rpy="0 0 0"/>
        <safety_controller k_position="3.1416" k_velocity="1000.0" k_effort="1000.0"/>
        <calibration rising="0.0" falling="0.0"/>
        <dynamics damping="0.0" friction="0.0"/>
        <limit lower="-3.1416" upper="3.1416" effort="1000.0" velocity="1000.0" />
        <visual>
            <geometry>
                <sphere radius="0.5"/>
            </geometry>
            <material name="blue"/>
        </visual> 
    </joint>
    <joint name="end_effector_joint" type="revolute">
        <parent link="end_effector"/>
        <child link="tool_mic"/>
        <axis xyz="0 1 0" />
        <origin xyz="0 0 0" rpy="0 0 0"/>
        <safety_controller k_position="0.5236" k_velocity="1000.0" k_effort="1000.0"/>
        <calibration rising="0.0" falling="0.0"/>
        <dynamics damping="0.0" friction="0.0"/>
        <limit lower="0.0" upper="0.5236" effort="1000.0" velocity="1000.0" />
        <stiffness value="0.0"/>
        <visual>
            <geometry>
                <box size="0.6 0.1 0.2"/>
            </geometry>
            <material name="blue"/>
        </visual> 
    </joint>

    <gazebo reference="base_link">
       <material>Gazebo/Red</material>
   </gazebo>
   <gazebo reference="leg_link">
       <material>Gazebo/Red</material>
   </gazebo>
   <gazebo reference="arm_link">
       <material>Gazebo/Red</material>
   </gazebo>
   <gazebo reference="end_effector">
       <material>Gazebo/Red</material>
   </gazebo>
   <gazebo reference="tool_mic">
       <material>Gazebo/Red</material>
   </gazebo>
   <gazebo reference="base_joint">
       <material>Gazebo/Blue</material>
   </gazebo>
   <gazebo reference="base_spherical_joint">
       <material>Gazebo/Blue</material>
   </gazebo>
   <gazebo reference="leg_joint">
       <material>Gazebo/Blue</material>
   </gazebo>
   <gazebo reference="arm_joint">
       <material>Gazebo/Blue</material>
   </gazebo>
   <gazebo reference="end_effector_joint">
       <material>Gazebo/Blue</material>
   </gazebo>

    <gazebo>
        <plugin name="joint_state_publisher" filename="libgazebo_ros_joint_state_publisher.so">
            <robotNamespace>/giraff_robot</robotNamespace>
            <jointName>base_joint, base_spherical_joint, leg_joint, arm_joint, end_effector_joint</jointName>
            <updateRate>100.0</updateRate>
            <alwaysOn>true</alwaysOn>
        </plugin>
        <plugin name="gazebo_ros_control" filename="libgazebo_ros_control.so">
            <robotNamespace>/giraff_robot</robotNamespace>
        </plugin>
        <plugin name="joint_pose_trajectory_controller" filename="libgazebo_ros_joint_pose_trajectory.so">
        <!-- Parameters for the joint pose trajectory controller -->
            <robotNamespace>/giraff_robot</robotNamespace>
            <jointName>base_joint, base_spherical_joint, leg_joint, arm_joint, end_effector_joint</jointName>
            <updateRate>50.0</updateRate>
            <trajectoryTopic>/giraff_robot/joint_trajectory</trajectoryTopic>
            <robotBaseFrame>base_link</robotBaseFrame>
            <robotTipFrame>tool_mic</robotTipFrame>
            <maxJointDifference>0.1</maxJointDifference>
        </plugin>
    </gazebo>
</robot>

```
$\endgroup$

1 Answer 1

0
$\begingroup$
<?xml version="1.0"?>
<link name="world">
    <origin rpy="0 0 0" xyz="0 0 0"/>
</link>
<link name="base_link">
    <visual> 
        <geometry>
            <box size="0.1 0.1 0.1"/>
        </geometry>
        <material name="red"/>
    </visual>
    <collision>
        <geometry>
            <box size="0.1 0.1 0.1"/>
        </geometry>
        <origin xyz="0 0 0"/>
    </collision>
    <inertial>
        <mass value="1.0"/>
        <origin xyz="0 0 0"/>
        <inertia ixx="0.1" ixy="0" ixz="0" iyy="0.1" iyz="0" izz="0.1"/>
    </inertial>
</link>
<link name="leg_link">
    <visual>
        <geometry>
            <cylinder length="0.6" radius="0.5"/>
        </geometry>
        <material name="red"/>
    </visual>
    <collision>
        <geometry>
            <cylinder length="0.6" radius="0.5"/>
        </geometry>
        <origin xyz="0 0 0"/>
    </collision>
    <inertial>
        <mass value="1.0"/>
        <origin xyz="0 0 0"/>
        <inertia ixx="0.1" ixy="0" ixz="0" iyy="0.1" iyz="0" izz="0.1"/>
    </inertial>
</link> 
<link name="arm_link">
    <visual>
        <geometry>
            <cylinder length="0.6" radius="0.5"/>
        </geometry>
        <material name="red"/>
    </visual> 
    <collision>
        <geometry>
            <cylinder length="0.6" radius="0.5"/>
        </geometry>
        <origin xyz="0 0 0"/>
    </collision>
    <inertial>
        <mass value="1.0"/>
        <origin xyz="0 0 0"/>
        <inertia ixx="0.1" ixy="0" ixz="0" iyy="0.1" iyz="0" izz="0.1"/>
    </inertial>
</link>
<link name="end_effector">
    <visual>
        <geometry>
            <cylinder length="0.6" radius="0.5"/>
        </geometry>
        <material name="red"/>
    </visual> 
    <collision>
        <geometry>
            <cylinder length="0.6" radius="0.5"/>
        </geometry>
        <origin xyz="0 0 0"/>
    </collision>
    <inertial>
        <mass value="1.0"/>
        <origin xyz="0 0 0"/>
        <inertia ixx="0.1" ixy="0" ixz="0" iyy="0.1" iyz="0" izz="0.1"/>
    </inertial>
</link>
<link name="tool_mic">
    <visual>
        <geometry>
            <cylinder length="0.6" radius="0.5"/>
        </geometry>
        <material name="red"/>
    </visual> 
    <collision>
        <geometry>
            <cylinder length="0.6" radius="0.5"/>
        </geometry>
        <origin xyz="0 0 0"/>
    </collision>
    <inertial>
        <mass value="1.0"/>
        <origin xyz="0 0 0"/>
        <inertia ixx="0.1" ixy="0" ixz="0" iyy="0.1" iyz="0" izz="0.1"/>
    </inertial>
</link>

<joint name="base_joint" type="revolute">
    <parent link="world"/>
    <child link="base_link"/>
    <origin rpy="0 0 0" xyz="0 0 0"/>
    <axis xyz="1 0 0" />
    <safety_controller k_position="3.1416" k_velocity="1000.0" k_effort="1000.0"/>
    <calibration rising="0.0" falling="0.0"/>
    <dynamics damping="0.0" friction="0.0"/>
    <limit lower="-3.1416" upper="3.1416" effort="1000.0" velocity="1000.0" />
    <visual>
        <geometry>
            <sphere radius="0.5"/>
        </geometry>
        <material name="blue"/>
    </visual> 
</joint>
<joint name="base_spherical_joint" type="revolute">
    <parent link="base_link"/>
    <child link="leg_link"/>
    <origin xyz="0 0 0" rpy="0 0 0"/>
    <axis xyz="1 0 0" />
    <safety_controller k_position="3.1416" k_velocity="1000.0" k_effort="1000.0"/>
    <calibration rising="0.0" falling="0.0"/>
    <dynamics damping="0.0" friction="0.0"/>
    <limit lower="-3.1416" upper="3.1416" effort="1000.0" velocity="1000.0" />
    <visual>
        <geometry>
            <sphere radius="0.5"/>
        </geometry>
        <material name="blue"/>
    </visual> 
</joint>
<joint name="leg_joint" type="prismatic">
    <parent link="leg_link"/>
    <child link="arm_link"/>
    <origin xyz="0 0 0" rpy="0 0 0"/>
    <limit lower="0.0" upper="100.0" effort="1000.0" velocity="1000.0" />
    <safety_controller k_position="100.0" k_velocity="1000.0" k_effort="1000.0"/>
    <calibration rising="0.0" falling="0.0"/>
    <dynamics damping="0.1" friction="0.0"/>
    <visual>
        <geometry>
            <box size="0.1 0.2 0.6"/>
        </geometry>
        <material name="blue"/>
    </visual> 
</joint>
<joint name="arm_joint" type="revolute">
    <parent link="arm_link"/>
    <child link="end_effector"/>
    <axis xyz="1 0 0" />
    <origin xyz="0 0 0" rpy="0 0 0"/>
    <safety_controller k_position="3.1416" k_velocity="1000.0" k_effort="1000.0"/>
    <calibration rising="0.0" falling="0.0"/>
    <dynamics damping="0.0" friction="0.0"/>
    <limit lower="-3.1416" upper="3.1416" effort="1000.0" velocity="1000.0" />
    <visual>
        <geometry>
            <sphere radius="0.5"/>
        </geometry>
        <material name="blue"/>
    </visual> 
</joint>
<joint name="end_effector_joint" type="revolute">
    <parent link="end_effector"/>
    <child link="tool_mic"/>
    <axis xyz="0 1 0" />
    <origin xyz="0 0 0" rpy="0 0 0"/>
    <safety_controller k_position="0.5236" k_velocity="1000.0" k_effort="1000.0"/>
    <calibration rising="0.0" falling="0.0"/>
    <dynamics damping="0.0" friction="0.0"/>
    <limit lower="0.0" upper="0.5236" effort="1000.0" velocity="1000.0" />
    <stiffness value="0.0"/>
    <visual>
        <geometry>
            <box size="0.6 0.1 0.2"/>
        </geometry>
        <material name="blue"/>
    </visual> 
</joint>

<gazebo reference="base_link">
   <material>red</material>
red red red red blue blue blue blue blue
<gazebo>
    <plugin name="joint_state_publisher" filename="libgazebo_ros_joint_state_publisher.so">
        <robotNamespace>/giraff_robot</robotNamespace>
        <jointName>base_joint,base_spherical_joint,leg_joint,arm_joint,end_effector_joint</jointName>
        <updateRate>100.0</updateRate>
        <alwaysOn>true</alwaysOn>
    </plugin>
    <plugin name="gazebo_ros_control" filename="libgazebo_ros_control.so">
        <robotNamespace>/giraff_robot</robotNamespace>
    </plugin>
    <plugin name="joint_pose_trajectory_controller" filename="libgazebo_ros_joint_pose_trajectory.so">
    <!-- Parameters for the joint pose trajectory controller -->
        <robotNamespace>/giraff_robot</robotNamespace>
        <jointName>base_joint,base_spherical_joint,leg_joint,arm_joint,end_effector_joint</jointName>
        <updateRate>50.0</updateRate>
        <trajectoryTopic>/giraff_robot/joint_trajectory</trajectoryTopic>
        <robotBaseFrame>base_link</robotBaseFrame>
        <robotTipFrame>tool_mic</robotTipFrame>
        <maxJointDifference>0.1</maxJointDifference>
    </plugin>
</gazebo>

Changes made:

  • Corrected material references in the tags by removing the "Gazebo/" prefix and using the actual material names ("red" and "blue").

  • Updated the tag in the joint_state_publisher plugin to have comma-separated joint names without spaces.

$\endgroup$
1
  • $\begingroup$ Thanks. But it doesn't solve the issue. $\endgroup$
    – Fc0001
    Feb 21 at 17:35

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.