google-deepmind / google-deepmind/dm_control
Adding skin file to mjcf model
- Dominant language
- Python
- Stars
- 4.7k
- Forks
- 764
- PR merge metrics
- No merged PRs in 30d
Description
Hello,
I'm relatively new to Mujoco and the dm_control package.
I've encountered the following issue, that I am not able to solve on my own.
At first I wanted to add a skin file via the mjcf interface of dm_control but this didn't work and the following error appeared.
```
│ ~/.pyenv/versions/3.8.10/lib/python3.8/site-packages/dm_control/mjcf/skin.py:85 in │
│ serialize │
│ │
│ 82 out.write(skin.texcoords.astype(' MAX_BODY_NAME_LENGTH: │
│ 87 │ raise ValueError( │
│ 88 │ │ 'body name is longer than permitted by the skin file format '
AttributeError: 'NoneType' object has no attribute 'full_identifier'
```
To make sure this is not due to my wrong way of using the library I created a minimal xml file that works in the basic mujoco viewer. The skin file will be displayed correctly. Here is the minimal xml file
```
```
If I'm running this minimal script and loading the above minimal.xml I get the same exception as before even though the same xml file worked in mujoco.viewer.launch
```
from dm_control import composer
from dm_control import viewer
from dm_control import mjcf
class Environment(composer.Entity):
def _build(self, environment_xml: str):
self._model = mjcf.from_path(environment_xml)
@property
def mjcf_model(self):
return self._model
class ExampleTask(composer.Task):
def __init__(self, environment_xml: str):
super().__init__()
self._root_entity = Environment(environment_xml)
self._task_observables = {}
@property
def root_entity(self):
return self._root_entity
@property
def task_observables(self):
return self._task_observables
def get_reward(self, physics):
return 0
def create_and_view(environment_xml: str):
task= ExampleTask(environment_xml)
env = composer.Environment(task)
env.reset()
viewer.launch(env)
if __name__ == "__main__":
create_and_view("minimal.xml")
```
Commenting out the `
Contributor guide
Assessment
This issue has not been assessed yet.