isaac-sim / IsaacGymEnvs

Isaac Gym Reinforcement Learning Environments
Other
1.8k stars 396 forks source link

Error raised when running the example code #83

Open yj-Tang opened 1 year ago

yj-Tang commented 1 year ago

Error raised when running the example code. --"[card.gym.plugin] Error creating viewer: Sim->Graphics is nullptr" , as shown in the picture MicrosoftTeams-image

matinator commented 1 year ago

I had the same problem for Cartpole, i was able to solve it by adding this settings in isaacgymenvs.make, can you try to see if by doing so it works?

import gym 
import isaacgym 
import isaacgymenvs 
import torch 
envs = isaacgymenvs.make( 
    seed=0, 
    task="Cartpole", 
    num_envs=2000, 
    sim_device="cuda:0", 
    rl_device="cuda:0", 
    graphics_device_id=0, 
    headless=False, 
    multi_gpu=False, 
    virtual_screen_capture=False, 
    force_render=False
) 
envs.is_vector_env = True 
envs.reset() 
for _ in range(100): 
    envs.render() 
    envs.step( torch.rand((2000,)+envs.action_space.shape, device="cuda:0") 
    )
yj-Tang commented 1 year ago

I had the same problem for Cartpole, i was able to solve it by adding this settings in isaacgymenvs.make, can you try to see if by doing so it works?

import gym 
import isaacgym 
import isaacgymenvs 
import torch 
envs = isaacgymenvs.make( 
    seed=0, 
    task="Cartpole", 
    num_envs=2000, 
    sim_device="cuda:0", 
    rl_device="cuda:0", 
    graphics_device_id=0, 
    headless=False, 
    multi_gpu=False, 
    virtual_screen_capture=False, 
    force_render=False
) 
envs.is_vector_env = True 
envs.reset() 
for _ in range(100): 
    envs.render() 
    envs.step( torch.rand((2000,)+envs.action_space.shape, device="cuda:0") 
    )

It works for me as well! Thank you for the reply! ^ ^