Skip to content

Commit

Permalink
Pre-commit fix
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenwel committed Jan 30, 2024
1 parent 2bb2880 commit ef4d888
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from __future__ import annotations

import torch
from typing import TYPE_CHECKING, Sequence
from typing import TYPE_CHECKING

from omni.isaac.orbit.managers import ResamplingTerm

Expand All @@ -20,10 +20,9 @@ class RandomChance(ResamplingTerm):
Commands are resampled with a fixed probability at every time step.
"""

def __init__(self, cfg: FixedFrequencyCfg, env):
def __init__(self, cfg: RandomChanceCfg, env):
super().__init__(cfg, env)


def __str__(self) -> str:
msg = f"\t\tResampling probability: {self.cfg.resampling_probability}"
return msg
Expand All @@ -35,6 +34,8 @@ def compute(self, dt: float):
dt: The time step.
"""
# Note: uniform_(0, 1) is inclusive on 0 and exclusive on 1. So we need to use < instead of <=.
resample_prob_buf = torch.empty(self.num_envs, device=self.device).uniform_(0, 1) < self.cfg.resampling_probability
resample_prob_buf = (
torch.empty(self.num_envs, device=self.device).uniform_(0, 1) < self.cfg.resampling_probability
)
resample_env_ids = resample_prob_buf.nonzero(as_tuple=False).flatten()
return resample_env_ids

0 comments on commit ef4d888

Please sign in to comment.