Translate camera in debug visualizer

Official Python bindings with a focus on reinforcement learning and robotics.
Post Reply
Posts: 3
Joined: Wed Jun 17, 2020 11:40 pm

Translate camera in debug visualizer

Post by rli14 »

Currently in debug visualizer, I know I can drag the mouse to swivel the rotation of the camera. Additionally, I can use the mouse wheel to zoom in and out.

But what about translating the camera? Say, along the XYZ world frame axises. Or even along the XYZ camera frame axises. This would make focusing on my object much much easier in the visual debugger. Is this possible?
Posts: 3
Joined: Sat Jan 30, 2021 4:11 pm

Re: Translate camera in debug visualizer

Post by SphericalCow »

Here is the code I use for setting the visualiser camera to a given position, facing towards a given target.

def set_camera(pos=torch.ones(3), target=torch.zeros(3)):
disp = target - pos
dist = disp.norm()
yaw = np.arctan2(-disp[0],disp[1]) * 180/np.pi
pitch = np.arctan2(disp[2],np.sqrt(disp[0]**2+disp[1]**2)) * 180/np.pi
p.resetDebugVisualizerCamera(cameraDistance=dist, cameraYaw=yaw, cameraPitch=pitch, cameraTargetPosition=target.tolist())
Post Reply