google-deepmind / google-deepmind/mujoco

Feature Request: allow returning applied controls in `mujoco.rollout` API

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

Description

### The feature, motivation and pitch

Thanks for adding the really convenient `mujoco.rollout` API - it's been very helpful for developing sampling-based MPC tools.

I have a use-case where I register a control callback in addition to passing a batch of open-loop controls to the rollout function. In particular, my control callback will modify the open-loop "guess" that I pass (by, e.g., modifying the guess to satisfy some additional condition computed in closed-loop through the callback). At each step, the value in `data->ctrl` is modified as the rollout proceeds.

Because of this, the open-loop sequence of controls I pass to the rollout function does not match the sequence of entries of `data->ctrl` executed in closed-loop. I was wondering whether it would be possible to return (maybe optionally) this sequence of closed-loop controls from the rollout function.

I've hacked around this by writing and binding my own multithreaded rollout, but it seems like a minimal addition to the official implementation, so I thought I would ask about it!

### Alternatives

_No response_

### Additional context

_No response_

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.