[Question] RslRlSymmetryCfg example #2568
Replies: 3 comments
-
Yes, I’ve used it. It is fairly straightforward once you understand how the mirroring should apply to your specific robot or actuator configuration. The key is to implement a Step 1: Implement the Mirror Functionsdef mirror_policy_observation(policy_obs):
# Your logic to mirror policy observations
return mirrored_policy_obs
def mirror_critic_observation(critic_obs):
# Your logic to mirror critic observations
return mirrored_critic_obs
def mirror_actions(actions):
# Your logic to mirror actions
return mirrored_actions Step 2: Define the Data Augmentation Functiondef data_augmentation_func(env, obs, actions, obs_type):
if obs_type == 'policy':
obs_aug = torch.cat((obs, mirror_policy_observation(obs)), dim=0)
elif obs_type == 'critic' and obs is not None:
obs_aug = torch.cat((obs, mirror_critic_observation(obs)), dim=0)
else:
raise ValueError(f"Mirror logic for observation type '{obs_type}' not implemented")
actions_aug = torch.cat((actions, mirror_actions(actions)), dim=0)
return obs_aug, actions_aug Step 3: Add to PPO Runner Config@configclass
class MyPPORunnerCfg(RslRlOnPolicyRunnerCfg):
...
algorithm = RslRlPpoAlgorithmCfg(
...
symmetry_cfg = RslRlSymmetryCfg(
use_data_augmentation=True,
use_mirror_loss=True,
mirror_loss_coeff=1.0,
data_augmentation_func=data_augmentation_func,
)
) Let me know if you have any specific questions about this. |
Beta Was this translation helpful? Give feedback.
-
This was really helpful, thank you! I stood it up with my G1 23dof in a basic locomotion policy (source code here) One thing I need to dig into further - based on initial results, symmetry loss signficantly improves the policy, but |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Has anyone tried using
isaaclab_rl.rsl_rl.RslRlSymmetryCfg
?I couldn't find any examples or documentation beyond this: https://isaac-sim.github.io/IsaacLab/main/source/api/lab_rl/isaaclab_rl.html#isaaclab_rl.rsl_rl.RslRlSymmetryCfg
Beta Was this translation helpful? Give feedback.
All reactions