Robot not loading on Gazebo

16 views Asked by At

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>

0

There are 0 answers