Skip to content

Enable pausing in passive viewer #2481

Open
@jjyyxx

Description

@jjyyxx

The feature, motivation and pitch

While the passive viewer is more flexible than the managed viewer, it lacks several convenient features (e.g., reload, history) due to its passive nature. Among the current restrictions, the inability to pause via GUI or Space seems like a limitation that could be lifted without extensive refactoring.

Proposed Solution

When the user requests a pause, the program could check the run flag and simply stop calling mj_step, effectively pausing the simulation. This would enable direct qpos manipulation and pose perturbation while paused.

Feasibility Check

I have tested this locally by manually setting run = 0 via a hacky memory write by offset. The results indicate that:

  • The flag update works as expected.
  • The pause state can be confirmed via a Python handle.
  • The qpos slider becomes usable.
  • Float body perturbation functions correctly.

Potential Concern

For a robust API implementation, synchronization is necessary since: run would be set in the rendering thread, and it would be read from the main thread. Maybe add an atomic variable like exitrequest is helpful.

Alternatives

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions