How to keep the walking robot in view?

Official Python bindings with a focus on reinforcement learning and robotics.
Post Reply
incomplete
Posts: 1
Joined: Sat Jun 27, 2020 8:33 am

How to keep the walking robot in view?

Post by incomplete »

If there is a robot walking along a fixed direction, some time later, it would walk out the view (the border of the desktop window, created with `pybullet.connect(pybullet.GUI)`).

How to keep the robot in view? (i.e. let the camera follow the movement of the robot)

I saw that there is a function `resetDebugVisualizerCamera()`, but it doesn't seem to have any effect.
sakura_hana
Posts: 4
Joined: Fri Jul 03, 2020 11:37 pm
Location: Victoria, BC, Canada

Re: How to keep the walking robot in view?

Post by sakura_hana »

In the main loop of your code you can call resetDebugVisualizerCamera and pass the base position of the robot to the cameraTargetPosition parameter.

Like this:

Code: Select all

while (1):
	basePos, baseOrn = p.getBasePositionAndOrientation(baseID) # Get model position
	p.resetDebugVisualizerCamera( cameraDistance=0.3, cameraYaw=75, cameraPitch=-20, cameraTargetPosition=basePos) # fix camera onto model
	time.sleep(0.01)
Post Reply