Trouble with starting Reinforcement Learning, internal index error suspected due to an ArticulationView

Hi, I’m attempting to set up a Reinforcement Learning Agent (think: box with four wheels stuck on the side), having cloned the OmniIsaacGymEnvs repo and followed their format. I think I’m having an issue with setting up my ArticulationView. I know that my joints are accessed correctly through the regex path given; I also tried following the stable-baselines3 demo as well. However, in either case, after creating and adding the ArticulationView to the stage, I’ve been receiving this index error (not in my code directly):

Traceback (most recent call last):
  File "scripts/rlgames_train.py", line 114, in parse_hydra_configs
    task = initialize_task(cfg_dict, env)
  File "c:\users\falquez\desktop\omniisaacgymenvs\omniisaacgymenvs\utils\task_util.py", line 74, in initialize_task
    env.set_task(task=task, sim_params=sim_config.get_physics_params(), backend="torch", init_sim=init_sim)
  File "c:\users\falquez\desktop\omniisaacgymenvs\omniisaacgymenvs\envs\vec_env_rlgames.py", line 51, in set_task
    super().set_task(task, backend, sim_params, init_sim)
  File "C:\Users\falquez\AppData\Local\ov\pkg\isaac_sim-2022.2.1/exts/omni.isaac.gym\omni\isaac\gym\vec_env\vec_env_base.py", line 94, in set_task
    self._world.reset()
  File "c:\users\falquez\appdata\local\ov\pkg\isaac_sim-2022.2.1\exts\omni.isaac.core\omni\isaac\core\world\world.py", line 282, in reset
    self._scene._finalize(self.physics_sim_view)
  File "c:\users\falquez\appdata\local\ov\pkg\isaac_sim-2022.2.1\exts\omni.isaac.core\omni\isaac\core\scenes\scene.py", line 290, in _finalize
    articulated_view.initialize(physics_sim_view)
  File "c:\users\falquez\appdata\local\ov\pkg\isaac_sim-2022.2.1\exts\omni.isaac.core\omni\isaac\core\articulations\articulation_view.py", line 218, in initialize
    self._default_kps, self._default_kds = self.get_gains(clone=True)
  File "c:\users\falquez\appdata\local\ov\pkg\isaac_sim-2022.2.1\exts\omni.isaac.core\omni\isaac\core\articulations\articulation_view.py", line 1670, in get_gains
    kps[self._backend_utils.expand_dims(indices, 1), joint_indices], device=self._device
IndexError: index 1 is out of bounds for dimension 0 with size 1

I’m starting to think it could be a problem with the usd file I’m using but it’s very barebones.
Any help is appreciated, I’ve been stumped for days.

Hi @falquez - The error message you’re seeing is indicating that there’s an attempt to access an index that is out of bounds for the given dimension. This is a common error in Python when dealing with arrays or tensors.

In your case, it seems like the error is coming from the get_gains method in the articulation_view.py file. The line kps[self._backend_utils.expand_dims(indices, 1), joint_indices] is trying to access an index that doesn’t exist in the kps tensor.

Here are a few things you could check:

  1. Check the dimensions of your kps tensor. It seems like it’s expecting a tensor with more than one dimension, but the error message suggests that it only has one dimension.
  2. Check the values of indices and joint_indices. If these values are greater than the size of the kps tensor, you’ll get an index out of bounds error.
  3. Check the initialization of your ArticulationView. Make sure that all the necessary parameters are correctly set.
  4. Check your USD file. Make sure that the structure of your USD file matches what the ArticulationView is expecting. For example, if your USD file only defines one joint but the ArticulationView is expecting more, this could cause an index out of bounds error.