Source code for isaaclab_rl.rsl_rl.symmetry_cfg

# Copyright (c) 2022-2025, The Isaac Lab Project Developers.
# All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause

from dataclasses import MISSING

from isaaclab.utils import configclass


[docs]@configclass class RslRlSymmetryCfg: """Configuration for the symmetry-augmentation in the training. When :meth:`use_data_augmentation` is True, the :meth:`data_augmentation_func` is used to generate augmented observations and actions. These are then used to train the model. When :meth:`use_mirror_loss` is True, the :meth:`mirror_loss_coeff` is used to weight the symmetry-mirror loss. This loss is directly added to the agent's loss function. If both :meth:`use_data_augmentation` and :meth:`use_mirror_loss` are False, then no symmetry-based training is enabled. However, the :meth:`data_augmentation_func` is called to compute and log symmetry metrics. This is useful for performing ablations. For more information, please check the work from :cite:`mittal2024symmetry`. """ use_data_augmentation: bool = False """Whether to use symmetry-based data augmentation. Default is False.""" use_mirror_loss: bool = False """Whether to use the symmetry-augmentation loss. Default is False.""" data_augmentation_func: callable = MISSING """The symmetry data augmentation function. The function signature should be as follows: Args: env (VecEnv): The environment object. This is used to access the environment's properties. obs (torch.Tensor | None): The observation tensor. If None, the observation is not used. action (torch.Tensor | None): The action tensor. If None, the action is not used. obs_type (str): The name of the observation type. Defaults to "policy". This is useful when handling augmentation for different observation groups. Returns: A tuple containing the augmented observation and action tensors. The tensors can be None, if their respective inputs are None. """ mirror_loss_coeff: float = 0.0 """The weight for the symmetry-mirror loss. Default is 0.0."""