Skip to content

Commit

Permalink
added user input for video creation mode (#77)
Browse files Browse the repository at this point in the history
* added user input for video creation mode

* ran checks

* ran checks

* minor fixes

* fix setup

---------

Co-authored-by: Nishanth Kumar <[email protected]>
  • Loading branch information
kathrynle20 and NishanthJKumar authored Apr 23, 2023
1 parent f159b5b commit 1779d0c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
18 changes: 13 additions & 5 deletions predicators/planning.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

from __future__ import annotations

import curses
import heapq as hq
import logging
import os
Expand Down Expand Up @@ -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":
Expand Down
2 changes: 2 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -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.*"]),
Expand Down

0 comments on commit 1779d0c

Please sign in to comment.