Skip to content

Commit a930335

Browse files
committed
[BugFix] Fix NaN errors
1 parent d43b3df commit a930335

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

vmas/simulator/core.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2321,8 +2321,13 @@ def _get_constraint_forces(
23212321

23222322
# softmax penetration
23232323
k = self._contact_margin
2324-
penetration = (((dist_min - dist) * sign / k).exp() + 1.0).log() * k
2325-
2324+
penetration = (
2325+
torch.logaddexp(
2326+
torch.tensor(0.0, dtype=torch.float32, device=self.device),
2327+
(dist_min - dist) * sign / k,
2328+
)
2329+
* k
2330+
)
23262331
force = (
23272332
sign
23282333
* force_multiplier

0 commit comments

Comments
 (0)