Skip to content
This repository was archived by the owner on Oct 4, 2023. It is now read-only.

Commit 77e1476

Browse files
Pyreach sync 20220104
1 parent 41fd31d commit 77e1476

File tree

2 files changed

+21
-4
lines changed

2 files changed

+21
-4
lines changed

pyreach/gyms/envs/benchmark_2d.py

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -497,6 +497,16 @@ class Benchmark2DEnv(reach_env.ReachEnv):
497497
"""
498498

499499
def __init__(self, **kwargs: Any) -> None:
500+
"""Initializes the environment.
501+
502+
Arguments:
503+
**kwargs: Keyword arguments.
504+
505+
Keyword args accepted:
506+
507+
tc (str): The task code to override the standard task code with.
508+
disable_time_limit (bool): Whether to disable the standard time limit.
509+
"""
500510
self._low_level_queue: SimpleQueue[str] = SimpleQueue()
501511
self._timer_running: bool = False
502512
self._deadline: float = 0.0
@@ -529,12 +539,20 @@ def __init__(self, **kwargs: Any) -> None:
529539
# Whether the chat client sent a ctrl-C to indicate test case completed.
530540
self._chat_client_indicated_end: bool = False
531541

542+
self._task_code = TASK_CODE_2D
543+
if "tc" in kwargs:
544+
self._task_code = str(kwargs["tc"])
545+
546+
self._disable_time_limit = False
547+
if "disable_time_limit" in kwargs:
548+
self._disable_time_limit = bool(kwargs["disable_time_limit"])
549+
532550
self.seed()
533551

534552
low_joint_angles = tuple([-6.283, -2.059, -3.926, -3.141, -1.692, -6.283])
535553
high_joint_angles = tuple([6.283, 2.094, 0.191, 3.141, 3.141, 6.283])
536554

537-
task_params: Dict[str, str] = {"task-code": flags.FLAGS.tc}
555+
task_params: Dict[str, str] = {"task-code": self._task_code}
538556

539557
pyreach_config: Dict[str, reach_env.ReachElement] = {
540558
"arm":
@@ -811,7 +829,7 @@ def _check_for_done(self, action: core.Action) -> Tuple[float, bool]:
811829
return (1.0, True)
812830

813831
# Did we run out of time?
814-
if time.time() >= self._deadline:
832+
if not self._disable_time_limit and time.time() >= self._deadline:
815833
print(f"{time.time()}: You ran out of time!")
816834
self._timer_running = False
817835
return (-1.0, True)
@@ -1102,5 +1120,4 @@ def main(_: Any) -> None:
11021120

11031121
if __name__ == "__main__":
11041122
flags.DEFINE_bool("instructor", False, "Run as the instructor.")
1105-
flags.DEFINE_string("tc", TASK_CODE_2D, "Task code for this run.")
11061123
app.run(main)

pyreach/impl/reach_tools_impl.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
_REACH_SHA256 = {
2020
"linux": {
2121
"x86_64":
22-
"428af9a7560e1db1f60b531bdfd3db58eb10412841c121de11fb56c57540e7d6",
22+
"a7ca9c684fa1fc26b96cceb21a5f798ed6954e9eed92e0c664f1a88eff8d0a0b",
2323
},
2424
}
2525
_WEBRTC_BASE = "https://storage.googleapis.com/brain-reach-public/releases/webrtc/%s-%s/webrtc_headless%s."

0 commit comments

Comments
 (0)