Skip to content

Commit 5d14bd1

Browse files
committed
minor cleanup adding docstrigs
1 parent a54dc81 commit 5d14bd1

2 files changed

Lines changed: 11 additions & 10 deletions

File tree

scripts/reinforcement_learning/rsl_rl/export.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,6 @@
7777
default=False,
7878
help="Disable LEAPP graph visualization during compile_graph().",
7979
)
80-
parser.add_argument(
81-
"--disable_automatic_module_annotation",
82-
action="store_true",
83-
default=False,
84-
help="Disables automatic detection and annotation of modules that have internal states",
85-
)
8680

8781
# append RSL-RL cli arguments
8882
cli_args.add_rsl_rl_args(parser)
@@ -123,6 +117,7 @@
123117

124118

125119
def get_actor_memory_module(policy_nn):
120+
"""Return the actor-side recurrent memory module when the policy exposes one."""
126121
if hasattr(policy_nn, "memory_a"):
127122
return policy_nn.memory_a
128123
if hasattr(policy_nn, "memory_s"):
@@ -131,6 +126,7 @@ def get_actor_memory_module(policy_nn):
131126

132127

133128
def ensure_actor_hidden_state_initialized(policy_nn, batch_size: int, device: torch.device, dtype: torch.dtype):
129+
"""Initialize and return the actor hidden state when a recurrent policy has not created it yet."""
134130
actor_state, _ = policy_nn.get_hidden_states()
135131
if actor_state is not None:
136132
return actor_state
@@ -151,6 +147,7 @@ def ensure_actor_hidden_state_initialized(policy_nn, batch_size: int, device: to
151147

152148

153149
def state_dict_from_actor_hidden(actor_hidden):
150+
"""Convert the actor hidden state into the named tensor mapping expected by LEAPP state APIs."""
154151
if actor_hidden is None:
155152
return {}
156153
if isinstance(actor_hidden, tuple):
@@ -159,6 +156,7 @@ def state_dict_from_actor_hidden(actor_hidden):
159156

160157

161158
def actor_hidden_from_registered(registered_state, original_hidden):
159+
"""Restore the registered LEAPP state to the hidden-state structure expected by the actor memory module."""
162160
if isinstance(original_hidden, tuple):
163161
if isinstance(registered_state, tuple):
164162
return registered_state

source/isaaclab/isaaclab/utils/leapp/export_annotator.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ def __init__(self, export_method: str, required_obs_groups: set[str] | None = No
107107
self._action_term_scene_keys: dict[str, str] = {}
108108

109109
def setup(self, env):
110-
"""Patch observation and action managers on the unwrapped env."""
110+
"""Patch the unwrapped env in place for LEAPP-aware observation and action export."""
111111
unwrapped = env.env.unwrapped
112112
self.task_name = unwrapped.spec.id
113113

@@ -551,9 +551,12 @@ def patch_env_for_export(
551551
reads **and** ``Articulation`` write methods.
552552
553553
Data properties are resolved lazily through proxies — no hardcoded
554-
class list is required. Properties with ``_leapp_semantics`` produce
555-
rich annotations; properties without it are still traced so that no
556-
tensor is silently baked as a constant.
554+
class list is required. To produce LEAPP input annotations, the
555+
accessed data property getter must carry ``_leapp_semantics``.
556+
Likewise, action-side write methods must be annotated to produce
557+
semantic LEAPP outputs. Undecorated reads and writes are forwarded
558+
as normal runtime access, but they do not gain semantic annotation
559+
metadata through this patching path.
557560
558561
State reads are deduplicated across observation and action paths via a
559562
shared cache, so a property like ``joint_pos`` that is read by both an

0 commit comments

Comments
 (0)