dm_control icon indicating copy to clipboard operation
dm_control copied to clipboard

Removing dclass-attribute

Open ajoardar007 opened this issue 1 year ago • 2 comments

Hello,

I am trying to remove class attributes as it is unnecessary for joints in my use-case.

When I try to use the del command example:

joints = mjcf_model.find_all('joint')
# Remove class-attribute from 'joint' heading
for joint in joints:
   if type(joint.dclass) is str:
      del joint.dclass

, I get the following error:

Traceback (most recent call last):
  File "/home/arnab/UWARL_catkin_ws/src/uwarl-mujoco-summit-wam-sim/src/main_rob_dup.py", line 817, in <module>
    del joints[0].dclass
  File "/home/arnab/.local/lib/python3.8/site-packages/dm_control/mjcf/element.py", line 711, in __delattr__
    raise AttributeError('object has no attribute: {}'.format(name))
AttributeError: object has no attribute: dclass

I need to remove the custom-named classes that the script generates as MuJoCo 2.2.x (Ubuntu 20.04) gives me errors when it is presented with:

<default class="smt_0\\front\\camera\\intel\"/>

, but not with this:

<default class="smt_0\\front\\camera\\intel\"></default>

ajoardar007 avatar Jun 18 '24 18:06 ajoardar007