Unable to create custom task (quadruped), KeyError

Hello, I am trying to train my custom quadruped Laika using Isaac Gym, building upon the Anymal example given.
I followed all the steps mentioned in the framework.md file (inheriting from VecTask, creating config files, editing them where needed, placing them in tas and train folders, and also adding my task to the init.py file. However when I do python3 train.py task=Laika, I get a KeyError. Part of the error is:

Started to train
Exact experiment name requested from command line: Laika
Error executing job with overrides: ['task=Laika']
Traceback (most recent call last):
  File "train.py", line 160, in launch_rlg_hydra
    'sigma' : None
  File "/home/hehe/anaconda3/envs/rlgpu/lib/python3.7/site-packages/rl_games/torch_runner.py", line 120, in run
    self.run_train(args)
  File "/home/hehe/anaconda3/envs/rlgpu/lib/python3.7/site-packages/rl_games/torch_runner.py", line 98, in run_train
    agent = self.algo_factory.create(self.algo_name, base_name='run', params=self.params)
  File "/home/hehe/anaconda3/envs/rlgpu/lib/python3.7/site-packages/rl_games/common/object_factory.py", line 15, in create
    return builder(**kwargs)
  File "/home/hehe/anaconda3/envs/rlgpu/lib/python3.7/site-packages/rl_games/torch_runner.py", line 39, in <lambda>
    self.algo_factory.register_builder('a2c_continuous', lambda **kwargs : a2c_continuous.A2CAgent(**kwargs))
  File "/home/hehe/anaconda3/envs/rlgpu/lib/python3.7/site-packages/rl_games/algos_torch/a2c_continuous.py", line 16, in __init__
    a2c_common.ContinuousA2CBase.__init__(self, base_name, params)
  File "/home/hehe/anaconda3/envs/rlgpu/lib/python3.7/site-packages/rl_games/common/a2c_common.py", line 999, in __init__
    A2CBase.__init__(self, base_name, params)
  File "/home/hehe/anaconda3/envs/rlgpu/lib/python3.7/site-packages/rl_games/common/a2c_common.py", line 100, in __init__
    self.vec_env = vecenv.create_vec_env(self.env_name, self.num_actors, **self.env_config)
  File "/home/hehe/anaconda3/envs/rlgpu/lib/python3.7/site-packages/rl_games/common/vecenv.py", line 222, in create_vec_env
    return vecenv_config[vec_env_name](config_name, num_actors, **kwargs)
  File "train.py", line 126, in <lambda>
    lambda config_name, num_actors, **kwargs: RLGPUEnv(config_name, num_actors, **kwargs))
  File "/home/hehe/Documents/IsaacGymEnvs/isaacgymenvs/utils/rlgames_utils.py", line 153, in __init__
    self.env = env_configurations.configurations[config_name]['env_creator'](**kwargs)
  File "train.py", line 112, in create_env_thunk
    **kwargs,
  File "/home/hehe/Documents/IsaacGymEnvs/isaacgymenvs/__init__.py", line 55, in make
    return create_rlgpu_env()
  File "/home/hehe/Documents/IsaacGymEnvs/isaacgymenvs/utils/rlgames_utils.py", line 78, in create_rlgpu_env
    env = isaacgym_task_map[task_name](
KeyError: 'Laika'

Can anybody tell me what am I doing wrong? Thanks in advance

Hi @hirakjr24

Are you sure you added your task to the isaacgym_task_map dictionary in IsaacGymEnvs/isaacgymenvs/tasks/__init__.py file?

Something like this:

...
from .laika import Laika

isaacgym_task_map = {
    ...
    "Laika": Laika,
}

Yes, that’s what is confusing, I did that, and it still has the same error.

Mmmm,

Can you verify what file you are modifying… Maybe there are several IsaacGymEnvs…

A way could be to run pip show isaacgymenvs in a terminal with the Python environment activated…

Or add the following lines to /home/hehe/Documents/IsaacGymEnvs/isaacgymenvs/utils/rlgames_utils.py` file and run the code

import isaacgymenvs
print(isaacgymenvs.__file__)

Yep I cloned the repo twice, once in /Documents and in /Downloads. Ran the installation in /Documents but was editing files in /Downloads folder. What a noob mistake !
Thanks for your help :)