Genesis icon indicating copy to clipboard operation
Genesis copied to clipboard

Add camera and no image

Open kelo020304 opened this issue 10 months ago • 2 comments
trafficstars

image when I am doing RL, I add a camea and rander it but i can not get a image , code below:

self.cam = self.scene.add_camera(model='pinhole',
                                         res=(640, 480),
                                         pos=(0,0,1),
                                         lookat=(5,0,1),
                                         fov = 40,
                                         GUI=True)
        self.scene.build(n_envs= self.num_envs)
        # self.cam_pos = self.Piper.get_links_pos()[:, self.Piper.get_link('link6').idx - 1].cpu().numpy()
        # for i in range(self.num_envs):
        #     single_cam_pos = self.Piper.get_links_pos()[i, self.Piper.get_link('link6').idx - 1].cpu().numpy()
        #     self.cam.set_pose(pos=single_cam_pos)
        cv2.waitKey(1)
        self.cam.render()

How to solve it?

kelo020304 avatar Dec 26 '24 05:12 kelo020304

waitkey(1) should be after render().

Could you check the variables returned by render() and see if it's meaingful?

Genesis-Embodied-AI avatar Dec 26 '24 10:12 Genesis-Embodied-AI

waitkey(1) should be after render().

Could you check the variables returned by render() and see if it's meaingful?

I have tried but it also don not work , render() return a 4 length tuple and the first element seems meaningful with shape (320,320,3) but also nothing to see

kelo020304 avatar Dec 26 '24 10:12 kelo020304

The camera pos is (0,0,1), is this inside the robot? Could you please change camera pos and give it a try?

zhenjia-xu avatar Jan 10 '25 09:01 zhenjia-xu

Closing the issue due to no response. We can revisit it if a new object can be provided.

YilingQiao avatar Feb 23 '25 17:02 YilingQiao