Skip to content

Commit

Permalink
Fix positiveness of model randomizations
Browse files Browse the repository at this point in the history
  • Loading branch information
diegoferigo committed Oct 3, 2021
1 parent 7d74257 commit dfb9129
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions python/gym_ignition/randomizers/model/sdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,9 +297,6 @@ def sample(self, pretty_print=False) -> str:
else:
raise ValueError("Distribution not recognized")

if data.force_positive:
sample = max(sample, 0.0)

# Update the value
if data.method is Method.Absolute:

Expand All @@ -318,6 +315,9 @@ def sample(self, pretty_print=False) -> str:
else:
raise ValueError("Method not recognized")

if data.force_positive:
data.element.text = str(max(float(data.element.text), 0.0))

return etree.tostring(self._root, pretty_print=pretty_print).decode()

def new_randomization(self) -> RandomizationDataBuilder:
Expand Down

0 comments on commit dfb9129

Please sign in to comment.