Python pybullet.ER_TINY_RENDERER Examples
The following are 5
code examples of pybullet.ER_TINY_RENDERER().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
pybullet
, or try the search function
.
Example #1
Source File: renderer.py From mvp_grasp with BSD 3-Clause "New" or "Revised" License | 6 votes |
def render(self): if np.all(self._rendered_pos == self.camera_pos) and np.all(self._rendered_rot == self.camera_rot): return self._rendered target = self.camera_pos + np.dot(self.camera_rot, [0, 0, 1.0, 1.0])[0:3] up = np.dot(self.camera_rot, [0, -1.0, 0, 1.0])[0:3] vm = pb.computeViewMatrix(self.camera_pos, target, up) i_arr = pb.getCameraImage(self.im_width, self.im_height, vm, self.pm, shadow=0, renderer=pb.ER_TINY_RENDERER) # renderer=pb.ER_BULLET_HARDWARE_OPENGL) # Record the position of the camera, and don't re-render if it hasn't moved. self._rendered = i_arr self._rendered_pos = self.camera_pos.copy() self._rendered_rot = self.camera_rot.copy() return i_arr
Example #2
Source File: env_bases.py From GtS with MIT License | 6 votes |
def render_physics(self): robot_pos, _ = p.getBasePositionAndOrientation(self.robot_tracking_id) view_matrix = p.computeViewMatrixFromYawPitchRoll( cameraTargetPosition=robot_pos, distance=self.tracking_camera["distance"], yaw=self.tracking_camera["yaw"], pitch=self.tracking_camera["pitch"], roll=0, upAxisIndex=2) proj_matrix = p.computeProjectionMatrixFOV( fov=60, aspect=float(self._render_width)/self._render_height, nearVal=0.1, farVal=100.0) with Profiler("render physics: Get camera image"): (_, _, px, _, _) = p.getCameraImage( width=self._render_width, height=self._render_height, viewMatrix=view_matrix, projectionMatrix=proj_matrix, renderer=p.ER_TINY_RENDERER ) rgb_array = np.array(px).reshape((self._render_width, self._render_height, -1)) rgb_array = rgb_array[:, :, :3] return rgb_array
Example #3
Source File: env_bases.py From midlevel-reps with MIT License | 6 votes |
def render_physics(self): robot_pos, _ = p.getBasePositionAndOrientation(self.robot_tracking_id) view_matrix = p.computeViewMatrixFromYawPitchRoll( cameraTargetPosition=robot_pos, distance=self.tracking_camera["distance"], yaw=self.tracking_camera["yaw"], pitch=self.tracking_camera["pitch"], roll=0, upAxisIndex=2) proj_matrix = p.computeProjectionMatrixFOV( fov=60, aspect=float(self._render_width)/self._render_height, nearVal=0.1, farVal=100.0) with Profiler("render physics: Get camera image"): (_, _, px, _, _) = p.getCameraImage( width=self._render_width, height=self._render_height, viewMatrix=view_matrix, projectionMatrix=proj_matrix, renderer=p.ER_TINY_RENDERER ) rgb_array = np.array(px) rgb_array = rgb_array[:, :, :3] return rgb_array
Example #4
Source File: bullet_world.py From NTP-vat-release with MIT License | 5 votes |
def capture_image(self): width, height, im, depth, seg = p.getCameraImage(64, 64, list( self.view_matrix), list(self.projection_matrix), renderer=p.ER_TINY_RENDERER) self.depth = depth im = np.array(im).reshape([height, width, -1]) return im[:, :, :3]
Example #5
Source File: turtlebot_pybullet.py From SocialRobot with Apache License 2.0 | 4 votes |
def get_image(cam_pos, cam_orientation): """ Arguments cam_pos: camera position cam_orientation: camera orientation in quaternion """ width = 160 height = 120 fov = 90 aspect = width / height near = 0.001 far = 5 if use_maximal_coordinates: # cam_orientation has problem when enable bt_rigid_body, # looking at 0.0, 0.0, 0.0 instead # this does not affect performance cam_pos_offset = cam_pos + np.array([0.0, 0.0, 0.3]) target_pos = np.array([0.0, 0.0, 0.0]) else: # camera pos, look at, camera up direction rot_matrix = p.getMatrixFromQuaternion(cam_orientation) # offset to base pos cam_pos_offset = cam_pos + np.dot( np.array(rot_matrix).reshape(3, 3), np.array([0.1, 0.0, 0.3])) target_pos = cam_pos_offset + np.dot( np.array(rot_matrix).reshape(3, 3), np.array([-1.0, 0.0, 0.0])) # compute view matrix view_matrix = p.computeViewMatrix(cam_pos_offset, target_pos, [0, 0, 1]) projection_matrix = p.computeProjectionMatrixFOV(fov, aspect, near, far) # Get depth values using the OpenGL renderer if enable_open_gl_rendering: w, h, rgb, depth, seg = p.getCameraImage( width, height, view_matrix, projection_matrix, shadow=True, renderer=p.ER_BULLET_HARDWARE_OPENGL) else: w, h, rgb, depth, seg = p.getCameraImage( width, height, view_matrix, projection_matrix, shadow=True, renderer=p.ER_TINY_RENDERER) # depth_buffer = np.reshape(images[3], [width, height]) # depth = far * near / (far - (far - near) * depth_buffer) # seg = np.reshape(images[4],[width,height])*1./255. return rgb