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.
How to keep the walking robot in view?
-
- Posts: 4
- Joined: Fri Jul 03, 2020 11:37 pm
- Location: Victoria, BC, Canada
Re: How to keep the walking robot in view?
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:
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)