Segmentation fault on attempt to get viewer camera handle

Hello, there.

Intent: I want to make the viewer follow a mobile actor to debug its behaviour from its perspective.

Problem: The line gym.get_viewer_camera_handle(viewer) results in a crash with the message: Segmentation fault (core dumped).

Questions:

  • Is this a bug or am I doing something wrong somewhere?
  • If the call had succeeded, I would have tried to move the viewer with gym.set_camera_transform(camera, env, transform), but it seems that gym.get_actor_joint_transforms(env, actor) is the only call outputting transforms with reference to an actor. Is there a more straightforward way to get the base transform (pose) of an actor?
  • Is there a simpler or better way of doing all of this that I have missed?

Thank you for your time and responses.

Hi @marledu ,

There seems to be a bug with get_viewer_camera_handle(). However, if you have created a valid viewer with gym.create_viewer(self.sim, gymapi.CameraProperties()), you can set the viewer camera directly with gym.viewer_camera_look_at(viewer, None, cam_pos, cam_target).

For the actor transforms, you can get the root transform with the tensorAPI acquire_actor_root_state_tensor() and refresh_actor_root_state_tensor().

1 Like

Right, I have somehow overlooked gym.viewer_camera_look_at

Following both of your suggestions, I can confirm that I was able to achieve my intent.

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