Page 1 of 1

How to keep the walking robot in view?

Posted: Sat Jun 27, 2020 8:39 am
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.

Re: How to keep the walking robot in view?

Posted: Sat Jul 04, 2020 7:35 am
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)