Skip to content

Commit cfce9fe

Browse files
authored
Update material randomization (#59)
1 parent 2c83202 commit cfce9fe

File tree

3 files changed

+8
-11
lines changed

3 files changed

+8
-11
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ is demanded by more than one party. -->
2020
<!-- As you go through the list, delete the ones that are not applicable. -->
2121

2222
- Bug fix (non-breaking change which fixes an issue)
23+
- Enhancement (non-breaking change which improves an existing functionality)
2324
- New feature (non-breaking change which adds functionality)
2425
- Breaking change (existing functionality will not work without user modification)
2526
- Documentation update

embodichain/lab/gym/envs/managers/randomization/visual.py

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -453,21 +453,17 @@ def _randomize_mat_inst(
453453
random_texture_prob: float,
454454
idx: int = 0,
455455
) -> None:
456-
# randomize the material instance pbr properties based on the plan.
457-
for key, value in plan.items():
458-
if key == "base_color":
459-
mat_inst.set_base_color(value[idx].tolist())
460-
else:
461-
getattr(mat_inst, f"set_{key}")(value[idx].item())
462456

463457
# randomize texture or base color based on the probability.
464458
if random.random() < random_texture_prob and len(self.textures) != 0:
465459
self._randomize_texture(mat_inst)
466460
else:
467-
# set a random base color instead.
468-
random_color = torch.rand(3).tolist()
469-
random_color.append(1.0) # alpha
470-
mat_inst.set_base_color(random_color)
461+
# randomize the material instance pbr properties based on the plan.
462+
for key, value in plan.items():
463+
if key == "base_color":
464+
mat_inst.set_base_color(value[idx].tolist())
465+
else:
466+
getattr(mat_inst, f"set_{key}")(value[idx].item())
471467

472468
def __call__(
473469
self,

embodichain/lab/sim/robots/cobotmagic.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ def _build_default_cfgs() -> Dict[str, Any]:
152152
dynamic_friction=0.9,
153153
linear_damping=0.7,
154154
angular_damping=0.7,
155-
contact_offset=0.005,
155+
contact_offset=0.001,
156156
rest_offset=0.001,
157157
restitution=0.01,
158158
max_depenetration_velocity=1e1,

0 commit comments

Comments
 (0)