@@ -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
11031121if __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 )
0 commit comments