google-deepmind / google-deepmind/dm_control
Changing HField geometry at runtime - visualization not working
- 主要语言
- Python
- 星标
- 4.7k
- 派生
- 764
- PR 合并指标
- 30 天内没有已合并 PR
描述
I'd like to change the geometry of a HField at runtime. I am using the following code:
```python
hfield = physics.bind(self._hfield_chunks[geom_idx])
res = hfield.nrow
# Generate terrain in a 2D numpy array bounded to [0, 1]...
start_idx = hfield.adr
physics.model.hfield_data[start_idx:start_idx + res**2] = terrain.ravel()
with physics.contexts.gl.make_current() as ctx:
ctx.call(mjlib.mjr_uploadHField,
physics.model.ptr,
physics.contexts.mujoco.ptr,
hfield.element_id)
```
Unfortunately, while the physics model seems to change as expected, the visualization is not updating to match. In case it's relevant, I'm using dm_control and the above code is called by the `after_step()` callback.
贡献指南
调研方向
首先跟踪 issue 中所示的 after_step() 回调和 mjr_uploadHField 调用,然后检查 hfield_data 发生变化后 dm_control 如何更新 MuJoCo 可视化状态。当运行时地形变化同时反映在可视化和物理模型中时,即视为完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- python
- 领域
- computer-graphics
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100