Skip to content

Enable pausing in passive viewer #2481

@jjyyxx

Description

@jjyyxx
Contributor

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

Activity

yuvaltassa

yuvaltassa commented on Mar 8, 2025

@yuvaltassa
Collaborator

Would you like to send a PR for this?

jjyyxx

jjyyxx commented on Mar 11, 2025

@jjyyxx
ContributorAuthor

@yuvaltassa Sure. Please check #2493.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Participants

      @yuvaltassa@jjyyxx

      Issue actions

        Enable pausing in passive viewer · Issue #2481 · google-deepmind/mujoco