Gazebo resources: Tutorials | Q&A | Documentation | Blog

Animated Massless Link in sdf Model

Hello,

I am building a point mass helicopter model in gazebo. I have 2 revolute joints one for each propellers ( main rotor and rear rotor). I am moving the model with using SetLinkState topics. However, when I update the orientation of main chassis due to angular momentum, whole model keeps moving at constant speed. How can i implement a animated model (especially moving rotors) in gazebo?.

Example of my model:

    <?xml version='1.0'?>
<sdf version='1.4'>
  <model name="my_robot">
  <static>false</static>
  <link name='chassis'>
  <gravity>0</gravity>
            <pose>0 0 .8 0 0 0</pose>
            <inertial>
        <pose>0 0 0 0 0 0</pose>
        <mass>10000</mass>
      </inertial>
            <collision name='collision'>
              <geometry>
                <mesh>
            	<scale>.2 .2 .2</scale>
            	<uri>model://test_bot/meshes/heli_body_rear_removed.dae</uri>
          	</mesh>
              </geometry>
            </collision>

            <visual name='visual'>
              <geometry>
          	<mesh>
            	<scale>.2 .2 .2</scale>
            	<uri>model://test_bot/meshes/heli_body_rear_removed.dae</uri>
          	</mesh>
        	</geometry>
            </visual>
  </link>
  <link name="logical_camera_link">
    <pose>0 -.8 0 0 0.785 -1.5707</pose>
    <inertial>
        <pose>0 0 0 0 0 0</pose>
        <mass>0.000000000001</mass>
    </inertial>
    <gravity>0</gravity>
        <sensor name="logical_camera" type="logical_camera">
          <plugin name="logical_camera_plugin" filename="liblogical_camera_plugin.so"/>
          <logical_camera>
            <near>0.55</near>
            <far>50.5</far>
            <horizontal_fov>0.25</horizontal_fov>
            <aspect_ratio>1.8</aspect_ratio>
          </logical_camera>

          <visualize>true</visualize>
          <always_on>true</always_on>
          <update_rate>10</update_rate>
        </sensor>
  </link>
  <joint name='camera_joint' type='fixed'>
    <child>logical_camera_link</child>
    <parent>chassis</parent>
    <axis>
      <use_parent_model_frame>1</use_parent_model_frame>
    </axis>
  </joint>
  <link name="telecom_sensor_link">
    <pose>0 0 0 0 1.5707 -1.5707</pose>
    <inertial>
        <pose>0 0 0 0 0 0</pose>
        <mass>0.0000000001</mass>
    </inertial>
    <gravity>0</gravity>
        <sensor name="logical_camera" type="logical_camera">
          <logical_camera>
            <near>0.55</near>
            <far>50.5</far>
            <horizontal_fov>4.5</horizontal_fov>
            <aspect_ratio>1</aspect_ratio>
          </logical_camera>

          <visualize>true</visualize>
          <always_on>true</always_on>
          <update_rate>10</update_rate>
        </sensor>
  </link>
  <joint name='telecom_sensor_joint' type='fixed'>
    <child>telecom_sensor_link</child>
    <parent>chassis</parent>
    <axis>
      <use_parent_model_frame>1</use_parent_model_frame>
    </axis>
  </joint>
  <link name='rotor_0'>
    <gravity>0</gravity>
    <pose>0 -.55 1.2 0 0 0</pose>
    <inertial>
      <pose>0 0 0 0 0 0</pose>
      <mass>0.0000000001</mass>
      <inertia>
        <ixx>9.75e-07</ixx>
        <ixy>0</ixy>
        <ixz>0</ixz>
        <iyy>0.000273104</iyy>
        <iyz>0</iyz>
        <izz>0.000274004</izz>
      </inertia>
    </inertial>
    <collision name='rotor_0_collision'>
      <pose>0 0 0 0 0 0</pose>
      <geometry>
        <cylinder>
          <length>0.005</length>
          <radius>0.128</radius>
        </cylinder>
      </geometry>
      
    </collision>
    <visual name='rotor_0_visual'>
      <pose>0 0 0 0 0 0</pose>
      <geometry>
        <mesh>
          <scale>.2 .2 .2</scale>
          <uri>model://test_bot/meshes/propeller4.dae</uri>
        </mesh>
      </geometry>
      <material>
        <script>
          <name>Gazebo/Blue</name>
          <uri>file://media/materials/scripts/gazebo.material</uri>
        </script>
      </material>
    </visual>
    <gravity>0</gravity>
    <velocity_decay/>
    <self_collide>0</self_collide>
  </link>
  <joint name='rotor_0_joint' type='revolute'>
    <child>rotor_0</child>
    <parent>chassis</parent>
    <axis>
      <xyz>0 0 1</xyz>
      <limit>
        <lower>-1e+16</lower>
        <upper>1e+16</upper>
      </limit>
      <dynamics>
        <spring_reference>0</spring_reference>
        <spring_stiffness>0</spring_stiffness>
      </dynamics>
      <use_parent_model_frame>1</use_parent_model_frame>
    </axis>
  </joint>
  <link name='rear_rotor_0'>
  <gravity>0</gravity>
      <pose>0 1.95 .87 90 0 0</pose>
      <inertial>
        <pose>0 0 0 0 0 0</pose>s
        <mass>0.000000001</mass>
        <inertia>
          <ixx>9.75e-07</ixx>
          <ixy>0</ixy>
          <ixz>0</ixz>
          <iyy>0.000273104</iyy>
          <iyz>0</iyz>
          <izz>0.000274004</izz>
        </inertia>
      </inertial>
      <collision name='rear_rotor_0_collision'>
        <pose>0 0 0 0 0 0</pose>
        <geometry>
          <cylinder>
            <length>0.005</length>
            <radius>0.128</radius>
          </cylinder>
        </geometry>
      </collision>
      <visual name='rear_rotor_0_visual'>
        <pose>0 0 0 0 0 0</pose>
        <geometry>
          <mesh>
            <scale>.2 .2 .2</scale>
            <uri>model://test_bot/meshes/rear_propeller.dae</uri>
          </mesh>
        </geometry>
        <material>
          <script>
            <name>Gazebo/Red</name>
            <uri>file://media/materials/scripts/gazebo.material</uri>
          </script>
        </material>
      </visual>
      <gravity>0</gravity>
      <velocity_decay/>
      <self_collide>0</self_collide>
    </link>
    <joint name='rear_rotor_0_joint' type='revolute'>
      <child>rear_rotor_0</child>
      <parent>chassis</parent>
      <axis>
        <xyz>1 0 0</xyz>
        <limit>
          <lower>-1e+16</lower>
          <upper>1e+16</upper>
        </limit>
        <dynamics>
          <spring_reference>0</spring_reference>
          <spring_stiffness>0</spring_stiffness>
        </dynamics>
        <use_parent_model_frame>1</use_parent_model_frame>
      </axis>
    </joint>
  </model>
</sdf>

Hi @dogukan_altay, thank you for being a part of the community. I see you posted the same question to Gazebo Answers, which is the right place for technical questions. Please don’t cross-post in the future.

http://answers.gazebosim.org/question/22281/animating-the-link-of-a-sdf-model/