Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removing dclass-attribute #478

Open
ajoardar007 opened this issue Jun 18, 2024 · 2 comments
Open

Removing dclass-attribute #478

ajoardar007 opened this issue Jun 18, 2024 · 2 comments

Comments

@ajoardar007
Copy link

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>
@yuvaltassa
Copy link
Collaborator

try joint.dclass = '' ?

@ajoardar007
Copy link
Author

ajoardar007 commented Jun 20, 2024

That will not remove the entry. It looks like it is a required field and it will be populated regardless.

The same holds true for the field name under geom: some places I have given a name, while at others I did not provide.

In essence, my feedback for further improvement would be to:

  • not treat fields that MuJoCo feels are optional as necessary, and
  • not append the names of previous bodies on to fields, like class and mesh, to make them unique when having the same user-provided value does not violate MuJoCo naming-paradigm.

It would also be great if we can turn-off the auto-appending of names of the previous bodies in a kinematic-chain onto the next connected-body's name if the authors are taking care to keep the names unique (as natively required by MuJoCo). This scripts allows us to treat the building of kinemaic-chains as function-calls, like xacro-files for Gazebo; and, just like xacro-files, we can send custom-prefix's over a function-call to keep names unique whenever required.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants