robohive icon indicating copy to clipboard operation
robohive copied to clipboard

A tutorial for creating new in env in RoboHive

Open vikashplus opened this issue 2 years ago • 5 comments

vikashplus avatar Apr 14 '23 00:04 vikashplus

Hi, I would like to ask where can i find 'obj_goal' key list for franka_kitchen_v2:FrankaKitchen environments? I tried 'microwave' but it keep saying keyerror! Thanks in advance!

tattrongvu avatar Apr 15 '23 18:04 tattrongvu

@tattrongvu -- The latest version of FrankaKitchen environments is v4.

  • Please see here for the latest version of these environments.
  • you can also follow the change log to understand the differences

vikashplus avatar Apr 15 '23 21:04 vikashplus

Dear @vikashplus , thanks for your instruction. So i'm trying to get the render image from envs with this code bellow but not working. Since this environments base on mujoco_py so i tried to use MjViewer as in your tutorial https://github.com/vikashplus/robohive/blob/main/robohive/tutorials/render_cams.py but it show error as described bellow:

env = gym.make('FK1_MicroOpenRandom-v4') for i in range(50): env.reset() step=0 while True: a = env.action_space.sample() # Sample an action obs, reward, done, info = env.step(a) img=env.sim.render(camera_name='topview', width=512, height=512, depth=False,mode='offscreen') #above line raise: 'MjPySimScene' object has no attribute 'render' #env.render() #this also not work, raise NotImplementedError step+=1 print(step) if done or step==200: break

Could you point me how could i do it. Thank you very much!

tattrongvu avatar Apr 16 '23 15:04 tattrongvu

Hi, after digging to your code i found two ways: 1, img= env.sim.sim.render(camera_name='left_cam', width=512, height=512, depth=False,mode='offscreen') 2, img= env.sim.renderer.render_offscreen(camera_id='left_cam', width=512, height=512) But I noticed that it has very low FPS. Is this the correct way to get an RGB image from your environment (FrankaKitchen)?

tattrongvu avatar Apr 16 '23 17:04 tattrongvu

  1. You can render camera views from an env and random policy with
python utils/examine_env.py --env_name FK1_MicroOpenRandom-v4 --num_episodes 1 --camera_name top_cam --render offscreen
  1. Rending speed depends on the hardware that you have access to. You can use following to check if mujoco_py is compiled with hardware support
python -c "import mujoco_py as mj; print(mj.cymj)"

vikashplus avatar Apr 17 '23 15:04 vikashplus