Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@

import isaaclab_tasks.manager_based.navigation.mdp as mdp
from isaaclab_tasks.manager_based.locomotion.velocity.config.anymal_c.flat_env_cfg import AnymalCFlatEnvCfg
from isaaclab_tasks.utils.hydra import resolve_presets

LOW_LEVEL_ENV_CFG = AnymalCFlatEnvCfg()
resolve_presets(LOW_LEVEL_ENV_CFG)


@configclass
Expand Down Expand Up @@ -137,9 +139,15 @@ def __post_init__(self):

self.sim.dt = LOW_LEVEL_ENV_CFG.sim.dt
self.sim.render_interval = LOW_LEVEL_ENV_CFG.decimation
self.sim.physics_material = self.scene.terrain.physics_material
self.decimation = LOW_LEVEL_ENV_CFG.decimation * 10
self.episode_length_s = self.commands.pose_command.resampling_time_range[1]

# Resolve any PresetCfg wrappers in the scene so that update_period
# is set on the actual sensor config rather than the wrapper (which
# would be discarded by a later resolve_presets call).
resolve_presets(self.scene)
Comment on lines 142 to +150
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 physics_material assigned before presets are resolved

self.sim.physics_material is assigned from self.scene.terrain.physics_material on line 142, before resolve_presets(self.scene) is called on line 149. If terrain.physics_material is ever wrapped in a PresetCfg (possible as the preset system expands), the copied value in self.sim.physics_material will be an unresolved wrapper and won't be patched by the subsequent resolve_presets(self.scene) call (which only walks self.scene, not self.sim). Swapping the order to resolve first, then assign, is safer and more consistent with the stated intent of this fix.

Suggested change
self.sim.dt = LOW_LEVEL_ENV_CFG.sim.dt
self.sim.render_interval = LOW_LEVEL_ENV_CFG.decimation
self.sim.physics_material = self.scene.terrain.physics_material
self.decimation = LOW_LEVEL_ENV_CFG.decimation * 10
self.episode_length_s = self.commands.pose_command.resampling_time_range[1]
# Resolve any PresetCfg wrappers in the scene so that update_period
# is set on the actual sensor config rather than the wrapper (which
# would be discarded by a later resolve_presets call).
resolve_presets(self.scene)
self.sim.dt = LOW_LEVEL_ENV_CFG.sim.dt
self.sim.render_interval = LOW_LEVEL_ENV_CFG.decimation
self.decimation = LOW_LEVEL_ENV_CFG.decimation * 10
self.episode_length_s = self.commands.pose_command.resampling_time_range[1]
# Resolve any PresetCfg wrappers in the scene so that update_period
# is set on the actual sensor config rather than the wrapper (which
# would be discarded by a later resolve_presets call).
resolve_presets(self.scene)
self.sim.physics_material = self.scene.terrain.physics_material


if self.scene.height_scanner is not None:
self.scene.height_scanner.update_period = (
self.actions.pre_trained_policy_action.low_level_decimation * self.sim.dt
Expand Down
Loading