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 -0500

webvenky gravatar image

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

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 -0500

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 -0500 )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 -0500 )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 -0500 )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 -0500 )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 -0500 )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 -0500 )edit

Hi val, have you found a solution for this problem by now? I assume I am facing the same issue.

th123 gravatar imageth123 ( 2021-01-21 04:04:43 -0500 )edit

Yep I'm hitting this now too (ROS Melodic + Gazebo9)

Related to https://github.com/osrf/sdformat/issu... ?

danzimmerman gravatar imagedanzimmerman ( 2021-02-17 17:18:49 -0500 )edit

@th123<turnGravityOff>1</turnGravityOff> (case-sensitive) is working for me in ROS Melodic. <turngravityoff> all-lowercase doesn't work.

danzimmerman gravatar imagedanzimmerman ( 2021-02-17 17:49:25 -0500 )edit

Question Tools

4 followers

Stats

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

Seen: 16,312 times

Last updated: May 26 '16