@@ -268,7 +268,7 @@ def apply_perturbations(self):
268268 mujoco .mjv_applyPerturbPose (self .model , self .data , self .pert , 0 )
269269 mujoco .mjv_applyPerturbForce (self .model , self .data , self .pert )
270270
271- def read_pixels (self , camid = None ,depth = False ):
271+ def read_pixels (self , camid = None , depth = False ):
272272 if self .render_mode == 'window' :
273273 raise NotImplementedError (
274274 "Use 'render()' in 'window' mode." )
@@ -297,11 +297,10 @@ def read_pixels(self, camid=None,depth=False):
297297
298298
299299 if depth :
300- img = np .zeros ((shape [1 ], shape [0 ], 3 ), dtype = np .uint8 )
300+ rgb_img = np .zeros ((shape [1 ], shape [0 ], 3 ), dtype = np .uint8 )
301301 depth_img = np .zeros ((shape [1 ], shape [0 ], 1 ), dtype = np .float32 )
302- mujoco .mjr_readPixels (img , None , self .viewport , self .ctx )
303- mujoco .mjr_readPixels (None , depth_img , self .viewport , self .ctx )
304- return (np .flipud (img ),np .flipud (depth_img ))
302+ mujoco .mjr_readPixels (rgb_img , depth_img , self .viewport , self .ctx )
303+ return (np .flipud (rgb_img ), np .flipud (depth_img ))
305304 else :
306305 img = np .zeros ((shape [1 ], shape [0 ], 3 ), dtype = np .uint8 )
307306 mujoco .mjr_readPixels (img , None , self .viewport , self .ctx )
0 commit comments