Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable interactive mode in GUI MatPlotLib canvas #280

Merged
merged 2 commits into from
Oct 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions pyrobosim/pyrobosim/gui/world_canvas.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import time
import threading
import warnings
import matplotlib.pyplot as plt
from matplotlib.figure import Figure
from matplotlib.backends.backend_qtagg import FigureCanvasQTAgg
from matplotlib.pyplot import Circle
Expand Down Expand Up @@ -126,6 +127,7 @@ def __init__(
self.fig = Figure(dpi=dpi, tight_layout=True)
self.axes = self.fig.add_subplot(111)
super(WorldCanvas, self).__init__(self.fig)
plt.ion()

self.main_window = main_window
self.world = world
Expand Down Expand Up @@ -417,14 +419,13 @@ def nav_animation_callback(self):
# Check if any robot is currently navigating.
nav_status = [robot.is_moving() for robot in world.robots]
if any(nav_status):
self.update_robots_plot()

# Show the state of the currently selected robot
cur_robot = world.gui.get_current_robot()
if cur_robot is not None and cur_robot.is_moving():
self.show_world_state(cur_robot)
world.gui.set_buttons_during_action(False)

self.update_robots_plot()
self.draw_and_sleep()

def update_robots_plot(self):
Expand Down
Loading