diff --git a/predicators/planning.py b/predicators/planning.py index 0fb6dfd47c..20a7773607 100644 --- a/predicators/planning.py +++ b/predicators/planning.py @@ -5,6 +5,7 @@ from __future__ import annotations +import curses import heapq as hq import logging import os @@ -74,16 +75,23 @@ def sesame_plan( only consider at most one skeleton, and DiscoveredFailures cannot be handled. """ + if CFG.env == "behavior" and \ CFG.behavior_mode == 'iggui': # pragma: no cover - logging.info( # pylint: disable=logging-not-lazy - "VIDEO CREATION MODE: You have 30 seconds to position " + - "the iggui window to the location you want for recording.") env = get_or_create_env('behavior') assert isinstance(env, BehaviorEnv) - start_time = time.time() - while time.time() - start_time < 30.0: + win = curses.initscr() + win.nodelay(True) + win.addstr( + 0, 0, + "VIDEO CREATION MODE: You have time to position the iggui window \ + to the location you want for recording. Type 'q' to indicate you \ + have finished positioning: ") + flag = win.getch() + while flag == -1 or chr(flag) != 'q': env.igibson_behavior_env.step(np.zeros(env.action_space.shape)) + flag = win.getch() + curses.endwin() logging.info("VIDEO CREATION MODE: Starting planning.") if CFG.sesame_task_planner == "astar": diff --git a/setup.py b/setup.py index 956affe077..624098d56d 100644 --- a/setup.py +++ b/setup.py @@ -1,6 +1,8 @@ """Setup script.""" from setuptools import find_packages, setup +# NOTE: Windows users will have to install windows-curses +# (https://pypi.org/project/windows-curses/) setup(name="predicators", version="0.1.0", packages=find_packages(include=["predicators", "predicators.*"]),