[Suggestion] checking variable type at `compute_inverse_kinematics`

Hi,

I suggest adding a type check at def compute_inverse_kinematics at omni/isaac/motion_generation/articulation_knematics_solver.py. I think the below two lines should be added just below warm_start = self._joints_view.get_joint_positions().

if type(warm_start) is not np.ndarray:
    warm_start = warm_start.detach().cpu().numpy()

I tried reaching task with UR5e using I.K rather than pure joint positions which are used by actions in RL environment. In this situation, there was hard to match a type of input to calculate I.K.

For example,

def pre_physics_step(self, actions) -> None:
...
...
...
  ur5es = self._scene.get_object("ur5e")
  controller = KinematicsSolver(ur5es, end_effector_frame_name="tool0")
  
  self.np_target_position = self.actions.cpu().numpy()
  self.np_target_orientation = np.tile(self.target_orientation, (self._num_envs, 1))
  self.np_target_orientation = np.float32(self.np_target_orientation)
  
  targets = [torch.from_numpy(
      controller.compute_inverse_kinematics(
      target_position=self.np_target_position[i],
      target_orientation=self.np_target_orientation[i])[0].joint_positions.astype(np.float32)
      ).to(device=self._device) for i in range(self._num_envs)]
      
  targets = torch.stack(targets, dim=0)

when I create instances for making controllers, getting values, ets…, many values related to the robot are the tensors. Nevertheless, compute_inverse_kinematics gets inputs only for numpy, there is a line that automatically gets a self variable which is a tensor such as self._joints_view.

Hi @psh9002 - Apologies for the delay in response. Please let us know if you still have any questions or issues after using the latest Isaac Sim release.

Hi, @rthaker
Few weeks later from March 21, I used skrl then did not struggle with problem. Also, it is too old question so I don’t have the code which has the same issue above.

Can you check my another problem about getting point cloud at RL environment (link)?
When I change to the latest Isaac Sim, I cannot get point cloud information.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.