Gazebo | Ignition | Community
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

all link comes to origin

I am facing this issue again and again. Before i solved by modefing the inetia values, now i'm again getting the same problem. Whenever i start gazebo with the model, all the links position comes to zero. image description the urdf file is: <robot name="rrbot" xmlns:xacro="http://www.ros.org/wiki/xacro">

<xacro:property name="PI" value="3.1415926535897931"/> <xacro:property name="mass" value="1"/> <xacro:property name="width" value="0.1"/> <xacro:property name="height1" value="2"/> <xacro:property name="height2" value="1"/> <xacro:property name="height3" value="1"/> <xacro:property name="camera_link" value="0.05"/> <xacro:property name="axel_offset" value="0.05"/>

<xacro:include filename="$(find rrbot_description)/urdf/rrbot.gazebo"/> <xacro:include filename="$(find rrbot_description)/urdf/materials.xacro"/>

<link name="link1"> <collision> <origin xyz="0 0 0" rpy="0 0 0"/> <geometry> <mesh filename="package://rrbot_description/meshes/body_collision.dae"/> </geometry> </collision>

<visual>
  <origin xyz="0 0 0" rpy="0 0 0"/>
  <geometry>
<mesh filename="package://rrbot_description/meshes/body.dae"/>
  </geometry>
</visual>

<inertial>
  <origin xyz="0 0 0" rpy="0 0 0"/>
  <mass value="0.218492"/>
  <inertia
  ixx="0.036767" ixy="0.000193" ixz="-0.000009"
  iyy="0.004774" iyz="0.006783"
  izz="0.035638"/>
</inertial>

</link>

<joint name="joint1" type="continuous"> <parent link="link1"/> <child link="link2"/> <origin xyz="-0.02449 0.10035 0.541866" rpy="0 0 0"/> <axis xyz="0 0 1"/> <dynamics damping="0.7"/> </joint>

<link name="link2"> <collision> <origin xyz="0 0 0" rpy="0 0 0"/> <geometry> <mesh filename="package://rrbot_description/meshes/blade_collision.dae"/> </geometry> </collision>

<visual>
  <origin xyz="0 0 0" rpy="0 0 0"/>
  <geometry>
<mesh filename="package://rrbot_description/meshes/blade.dae"/>
  </geometry>
</visual>

<inertial>
  <origin xyz="0 0 0" rpy="0 0 0"/>
  <mass value="0.011507"/>
  <inertia
  ixx="0.000933" ixy="0.000621" ixz="-0.000010"
  iyy="-0.000036" iyz="-0.000036"
  izz="0.010201"/>
</inertial>

</link>

<joint name="station_joint" type="continuous"> <axis xyz="0 0 1"/> <origin xyz="0 0.716474 -0.32317" rpy="0 0 0"/> <parent link="link1"/> <child link="station_link"/> </joint>

<!-- Weapon station -->

<link name="station_link"> <collision> <origin xyz="0 0 0" rpy="0 0 0"/> <geometry> <box size="0.1 0.1 0.1"/> </geometry> </collision>

<visual>
  <origin xyz="0 0 0" rpy="0 0 0"/>
  <geometry>
    <box size="0.1 0.1 0.1"/>
  </geometry>
  <material name="red"/>
</visual>

<inertial>
  <mass value="0.000005" />
  <origin xyz="0 0 0" rpy="0 0 0"/>
  <inertia ixx="5e-7" ixy="0" ixz="0" iyy="5e-7" iyz="0" izz="5e-7" />
</inertial>

</link>

<joint name="joint2" type="revolute"> <limit effort="1000.0" lower="-1.5708" upper="0.785398" velocity="100"/> <parent link="station_link"/> <child link="link3"/> <origin xyz="0 0 0.1" rpy="0 0 0"/> <axis xyz="1 0 0"/> <dynamics damping="0.7"/> </joint>

<link name="link3"> <collision> <origin xyz="0 0 0" rpy="0 0 0"/> <geometry> <mesh filename="package://rrbot_description/meshes/Ak-47_collision.dae"/> </geometry> </collision>

<visual>
  <origin xyz="0 0 0" rpy="0 0 0"/>
  <geometry>
<mesh filename="package://rrbot_description/meshes/Ak-47.dae"/>
  </geometry>
</visual>

<inertial>
  <origin xyz="0 0 0" rpy="0 0 0"/>
  <mass value="${mass/10}"/>
  <inertia
  ixx="${mass / 120.0 * (width*width + height3*height3)}" ixy="0.0" ixz="0.0"
  iyy="${mass / 120.0 * (height3*height3 + width*width)}" iyz="0.0"
  izz="${mass / 120.0 * (width*width + width*width)}"/>

</inertial> </link>

<joint name="hokuyo_joint" type="fixed"> <axis xyz="0 1 0"/> <origin xyz="0 0 0" rpy="0 0 0"/> <parent link="link3"/> <child link="hokuyo_link"/> </joint>

<link name="hokuyo_link"> <collision> <origin xyz="0 0 0" rpy="0 0 0"/> <geometry> <box size="0.1 0.1 0.1"/> </geometry> </collision>

<visual>
  <origin xyz="0 0 0" rpy="0 0 0"/>
  <geometry>
    <mesh filename="package://rrbot_description/meshes/hokuyo.dae"/>
  </geometry>
</visual>

<inertial>
  <mass value="0.000005" />
  <origin xyz="0 0 0" rpy="0 0 0"/>
  <inertia ixx="5e-7" ixy="0" ixz="0" iyy="5e-7" iyz="0" izz="5e-7" />
</inertial>

</link>

<joint name="camera_joint" type="fixed"> <axis xyz="0 1 0"/> <origin xyz="0 0 0" rpy="0 0 0"/> <parent link="link3"/> <child link="camera_link"/> </joint>

<link name="camera_link"> <collision> <origin xyz="0 0 0" rpy="0 0 1"/> <geometry> <box size="${camera_link} ${camera_link} ${camera_link}"/> </geometry> </collision>

<visual>
  <origin xyz="0 0 0" rpy="0 0 0"/>
  <geometry>
<box size="${camera_link} ${camera_link} ${camera_link}"/>
  </geometry>
  <material name="red"/>
</visual>

<inertial>
  <mass value="1e-5" />
  <origin xyz="0 0 0" rpy="0 0 0"/>
  <inertia ixx="1e-6" ixy="0" ixz="0" iyy="1e-6" iyz="0" izz="1e-6" />
</inertial>

</link>

<joint name="camera_optical_joint" type="fixed"> <origin xyz="0 0 0" rpy="${-pi/2} 0 ${-pi/2}"/> <parent link="camera_link"/> <child link="camera_link_optical"/> </joint>

<link name="camera_link_optical"> </link>

<transmission name="tran1"> <type>transmission_interface/SimpleTransmission</type> <joint name="joint1"> <hardwareinterface>hardware_interface/EffortJointInterface</hardwareinterface> </joint> <actuator name="motor1"> <hardwareinterface>hardware_interface/EffortJointInterface</hardwareinterface> <mechanicalreduction>1</mechanicalreduction> </actuator> </transmission>

<transmission name="tran2"> <type>transmission_interface/SimpleTransmission</type> <joint name="joint2"> <hardwareinterface>hardware_interface/EffortJointInterface</hardwareinterface> </joint> <actuator name="motor2"> <hardwareinterface>hardware_interface/EffortJointInterface</hardwareinterface> <mechanicalreduction>1</mechanicalreduction> </actuator> </transmission>

<transmission name="tran3"> <type>transmission_interface/SimpleTransmission</type> <joint name="station_joint"> <hardwareinterface>hardware_interface/EffortJointInterface</hardwareinterface> </joint> <actuator name="motor3"> <hardwareinterface>hardware_interface/EffortJointInterface</hardwareinterface> <mechanicalreduction>1</mechanicalreduction> </actuator> </transmission>

</robot>

all link comes to origin

I am facing this issue again and again. Before i solved by modefing the inetia values, now i'm again getting the same problem. Whenever i start gazebo with the model, all the links position comes to zero. image description the urdf file is: is:

<?xml version="1.0"?>
<!-- Revolute-Revolute Manipulator -->
<robot name="rrbot" xmlns:xacro="http://www.ros.org/wiki/xacro">

xmlns:xacro="http://www.ros.org/wiki/xacro"> <!-- Constants for robot dimensions --> <xacro:property name="PI" value="3.1415926535897931"/> <xacro:property name="mass" value="1"/> value="1" /> <!-- arbitrary value for mass --> <xacro:property name="width" value="0.1"/> value="0.1" /> <!-- Square dimensions (widthxwidth) of beams --> <xacro:property name="height1" value="2"/> value="2" /> <!-- Link 1 --> <xacro:property name="height2" value="1"/> value="1" /> <!-- Link 2 --> <xacro:property name="height3" value="1"/> value="1" /> <!-- Link 3 --> <xacro:property name="camera_link" value="0.05"/> value="0.05" /> <!-- Size of square 'camera' box --> <xacro:property name="axel_offset" value="0.05"/>

value="0.05" /> <!-- Space btw top of beam and the each joint --> <!-- Import all Gazebo-customization elements, including Gazebo colors --> <xacro:include filename="$(find rrbot_description)/urdf/rrbot.gazebo"/> rrbot_description)/urdf/rrbot.gazebo" /> <!-- Import Rviz colors --> <xacro:include filename="$(find rrbot_description)/urdf/materials.xacro"/>

rrbot_description)/urdf/materials.xacro" /> <!-- Base Link --> <link name="link1"> <collision> <origin xyz="0 0 0" rpy="0 0 0"/> <geometry> <mesh filename="package://rrbot_description/meshes/body_collision.dae"/> </geometry> </collision>

</collision>

    <visual>
  <origin xyz="0 0 0" rpy="0 0 0"/>
    <origin xyz="0 0 0" rpy="0 0 0"/>
      <geometry>
 <mesh filename="package://rrbot_description/meshes/body.dae"/>
   </geometry>
 </visual>

 <inertial>
  <origin xyz="0 0 0" rpy="0 0 0"/>
    <origin xyz="0 0 0" rpy="0 0 0"/>
      <mass value="0.218492"/>
   <inertia
   ixx="0.036767" ixy="0.000193" ixz="-0.000009"
   iyy="0.004774" iyz="0.006783"
   izz="0.035638"/>
 </inertial>

</link>

</link> <joint name="joint1" type="continuous"> <parent link="link1"/> <child link="link2"/> <origin xyz="-0.02449 0.10035 0.541866" rpy="0 0 0"/> <axis xyz="0 0 1"/> <dynamics damping="0.7"/> </joint>

</joint> <!-- Middle Link --> <link name="link2"> <collision> <origin xyz="0 0 0" rpy="0 0 0"/> <geometry> <mesh filename="package://rrbot_description/meshes/blade_collision.dae"/> </geometry> </collision>

</collision>

    <visual>
  <origin xyz="0 0 0" rpy="0 0 0"/>
    <origin xyz="0 0 0" rpy="0 0 0"/>
      <geometry>
 <mesh filename="package://rrbot_description/meshes/blade.dae"/>
   </geometry>
 </visual>

 <inertial>
  <origin xyz="0 0 0" rpy="0 0 0"/>
    <origin xyz="0 0 0" rpy="0 0 0"/>
      <mass value="0.011507"/>
   <inertia
   ixx="0.000933" ixy="0.000621" ixz="-0.000010"
   iyy="-0.000036" iyz="-0.000036"
   izz="0.010201"/>
 </inertial>

</link>

</link> <joint name="station_joint" type="continuous"> <axis xyz="0 0 1"/> 1" /> <origin xyz="0 0.716474 -0.32317" rpy="0 0 0"/> <parent link="link1"/> <child link="station_link"/> </joint>

</joint>


    <!-- Weapon station -->

<link name="station_link"> <collision> <origin xyz="0 0 0" rpy="0 0 0"/> <geometry> <box size="0.1 0.1 0.1"/> </geometry> </collision>

</collision>

    <visual>
  <origin xyz="0 0 0" rpy="0 0 0"/>
    <origin xyz="0 0 0" rpy="0 0 0"/>
      <geometry>
     <box size="0.1 0.1 0.1"/>
   </geometry>
   <material name="red"/>
 </visual>

 <inertial>
   <mass value="0.000005" />
  <origin xyz="0 0 0" rpy="0 0 0"/>
    <origin xyz="0 0 0" rpy="0 0 0"/>
      <inertia ixx="5e-7" ixy="0" ixz="0" iyy="5e-7" iyz="0" izz="5e-7" />
 </inertial>

</link>

</link> <joint name="joint2" type="revolute"> <limit effort="1000.0" lower="-1.5708" upper="0.785398" velocity="100"/> <parent link="station_link"/> <child link="link3"/> <origin xyz="0 0 0.1" rpy="0 0 0"/> <axis xyz="1 0 0"/> <dynamics damping="0.7"/> </joint>

</joint> <!-- Top Link --> <link name="link3"> <collision> <origin xyz="0 0 0" rpy="0 0 0"/> <geometry> <mesh filename="package://rrbot_description/meshes/Ak-47_collision.dae"/> </geometry> </collision>

</collision>

    <visual>
  <origin xyz="0 0 0" rpy="0 0 0"/>
    <origin xyz="0 0 0" rpy="0 0 0"/>
      <geometry>
 <mesh filename="package://rrbot_description/meshes/Ak-47.dae"/>
   </geometry>
 </visual>

 <inertial>
  <origin xyz="0 0 0" rpy="0 0 0"/>
    <origin xyz="0 0 0" rpy="0 0 0"/>
      <mass value="${mass/10}"/>
   <inertia
   ixx="${mass / 120.0 * (width*width + height3*height3)}" ixy="0.0" ixz="0.0"
   iyy="${mass / 120.0 * (height3*height3 + width*width)}" iyz="0.0"
   izz="${mass / 120.0 * (width*width + width*width)}"/>

</inertial> </link>

</link> <joint name="hokuyo_joint" type="fixed"> <axis xyz="0 1 0"/> 0" /> <origin xyz="0 0 0" rpy="0 0 0"/> <parent link="link3"/> <child link="hokuyo_link"/> </joint>

</joint> <!-- Hokuyo Laser --> <link name="hokuyo_link"> <collision> <origin xyz="0 0 0" rpy="0 0 0"/> <geometry> <box size="0.1 0.1 0.1"/> </geometry> </collision>

</collision>

    <visual>
  <origin xyz="0 0 0" rpy="0 0 0"/>
    <origin xyz="0 0 0" rpy="0 0 0"/>
      <geometry>
     <mesh filename="package://rrbot_description/meshes/hokuyo.dae"/>
   </geometry>
 </visual>

 <inertial>
   <mass value="0.000005" />
  <origin xyz="0 0 0" rpy="0 0 0"/>
    <origin xyz="0 0 0" rpy="0 0 0"/>
      <inertia ixx="5e-7" ixy="0" ixz="0" iyy="5e-7" iyz="0" izz="5e-7" />
 </inertial>

</link>

</link> <joint name="camera_joint" type="fixed"> <axis xyz="0 1 0"/> 0" /> <origin xyz="0 0 0" rpy="0 0 0"/> <parent link="link3"/> <child link="camera_link"/> </joint>

</joint> <!-- Camera --> <link name="camera_link"> <collision> <origin xyz="0 0 0" rpy="0 0 1"/> <geometry> <box size="${camera_link} ${camera_link} ${camera_link}"/> </geometry> </collision>

</collision>

    <visual>
  <origin xyz="0 0 0" rpy="0 0 0"/>
    <origin xyz="0 0 0" rpy="0 0 0"/>
      <geometry>
 <box size="${camera_link} ${camera_link} ${camera_link}"/>
   </geometry>
   <material name="red"/>
 </visual>

 <inertial>
   <mass value="1e-5" />
  <origin xyz="0 0 0" rpy="0 0 0"/>
    <origin xyz="0 0 0" rpy="0 0 0"/>
      <inertia ixx="1e-6" ixy="0" ixz="0" iyy="1e-6" iyz="0" izz="1e-6" />
 </inertial>

</link>

</link> <!-- generate an optical frame http://www.ros.org/reps/rep-0103.html#suffix-frames so that ros and opencv can operate on the camera frame correctly --> <joint name="camera_optical_joint" type="fixed"> <!-- these values have to be these values otherwise the gazebo camera image won't be aligned properly with the frame it is supposedly originating from --> <origin xyz="0 0 0" rpy="${-pi/2} 0 ${-pi/2}"/> <parent link="camera_link"/> <child link="camera_link_optical"/> </joint>

</joint> <link name="camera_link_optical"> </link>

</link> <transmission name="tran1"> <type>transmission_interface/SimpleTransmission</type> <joint name="joint1"> <hardwareinterface>hardware_interface/EffortJointInterface</hardwareinterface> <hardwareInterface>hardware_interface/EffortJointInterface</hardwareInterface> </joint> <actuator name="motor1"> <hardwareinterface>hardware_interface/EffortJointInterface</hardwareinterface> <mechanicalreduction>1</mechanicalreduction> <hardwareInterface>hardware_interface/EffortJointInterface</hardwareInterface> <mechanicalReduction>1</mechanicalReduction> </actuator> </transmission>

</transmission> <transmission name="tran2"> <type>transmission_interface/SimpleTransmission</type> <joint name="joint2"> <hardwareinterface>hardware_interface/EffortJointInterface</hardwareinterface> <hardwareInterface>hardware_interface/EffortJointInterface</hardwareInterface> </joint> <actuator name="motor2"> <hardwareinterface>hardware_interface/EffortJointInterface</hardwareinterface> <mechanicalreduction>1</mechanicalreduction> <hardwareInterface>hardware_interface/EffortJointInterface</hardwareInterface> <mechanicalReduction>1</mechanicalReduction> </actuator> </transmission>

</transmission> <transmission name="tran3"> <type>transmission_interface/SimpleTransmission</type> <joint name="station_joint"> <hardwareinterface>hardware_interface/EffortJointInterface</hardwareinterface> <hardwareInterface>hardware_interface/EffortJointInterface</hardwareInterface> </joint> <actuator name="motor3"> <hardwareinterface>hardware_interface/EffortJointInterface</hardwareinterface> <mechanicalreduction>1</mechanicalreduction> <hardwareInterface>hardware_interface/EffortJointInterface</hardwareInterface> <mechanicalReduction>1</mechanicalReduction> </actuator> </transmission>

</robot>

</transmission> </robot>

all link comes to origin

I am facing this issue again and again. Before i solved by modefing the inetia values, now i'm again getting the same problem. Whenever i start gazebo with the model, all the links position comes to zero. zero. and i just found out that it only happens when i load a controller for that joint. image description the urdf file is:

<?xml version="1.0"?>
<!-- Revolute-Revolute Manipulator -->
<robot name="rrbot" xmlns:xacro="http://www.ros.org/wiki/xacro">

  <!-- Constants for robot dimensions -->
  <xacro:property name="PI" value="3.1415926535897931"/>
  <xacro:property name="mass" value="1" /> <!-- arbitrary value for mass -->
  <xacro:property name="width" value="0.1" /> <!-- Square dimensions (widthxwidth) of beams -->
  <xacro:property name="height1" value="2" /> <!-- Link 1 -->
  <xacro:property name="height2" value="1" /> <!-- Link 2 -->
  <xacro:property name="height3" value="1" /> <!-- Link 3 -->
  <xacro:property name="camera_link" value="0.05" /> <!-- Size of square 'camera' box -->
  <xacro:property name="axel_offset" value="0.05" /> <!-- Space btw top of beam and the each joint -->

  <!-- Import all Gazebo-customization elements, including Gazebo colors -->
  <xacro:include filename="$(find rrbot_description)/urdf/rrbot.gazebo" />
  <!-- Import Rviz colors -->
  <xacro:include filename="$(find rrbot_description)/urdf/materials.xacro" />



  <!-- Base Link -->
  <link name="link1">
    <collision>
      <origin xyz="0 0 0" rpy="0 0 0"/>
      <geometry>
    <mesh filename="package://rrbot_description/meshes/body_collision.dae"/>
      </geometry>
    </collision>

    <visual>
      <origin xyz="0 0 0" rpy="0 0 0"/>
      <geometry>
    <mesh filename="package://rrbot_description/meshes/body.dae"/>
      </geometry>
    </visual>

    <inertial>
      <origin xyz="0 0 0" rpy="0 0 0"/>
      <mass value="0.218492"/>
      <inertia
      ixx="0.036767" ixy="0.000193" ixz="-0.000009"
      iyy="0.004774" iyz="0.006783"
      izz="0.035638"/>
    </inertial>
  </link>

  <joint name="joint1" type="continuous">
    <parent link="link1"/>
    <child link="link2"/>
    <origin xyz="-0.02449 0.10035 0.541866" rpy="0 0 0"/>
    <axis xyz="0 0 1"/>
    <dynamics damping="0.7"/>
  </joint>

  <!-- Middle Link -->
  <link name="link2">
    <collision>
      <origin xyz="0 0 0" rpy="0 0 0"/>
      <geometry>
    <mesh filename="package://rrbot_description/meshes/blade_collision.dae"/>
      </geometry>
    </collision>

    <visual>
      <origin xyz="0 0 0" rpy="0 0 0"/>
      <geometry>
    <mesh filename="package://rrbot_description/meshes/blade.dae"/>
      </geometry>
    </visual>

    <inertial>
      <origin xyz="0 0 0" rpy="0 0 0"/>
      <mass value="0.011507"/>
      <inertia
      ixx="0.000933" ixy="0.000621" ixz="-0.000010"
      iyy="-0.000036" iyz="-0.000036"
      izz="0.010201"/>
    </inertial>
  </link>

  <joint name="station_joint" type="continuous">
    <axis xyz="0 0 1" />
    <origin xyz="0 0.716474 -0.32317" rpy="0 0 0"/>
    <parent link="link1"/>
    <child link="station_link"/>
  </joint>


    <!-- Weapon station -->
  <link name="station_link">
    <collision>
      <origin xyz="0 0 0" rpy="0 0 0"/>
      <geometry>
    <box size="0.1 0.1 0.1"/>
      </geometry>
    </collision>

    <visual>
      <origin xyz="0 0 0" rpy="0 0 0"/>
      <geometry>
        <box size="0.1 0.1 0.1"/>
      </geometry>
      <material name="red"/>
    </visual>

    <inertial>
      <mass value="0.000005" />
      <origin xyz="0 0 0" rpy="0 0 0"/>
      <inertia ixx="5e-7" ixy="0" ixz="0" iyy="5e-7" iyz="0" izz="5e-7" />
    </inertial>
  </link>

  <joint name="joint2" type="revolute">
    <limit effort="1000.0" lower="-1.5708" upper="0.785398" velocity="100"/>
    <parent link="station_link"/>
    <child link="link3"/>
    <origin xyz="0 0 0.1" rpy="0 0 0"/>
    <axis xyz="1 0 0"/>
    <dynamics damping="0.7"/>
  </joint>

  <!-- Top Link -->
  <link name="link3">
    <collision>
      <origin xyz="0 0 0" rpy="0 0 0"/>
      <geometry>
    <mesh filename="package://rrbot_description/meshes/Ak-47_collision.dae"/>
      </geometry>
    </collision>

    <visual>
      <origin xyz="0 0 0" rpy="0 0 0"/>
      <geometry>
    <mesh filename="package://rrbot_description/meshes/Ak-47.dae"/>
      </geometry>
    </visual>

    <inertial>
      <origin xyz="0 0 0" rpy="0 0 0"/>
      <mass value="${mass/10}"/>
      <inertia
      ixx="${mass / 120.0 * (width*width + height3*height3)}" ixy="0.0" ixz="0.0"
      iyy="${mass / 120.0 * (height3*height3 + width*width)}" iyz="0.0"
      izz="${mass / 120.0 * (width*width + width*width)}"/>
</inertial>
  </link>

  <joint name="hokuyo_joint" type="fixed">
    <axis xyz="0 1 0" />
    <origin xyz="0 0 0" rpy="0 0 0"/>
    <parent link="link3"/>
    <child link="hokuyo_link"/>
  </joint>

  <!-- Hokuyo Laser -->
  <link name="hokuyo_link">
    <collision>
      <origin xyz="0 0 0" rpy="0 0 0"/>
      <geometry>
    <box size="0.1 0.1 0.1"/>
      </geometry>
    </collision>

    <visual>
      <origin xyz="0 0 0" rpy="0 0 0"/>
      <geometry>
        <mesh filename="package://rrbot_description/meshes/hokuyo.dae"/>
      </geometry>
    </visual>

    <inertial>
      <mass value="0.000005" />
      <origin xyz="0 0 0" rpy="0 0 0"/>
      <inertia ixx="5e-7" ixy="0" ixz="0" iyy="5e-7" iyz="0" izz="5e-7" />
    </inertial>
  </link>

  <joint name="camera_joint" type="fixed">
    <axis xyz="0 1 0" />
    <origin xyz="0 0 0" rpy="0 0 0"/>
    <parent link="link3"/>
    <child link="camera_link"/>
  </joint>

  <!-- Camera -->
  <link name="camera_link">
    <collision>
      <origin xyz="0 0 0" rpy="0 0 1"/>
      <geometry>
    <box size="${camera_link} ${camera_link} ${camera_link}"/>
      </geometry>
    </collision>

    <visual>
      <origin xyz="0 0 0" rpy="0 0 0"/>
      <geometry>
    <box size="${camera_link} ${camera_link} ${camera_link}"/>
      </geometry>
      <material name="red"/>
    </visual>

    <inertial>
      <mass value="1e-5" />
      <origin xyz="0 0 0" rpy="0 0 0"/>
      <inertia ixx="1e-6" ixy="0" ixz="0" iyy="1e-6" iyz="0" izz="1e-6" />
    </inertial>
  </link>

  <!-- generate an optical frame http://www.ros.org/reps/rep-0103.html#suffix-frames
      so that ros and opencv can operate on the camera frame correctly -->
  <joint name="camera_optical_joint" type="fixed">
    <!-- these values have to be these values otherwise the gazebo camera image
        won't be aligned properly with the frame it is supposedly originating from -->
    <origin xyz="0 0 0" rpy="${-pi/2} 0 ${-pi/2}"/>
    <parent link="camera_link"/>
    <child link="camera_link_optical"/>
  </joint>

  <link name="camera_link_optical">
  </link>

  <transmission name="tran1">
    <type>transmission_interface/SimpleTransmission</type>
    <joint name="joint1">
      <hardwareInterface>hardware_interface/EffortJointInterface</hardwareInterface>
    </joint>
    <actuator name="motor1">
      <hardwareInterface>hardware_interface/EffortJointInterface</hardwareInterface>
      <mechanicalReduction>1</mechanicalReduction>
    </actuator>
  </transmission>

  <transmission name="tran2">
    <type>transmission_interface/SimpleTransmission</type>
    <joint name="joint2">
      <hardwareInterface>hardware_interface/EffortJointInterface</hardwareInterface>
    </joint>
    <actuator name="motor2">
      <hardwareInterface>hardware_interface/EffortJointInterface</hardwareInterface>
      <mechanicalReduction>1</mechanicalReduction>
    </actuator>
  </transmission>

  <transmission name="tran3">
    <type>transmission_interface/SimpleTransmission</type>
    <joint name="station_joint">
      <hardwareInterface>hardware_interface/EffortJointInterface</hardwareInterface>
    </joint>
    <actuator name="motor3">
      <hardwareInterface>hardware_interface/EffortJointInterface</hardwareInterface>
      <mechanicalReduction>1</mechanicalReduction>
    </actuator>
  </transmission>

</robot>

all link comes to origin

I am facing this issue again and again. Before i solved by modefing the inetia values, now i'm again getting the same problem. Whenever i start gazebo with the model, all the links position comes to zero. and i just found out that if i put the pid value as 000, it only happens when i load a don't hapens, in this case what p i d values should i use. current controller for that joint. image description the urdf file is:configuration values are:

<?xml version="1.0"?>
<!-- Revolute-Revolute Manipulator -->
<robot name="rrbot" xmlns:xacro="http://www.ros.org/wiki/xacro">

  <!-- Constants for robot dimensions -->
  <xacro:property name="PI" value="3.1415926535897931"/>
  <xacro:property name="mass" value="1" /> <!-- arbitrary value for mass -->
  <xacro:property name="width" value="0.1" /> <!-- Square dimensions (widthxwidth) of beams -->
  <xacro:property name="height1" value="2" /> <!-- Link 1 -->
  <xacro:property name="height2" value="1" /> <!-- Link 2 -->
  <xacro:property name="height3" value="1" /> <!-- Link 3 -->
  <xacro:property name="camera_link" value="0.05" /> <!-- Size of square 'camera' box -->
  <xacro:property name="axel_offset" value="0.05" /> <!-- Space btw top of beam and the each rrbot:
  # Publish all joint -->

  <!-- Import all Gazebo-customization elements, including Gazebo colors -->
  <xacro:include filename="$(find rrbot_description)/urdf/rrbot.gazebo" />
  <!-- Import Rviz colors -->
  <xacro:include filename="$(find rrbot_description)/urdf/materials.xacro" />



  <!-- Base Link -->
  <link name="link1">
    <collision>
      <origin xyz="0 0 0" rpy="0 0 0"/>
      <geometry>
    <mesh filename="package://rrbot_description/meshes/body_collision.dae"/>
      </geometry>
    </collision>

    <visual>
      <origin xyz="0 0 0" rpy="0 0 0"/>
      <geometry>
    <mesh filename="package://rrbot_description/meshes/body.dae"/>
      </geometry>
    </visual>

    <inertial>
      <origin xyz="0 0 0" rpy="0 0 0"/>
      <mass value="0.218492"/>
      <inertia
      ixx="0.036767" ixy="0.000193" ixz="-0.000009"
      iyy="0.004774" iyz="0.006783"
      izz="0.035638"/>
    </inertial>
  </link>

  <joint name="joint1" type="continuous">
    <parent link="link1"/>
    <child link="link2"/>
    <origin xyz="-0.02449 0.10035 0.541866" rpy="0 0 0"/>
    <axis xyz="0 0 1"/>
    <dynamics damping="0.7"/>
  </joint>

  <!-- Middle Link -->
  <link name="link2">
    <collision>
      <origin xyz="0 0 0" rpy="0 0 0"/>
      <geometry>
    <mesh filename="package://rrbot_description/meshes/blade_collision.dae"/>
      </geometry>
    </collision>

    <visual>
      <origin xyz="0 0 0" rpy="0 0 0"/>
      <geometry>
    <mesh filename="package://rrbot_description/meshes/blade.dae"/>
      </geometry>
    </visual>

    <inertial>
      <origin xyz="0 0 0" rpy="0 0 0"/>
      <mass value="0.011507"/>
      <inertia
      ixx="0.000933" ixy="0.000621" ixz="-0.000010"
      iyy="-0.000036" iyz="-0.000036"
      izz="0.010201"/>
    </inertial>
  </link>

  <joint name="station_joint" type="continuous">
    <axis xyz="0 0 1" />
    <origin xyz="0 0.716474 -0.32317" rpy="0 0 0"/>
    <parent link="link1"/>
    <child link="station_link"/>
  </joint>


    <!-- Weapon station -->
  <link name="station_link">
    <collision>
      <origin xyz="0 0 0" rpy="0 0 0"/>
      <geometry>
    <box size="0.1 0.1 0.1"/>
      </geometry>
    </collision>

    <visual>
      <origin xyz="0 0 0" rpy="0 0 0"/>
      <geometry>
        <box size="0.1 0.1 0.1"/>
      </geometry>
      <material name="red"/>
    </visual>

    <inertial>
      <mass value="0.000005" />
      <origin xyz="0 0 0" rpy="0 0 0"/>
      <inertia ixx="5e-7" ixy="0" ixz="0" iyy="5e-7" iyz="0" izz="5e-7" />
    </inertial>
  </link>

  <joint name="joint2" type="revolute">
    <limit effort="1000.0" lower="-1.5708" upper="0.785398" velocity="100"/>
    <parent link="station_link"/>
    <child link="link3"/>
    <origin xyz="0 0 0.1" rpy="0 0 0"/>
    <axis xyz="1 0 0"/>
    <dynamics damping="0.7"/>
  </joint>

  <!-- Top Link -->
  <link name="link3">
    <collision>
      <origin xyz="0 0 0" rpy="0 0 0"/>
      <geometry>
    <mesh filename="package://rrbot_description/meshes/Ak-47_collision.dae"/>
      </geometry>
    </collision>

    <visual>
      <origin xyz="0 0 0" rpy="0 0 0"/>
      <geometry>
    <mesh filename="package://rrbot_description/meshes/Ak-47.dae"/>
      </geometry>
    </visual>

    <inertial>
      <origin xyz="0 0 0" rpy="0 0 0"/>
      <mass value="${mass/10}"/>
      <inertia
      ixx="${mass / 120.0 * (width*width + height3*height3)}" ixy="0.0" ixz="0.0"
      iyy="${mass / 120.0 * (height3*height3 + width*width)}" iyz="0.0"
      izz="${mass / 120.0 * (width*width + width*width)}"/>
</inertial>
  </link>

  <joint name="hokuyo_joint" type="fixed">
    <axis xyz="0 1 0" />
    <origin xyz="0 0 0" rpy="0 0 0"/>
    <parent link="link3"/>
    <child link="hokuyo_link"/>
  </joint>

  <!-- Hokuyo Laser -->
  <link name="hokuyo_link">
    <collision>
      <origin xyz="0 0 0" rpy="0 0 0"/>
      <geometry>
    <box size="0.1 0.1 0.1"/>
      </geometry>
    </collision>

    <visual>
      <origin xyz="0 0 0" rpy="0 0 0"/>
      <geometry>
        <mesh filename="package://rrbot_description/meshes/hokuyo.dae"/>
      </geometry>
    </visual>

    <inertial>
      <mass value="0.000005" />
      <origin xyz="0 0 0" rpy="0 0 0"/>
      <inertia ixx="5e-7" ixy="0" ixz="0" iyy="5e-7" iyz="0" izz="5e-7" />
    </inertial>
  </link>

  <joint name="camera_joint" type="fixed">
    <axis xyz="0 1 0" />
    <origin xyz="0 0 0" rpy="0 0 0"/>
    <parent link="link3"/>
    <child link="camera_link"/>
  </joint>

  <!-- Camera -->
  <link name="camera_link">
    <collision>
      <origin xyz="0 0 0" rpy="0 0 1"/>
      <geometry>
    <box size="${camera_link} ${camera_link} ${camera_link}"/>
      </geometry>
    </collision>

    <visual>
      <origin xyz="0 0 0" rpy="0 0 0"/>
      <geometry>
    <box size="${camera_link} ${camera_link} ${camera_link}"/>
      </geometry>
      <material name="red"/>
    </visual>

    <inertial>
      <mass value="1e-5" />
      <origin xyz="0 0 0" rpy="0 0 0"/>
      <inertia ixx="1e-6" ixy="0" ixz="0" iyy="1e-6" iyz="0" izz="1e-6" />
    </inertial>
  </link>

  <!-- generate an optical frame http://www.ros.org/reps/rep-0103.html#suffix-frames
      so that ros and opencv can operate on the camera frame correctly -->
  <joint name="camera_optical_joint" type="fixed">
    <!-- these values have to be these values otherwise the gazebo camera image
        won't be aligned properly with the frame it is supposedly originating from -->
    <origin xyz="0 0 0" rpy="${-pi/2} 0 ${-pi/2}"/>
    <parent link="camera_link"/>
    <child link="camera_link_optical"/>
  </joint>

  <link name="camera_link_optical">
  </link>

  <transmission name="tran1">
    <type>transmission_interface/SimpleTransmission</type>
    <joint name="joint1">
      <hardwareInterface>hardware_interface/EffortJointInterface</hardwareInterface>
    </joint>
    <actuator name="motor1">
      <hardwareInterface>hardware_interface/EffortJointInterface</hardwareInterface>
      <mechanicalReduction>1</mechanicalReduction>
    </actuator>
  </transmission>

  <transmission name="tran2">
    <type>transmission_interface/SimpleTransmission</type>
    <joint name="joint2">
      <hardwareInterface>hardware_interface/EffortJointInterface</hardwareInterface>
    </joint>
    <actuator name="motor2">
      <hardwareInterface>hardware_interface/EffortJointInterface</hardwareInterface>
      <mechanicalReduction>1</mechanicalReduction>
    </actuator>
  </transmission>

  <transmission name="tran3">
    <type>transmission_interface/SimpleTransmission</type>
    <joint name="station_joint">
      <hardwareInterface>hardware_interface/EffortJointInterface</hardwareInterface>
    </joint>
    <actuator name="motor3">
      <hardwareInterface>hardware_interface/EffortJointInterface</hardwareInterface>
      <mechanicalReduction>1</mechanicalReduction>
    </actuator>
  </transmission>

</robot>
states -----------------------------------
  joint_state_controller:
    type: joint_state_controller/JointStateController
    publish_rate: 50  

  # Position Controllers ---------------------------------------
  joint1_effort_controller:
    type: effort_controllers/JointEffortController
    joint: joint1
    pid: {p: 0.0, i: 0.0, d: 0.0}
  joint2_position_controller:
    type: effort_controllers/JointPositionController
    joint: joint2
    pid: {p: 100.0, i: 0.01, d: 10.0}
  joint3_position_controller:
    type: effort_controllers/JointPositionController
    joint: station_joint
    pid: {p: 100.0, i: 0.01, d: 10.0}

image description

all link comes to origin

I am facing this issue again and again. Before i solved by modefing the inetia values, now i'm again getting the same problem. Whenever i start gazebo with the model, all the links position comes to zero. and i just found out that if i put the pid value as 000, it don't hapens, in this case what p i d values should i use. current controller configuration values are:

rrbot:
  # Publish all joint states -----------------------------------
  joint_state_controller:
    type: joint_state_controller/JointStateController
    publish_rate: 50  

  # Position Controllers ---------------------------------------
  joint1_effort_controller:
    type: effort_controllers/JointEffortController
    joint: joint1
    pid: {p: 0.0, i: 0.0, d: 0.0}
  joint2_position_controller:
    type: effort_controllers/JointPositionController
    joint: joint2
    pid: {p: 100.0, i: 0.01, d: 10.0}
  joint3_position_controller:
    type: effort_controllers/JointPositionController
    joint: station_joint
    pid: {p: 100.0, i: 0.01, d: 10.0}

this also happens after few seconds the model has loaded properly in gazebo. the model starts to shake after 10-15 seconds and than everything goes to origin.
image description