Hello,
First, I'm using ROS Indigo with Gazebo 2. To simulate a helium balloon attached to a ground robot in Gazebo, I add a prismatic joint and a balloon link to a pre-existing robot model, and I disable the gravity for the balloon link. However, when I spawn it into Gazebo, it automatically re-enables the gravity for my balloon link... so the balloon crashes on the robot.
Simplified version of my URDF file :
<?xml version="1.0"?>
<robot name="my_robot">
<!-- Cube base link -->
<link name="base_link">
<inertial>
<mass value="1"/>
<inertia ixx="1" ixy="0" ixz="0" iyy="1" iyz="0" izz="1"/>
</inertial>
<visual>
<origin xyz="0 0 0.5" rpy="0 0 0"/>
<geometry>
<box size="1 1 1"/>
</geometry>
<material name="white"/>
</visual>
<collision>
<origin xyz="0 0 0.5" rpy="0 0 0"/>
<geometry>
<box size="1 1 1"/>
</geometry>
</collision>
</link>
<gazebo reference="base_link">
<material>Gazebo/White</material>
</gazebo>
<!-- Joint between cube and balloon -->
<joint name="balloon_joint" type="prismatic">
<origin xyz="0 0 3.0" rpy="0 -1.57 0" />
<parent link="base_link" />
<child link="balloon_link"/>
<limit lower="-3" upper="10" effort="10" velocity="5"/>
<gravity>0</gravity>
</joint>
<gazebo reference="balloon_joint"/>
<!-- Balloon link -->
<link name="balloon_link">
<inertial>
<mass value="1"/>
<inertia ixx="1" ixy="0" ixz="0" iyy="1" iyz="0" izz="1"/>
</inertial>
<visual>
<origin xyz="1 0 0" rpy="0 0 0" />
<geometry>
<sphere radius="1" />
</geometry>
<material name="blue" />
</visual>
<gravity>0</gravity>
<collision>
<origin xyz="1 0 0" rpy="0 0 0" />
<geometry>
<sphere radius="1" />
</geometry>
</collision>
</link>
<gazebo reference="balloon_link">
<material>Gazebo/Blue</material>
<gravity>0</gravity>
</gazebo>
</robot>
with the launch file:
<?xml version="1.0"?>
<launch>
<arg name="world_name" default="worlds/empty.world"/>
<include file="$(find gazebo_ros)/launch/empty_world.launch">
<arg name="world_name" value="$(arg world_name)"/>
<arg name="paused" value="false"/>
<arg name="use_sim_time" value="true"/>
<arg name="gui" value="true"/>
<arg name="headless" value="false"/>
<arg name="debug" value="false"/>
</include>
<param name="robot_description" textfile="$(find playground)/urdf/description.urdf"/>
<node name="spawn_model" pkg="gazebo_ros" type="spawn_model" output="screen"
args="$-unpause -urdf -param robot_description -model base_link"/>
</launch>
When I roslaunch the launch file, the balloon has crashed on the cube; it's clear that gravity has been re-enabled for the balloon, since if I make a rosservice call to apply an upward force to the balloon, it will fall again on the cube.
I figured out that, when I convert this URDF into a SDF file using gzsdf, Gazebo automatically overrides my gravity tags. I tried to remove the "1" tags of the SDF and directly spawn the SDF file into Gazebo; however, robot-state-publisher didn't work anymore (it only accepts URDF files), so it's not a solution for me.
How can I prevent Gazebo from automatically re-enabling gravity for my balloon link?
Thanks.
Originally posted by jbarrau on Gazebo Answers with karma: 3 on 2015-05-24
Post score: 0