p.getCameraImage stuck after a few calls

Official Python bindings with a focus on reinforcement learning and robotics.
Post Reply
nic_olas_s
Posts: 1
Joined: Sun Mar 06, 2022 11:59 am

p.getCameraImage stuck after a few calls

Post by nic_olas_s »

Hi PyBullet Community,

in a small PyBullet setup we simulate an inhand mounted camera.
We use p.getCameraImage as follows to get rgb and depth data, which in general works.
However, after a few calls to that function our program seems stuck.
We debugged our code a bit and apparently it is stuck exactly at the getCameraImage call.

Has anybody here experienced something similar?

I also tried the ER_BULLET_HARDWARE_OPENGL renderer with the same behaviour.

Code: Select all

        _, _, rgb_img, depth_img, seg_img = p.getCameraImage(
            width, height, view_matrix, projection_matrix, physicsClientId=self.sim, renderer=p.ER_TINY_RENDERER
        )
User avatar
Erwin Coumans
Site Admin
Posts: 4244
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA
Contact:

Re: p.getCameraImage stuck after a few calls

Post by Erwin Coumans »

I've never seen this issue before, and many researchers used pybullet with camera rendering. Did you check memory use?
andytgl
Posts: 6
Joined: Thu Jul 08, 2021 5:54 pm

Re: p.getCameraImage stuck after a few calls

Post by andytgl »

I do experience a similar issue - querying p.getCameraImage for a large number of times causes the function to hang. I am using pybullet.ER_TINY_RENDERER. Has anyone else experienced the same issue and found a solution?
andytgl
Posts: 6
Joined: Thu Jul 08, 2021 5:54 pm

Re: p.getCameraImage stuck after a few calls

Post by andytgl »

I did solve my issue by switching to 'eglRenderer', e.g., by adding the following lines (from https://github.com/bulletphysics/bullet ... derTest.py) upon initialization:

Code: Select all

        # Initialize pybullet
        connection_mode=p.DIRECT
        self.ch =  bc.BulletClient(connection_mode)

        # Load eglRendered
        self.ch.setAdditionalSearchPath(pybullet_data.getDataPath())
        self.plugin = self.ch.loadPlugin(egl.get_filename(), "_eglRendererPlugin")
        print("plugin=", self.plugin)
 
Post Reply