google-deepmind / google-deepmind/mujoco
Python: add relpose attribute to MjModel.eq()
- Dominant language
- C++
- Stars
- 15.2k
- Forks
- 1.8k
- Avg merge
- 10d 16h
- Merged PRs (30d)
- 25
Description
*mujoco python bindings version 2.3.7*
I found myself creating a function like:
```python
import mujoco
import numpy as np
def set_weld_relpose(model: mujoco.MjModel, pos: np.ndarray, quat: np.ndarray, name: str):
pos_idx, quat_idx = 3, 6
data = model.eq(name).data
data[pos_idx:pos_idx+3] = np.copy(pos)
data[quat_idx:quat_idx+4] = np.copy(quat)
```
to programmatically change the relpose of a weld equality.
It would be nice if there was an attribute, similar to
```python
model.eq(name).active
model.eq(name).solimp
model.eq(name).solref
```
so one could do
```python
my_relpose = np.array([0, 0, 0, 1, 0, 0, 0])
model.eq("my_weld").relpose = my_relpose
```
and also so it doesn't break if the `data` attribute changes in the future.
For all i know there might be a good reason not to add this, and if there already is a nicer way to do it I would love to know!
*I tried changing model.qpos0 to achieve the same as well, but I didn't get it to work and found it a bit unintuitive.*
Contributor guide
Assessment
This issue has not been assessed yet.