google-deepmind / google-deepmind/mujoco

Abnormal slip

Open
#2,638 7 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
C++
Stars
15.2k
Forks
1.8k
Avg merge
10d 16h
Merged PRs (30d)
25

Description

### Intro

Hi!

I am a student and I'm using Mujoco for rigid body simulation and reinforcement learning.

### My setup

Both 3.3.0 and the Jupyter notebook in [https://mujoco.readthedocs.io/en/stable/python.html](https://mujoco.readthedocs.io/en/stable/python.html).

### What's happening? What did you expect?

I found that when I use a large-magnitude, high-frequency driving force to actuate a joint, noticeable and abnormal slip occurs. I have read the explanation about slip in the tutorial and understand that MuJoCo does not strictly prevent it from happening. However, I am not sure whether the situation I am facing matches the description in that section, because changing solref, solimp, and impratio does not seem to help.

I would like to know how I can ensure simulation accuracy under this kind of control force setup.

### Steps for reproduction

Just need to run the following Python script.

### Minimal model for reproduction

```xml

































```

### Code required for reproduction

```python
import os
import numpy as np
import mediapy as media
import mujoco

if __name__ == "__main__":
import os

mj_model = mujoco.MjModel.from_xml_string(xml)
mj_data = mujoco.MjData(mj_model)

renderer = mujoco.Renderer(mj_model)
scene_option = mujoco.MjvOption()
scene_option.flags[mujoco.mjtVisFlag.mjVIS_JOINT] = True

duration = 3 # (seconds)
framerate = 24 # (Hz)

frames = []
mujoco.mj_resetData(mj_model, mj_data)
n_step = 0

i = 0
xfrc = np.zeros_like(mj_data.xfrc_applied)
while mj_data.time < duration:
ctrl = np.array([(-1) ** (i // 1000)])
i += 1
mj_data.ctrl = ctrl

mujoco.mj_step(mj_model, mj_data)

if len(frames) < mj_data.time * framerate:
renderer.update_scene(mj_data, scene_option=scene_option)
pixels = renderer.render()
frames.append(pixels)
media.show_video(frames, fps=framerate)
```

### Confirmations

- [x] I searched the [latest documentation](https://mujoco.readthedocs.io/en/latest/overview.html) thoroughly before posting.
- [x] I searched previous [Issues](https://github.com/google-deepmind/mujoco/issues) and [Discussions](https://github.com/google-deepmind/mujoco/discussions), I am certain this has not been raised before.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.