Skip to content

plt.pause(0) waits for ever: PoseGraph.plot_scan(pause=0) and Vehicle animation may hang #876

Open

Description

@petercorke

plt.pause(0) does not return: Matplotlib treats a timeout of zero as "wait until the event loop is stopped", so it blocks for ever, with no message. PyPlot.step(0) and PyPlot2.step(0) did this and now raise ValueError (#875). Other places pass a caller's value straight to plt.pause:

  • PoseGraph.plot_scan(n, pause=0) (mobile/PoseGraph.py): plt.pause(pause) with no guard, pause is an argument and defaults to 1. Needs a guard, or a ValueError, as in fix(plot): PyPlot and PyPlot2 step() raise ValueError for a dt of zero or less #875.
  • Vehicle animation (mobile/Vehicle.py, _refresh_animation_frame(fig, dt, pause)): ends with plt.pause(dt); check whether dt can be zero from the callers (lines 853 and 1841) and guard it if so.

Not affected: PlannerBase.animation_frame already tests pause > 0, and the others pass a constant.

I believe the first two hang the same way but have not run them. A test should use a timeout so that a regression fails instead of hanging (see tests/test_step_dt.py in #875).

Activity

  1. huxiaoyi-ovo commented on Oct 22, 2026

    @huxiaoyi-ovo
    Contributor

    Hi @petercorke,

    I'd like to take this issue. I'll fix the zero-duration pause handling in PoseGraph.plot_scan() and Vehicle animation, following the behaviour established in #875.

    I'll add focused regression tests covering zero/negative values and non-blocking animation, and verify the changes against CI.

    I'll use ChatGPT (GPT-6) for assistance with code analysis and testing, with appropriate attribution in the PR and commits.

    Thanks!

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

    bugwe got it wrong, will fix

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions