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.