Open LPY1219 opened 7 months ago
Hi, @LPY1219, I did what you described and tried to extract the code from the colab to a .py file:
import hydra
import numpy as np
import cv2
from hydra import initialize, compose
with initialize(config_path="./calvin_env/conf"):
cfg = compose(config_name="config_data_collection.yaml", overrides=["cameras=static_and_gripper"])
cfg.env["use_egl"] = False
cfg.env["show_gui"] = False
cfg.env["use_vr"] = False
cfg.env["use_scene_info"] = True
print(cfg.env)
env = hydra.utils.instantiate(cfg.env)
observation = env.reset()
#The observation is given as a dictionary with different values
print(observation.keys())
for i in range(5):
# The action consists in a pose displacement (position and orientation)
action_displacement = np.random.uniform(low=-1, high=1, size=6)
# And a binary gripper action, -1 for closing and 1 for oppening
action_gripper = np.random.choice([-1, 1], size=1)
action = np.concatenate((action_displacement, action_gripper), axis=-1)
observation, reward, done, info = env.step(action)
rgb = env.render(mode="rgb_array")[:,:,::-1]
cv2.imshow("win", rgb)
cv2.waitKey(1)
It runs without errors on my computer, can you try it yourself?
Thanks for your reply! I have sovled it by adding init file in the "calvin_env" directory. And then the program can successfully find the package.
@LPY1219 Great that you solved your issue! Just out of curiosity, did you follow the installation instructions in our README? calvin_env
should get installed with pip in the install.sh script, so you wouldn't neet an init
file.
@LPY1219 Great that you solved your issue! Just out of curiosity, did you follow the installation instructions in our README?
calvin_env
should get installed with pip in the install.sh script, so you wouldn't neet aninit
file.
I installed following README, but still need init.py to solve the same error.
Perhaps because the calvin_env library is cloned in the current directory, the import process looked for the local path instead of the installation path
Hi, Thanks for your efforts on building such an amazing benchmark! I am trying to use it to validate my RL algorithm, but i met some problems when I tried the RL jupyter you provide in the repository. I can successfully run the script by using google colab, but when i transform it into .py file and install the related packages, it can not work. I can successfuly load the package by " from calvin_env.envs.play_table_env import PlayTableSimEnv". I do not know why the program will give me the above error when it begins to execute " env = hydra.utils.instantiate(cfg.env) ". Can you help me ?