ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

It is really weird that there is no way in gazebo to disable physics gracefully on startup, so people need to find various workarounds to do that. I also found another nasty hack to disable physics (inspired by this answer) and want to share it here.

Disable physics through world SDF: set ode solver iterations to 0.

Example empty.world with disabled physics:

<?xml version="1.0" ?>
<sdf version="1.5">
    <world name="default">
        <gravity>0 0 0</gravity>
        <physics type="ode">
            <max_step_size>0.001</max_step_size>
            <real_time_factor>1</real_time_factor>
            <real_time_update_rate>1000</real_time_update_rate>
            <ode>
                <solver>
                    <type>quick</type>
                    <iters>0</iters> <!-- 0 iterations to stop physics -->
                    <sor>1.4</sor>
                </solver>
                <constraints>
                    <cfm>0</cfm>
                    <erp>1</erp>
                    <contact_max_correcting_vel>0</contact_max_correcting_vel>
                    <contact_surface_layer>0</contact_surface_layer>
                </constraints>
            </ode>
        </physics>

        <!-- A global light source -->
        <include>
            <uri>model://sun</uri>
        </include>
        <!-- A ground plane -->
        <include>
            <uri>model://ground_plane</uri>
        </include>
    </world>
</sdf>