Gazebo | Ignition | Community
Ask Your Question
0

How to disable gravity only for a specific model in Gazebo?

asked 2016-05-26 22:16:18 -0600

webvenky gravatar image

updated 2016-05-26 22:39:32 -0600

A similar question has been answered. http://answers.ros.org/question/65991...

However, this only works for the .sdf model files. It does not work for urdf. Kindly help.

<link name="base_link" gravity="0 0 0">
    <gravity>0</gravity>
  </link>

  <joint name="base_joint" type="fixed">
    <origin xyz="0 0 0" rpy="0 0 0" />
    <parent link="base_link" />
    <child link="body_link" />
  </joint>

  <link name="body_link">
    <gravity>0</gravity>
    <inertial>
      <mass value="0.1" />
      <origin xyz="0 0 0" />
      <inertia ixx="1" ixy="0" ixz="0" iyy="1" iyz="0" izz="1" />
    </inertial>

    <visual name="base_visual">
      <origin xyz="0 0 0" rpy="0 0 0" />
      <geometry name="pioneer_geom">
        <mesh filename="package://rotors_description/meshes/simple_airplane1.dae" />
      </geometry>
    </visual>

    <collision>
      <origin xyz="0 0 0" rpy="0 0 0" />
      <geometry>
        <mesh filename="package://rotors_description/meshes/simple_airplane1.dae" />
      </geometry>
    </collision>

  </link>
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2016-05-26 22:44:42 -0600

chapulina gravatar image

It looks like your file is in the URDF format (you use origin instead of pose for example).

<gravity> within a link is specified in SDF, but not in URDF. Luckily, the conversion from URDF to SDF is possible. In order to use SDF tags within your URDF link, use the <gazebo> tag, as explained in this tutorial. It should look something like this:

  <gazebo reference="base_link">
    <gravity>0</gravity>
  </gazebo>
edit flag offensive delete link more

Comments

Thanks a lot! It works. :-)

webvenky gravatar imagewebvenky ( 2016-05-26 22:58:13 -0600 )edit

Does it remain static in the world even if something collide with it? I was looking for something more like the <static> tag.

hbaqueiro gravatar imagehbaqueiro ( 2018-11-05 09:41:14 -0600 )edit

No, it will not remain static, it will just not be affected by gravity. There's no way to set only one link to be static, that tag works only on the model level. You can however make a model static and connect it to a non-static model with a joint.

chapulina gravatar imagechapulina ( 2018-11-05 12:12:57 -0600 )edit

For me the <gravity> tags did not work, this did work however:

<gazebo reference="base_link">
   <turnGravityOff>true</turnGravityOff>
</gazebo>
BrumBrum gravatar imageBrumBrum ( 2020-01-07 02:09:41 -0600 )edit

For me <gazebo> or <turngravityoff> can not stop model to drop down to the ground, in order to ensure model in the air, I fixed it in the world link

  <link name="world"/>

<joint name="fixed" type="fixed">

<parent link="world"/>

<child link="link1"/>

  </joint>
myboyhood gravatar imagemyboyhood ( 2020-05-04 00:04:44 -0600 )edit

I tried both <gravity> and <turngravityoff> but none of them turned gravity off. When I check the generated sdf file it shows that there are two tags defining gravity. Adding the tag in Urdf file doesn't overwrite the default value. it just adds another tag.

<gravity>0</gravity>
<gravity>1</gravity>

Does anyone know how i can overwrite the original tag?

val gravatar imageval ( 2020-08-07 07:29:34 -0600 )edit
Login/Signup to Answer

Question Tools

2 followers

Stats

Asked: 2016-05-26 22:16:18 -0600

Seen: 10,189 times

Last updated: May 26 '16