Closed ava6969 closed 2 years ago
My understanding is that the friction parameters you are setting are not having any effect in the simulation. The reason for this is that you are using doing this in the episode_initialiser where you should be doing it in the scene_initialiser (https://github.com/deepmind/dm_robotics/blob/main/py/moma/base_task.py#L58).
The reasoning is the following, there is the physics model and the physics data. The model compiled from an mjcf and you cannot modify the model parameters after compilation. The friction being part of the model this explains why you are not seeing any changes. You need to modify the friction in the mjcf directly before the model is compiled. You do this using the scene initialiser mentioned above.
class MySceneInitializer:
def __init__(self, arm):
self._joints = arm.joints
def __call__(rand_state: np.random.RandState) -> None:
for joint in self._joints:
joint.armature = self.arm_rand['armature'].sample()
joint.damping = self.arm_rand['damping'].sample()
joint.frictionloss = self.arm_rand['friction_loss'].sample()
Closing as this is a duplicate of https://github.com/deepmind/rgb_stacking/issues/5
This is my current codebase. I add it together with the other initializers
import dataclasses
from dm_control import mjcf
from rgb_stacking.utils.dr.noise import NoiseDistribution, Normal, LogUniform, Uniform import numpy as np from dm_robotics.moma.entity_initializer import base_initializer
@dataclasses.dataclass class DomainRandomizer(base_initializer.Initializer): def init(self, basket, props, robot): self.props = props self.basket = basket self.arm = robot.arm self.gripper = robot.gripper