Possible bug when applying Physics Material while creating Ground Plane

Isaac Sim version: 2022.2.0
While trying to modify the friction parameters via code of the ground plane in my simulations I noticed that these changes were not being applied in the environment. Specifically, I noticed that although the PhysicsMaterial associated with the GroundPlane was being created, this one was not being applied to its corresponding collision plane.
Looking into the source code to understand the creation of the objects in more detail I found that inside the GroundPlane class in omni.isaac.core.objects.ground_plane there was a suspicious line of code at line number 117 of its definition file. The line appears in the following section:

        if z_position is not None:
            position = self._xform_prim._backend_utils.create_tensor_from_list(
                [0, 0, z_position], dtype="float32", device=self._xform_prim._device
            )
            self._xform_prim.set_world_pose(position=position)
            self._xform_prim.set_default_state(position=position)
            self._collision_prim.set_world_pose(position=position)
            self._collision_prim.set_default_state(position=position)
        if physics_material is None:
            self._collision_prim.apply_physics_material(physics_material)
        if visual_material is not None:
            self._xform_prim.apply_visual_material(visual_material)

In the previous code, it can be seen that the second IF statement is the only one that executes when the object is “None”. The condition of the second IF statement implies that the PhysicsMaterials to be applied into the GroundPlane must be “None” for this action to happen, which seems illogical. I believe this line of code is missing a “not”, so that the condition becomes “if physics_material is not None:”.

I tested the results after modifying this line of code to “if physics_material is not None:”, and observed that after the change the ground planes was successfully being created with the physics material being applied to it.

2 Likes

Hi @jarozamena - Do you see the same issue with latest Isaac Sim 2022.2.1 release?

I’ve just tried to replicate the issue in the latest Isaac Sim 2022.2.1 release, and the same issue persists. Both the ground plane and the physics material are created, but the latter is not being applied to the first.

I’ve also looked at the GroundPlane class in omni.isaac.core.objects.ground_plane in the new release and the line 117 is still missing a “not” (in my opinion). Once again if I add that “not” to the code of the groundPlane class the issue seems to be solved.

1 Like

Thanks for the Feedback! it is indeed a bug and will be fixed for next release. you can keep your patch of replacing if physics_material is None with if physics_material is not None and it should work.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.