forked from Lifelong-Robot-Learning/LIBERO
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
140 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import os | ||
|
||
from libero.libero import benchmark | ||
from libero.libero.envs import OffScreenRenderEnv | ||
|
||
|
||
benchmark_dict = benchmark.get_benchmark_dict() | ||
task_suite_name = "libero_10" # can also choose libero_spatial, libero_object, etc. | ||
task_suite = benchmark_dict[task_suite_name]() | ||
|
||
# retrieve a specific task | ||
task_id = 0 | ||
task = task_suite.get_task(task_id) | ||
task_name = task.name | ||
task_description = task.language | ||
task_bddl_file = os.path.join(benchmark.get_libero_path("bddl_files"), task.problem_folder, task.bddl_file) | ||
print(f"[info] retrieving task {task_id} from suite {task_suite_name}, the " + \ | ||
f"language instruction is {task_description}, and the bddl file is {task_bddl_file}") | ||
|
||
# step over the environment | ||
env_args = { | ||
"bddl_file_name": task_bddl_file, | ||
"camera_heights": 128, | ||
"camera_widths": 128 | ||
} | ||
env = OffScreenRenderEnv(**env_args) | ||
env.seed(0) | ||
env.reset() | ||
init_states = task_suite.get_task_init_states(task_id) # for benchmarking purpose, we fix the a set of initial states | ||
init_state_id = 0 | ||
env.set_init_state(init_states[init_state_id]) | ||
|
||
dummy_action = [0.] * 7 | ||
for step in range(10): | ||
obs, reward, done, info = env.step(dummy_action) | ||
env.close() |