本文整理汇总了Python中pybullet.ER_BULLET_HARDWARE_OPENGL属性的典型用法代码示例。如果您正苦于以下问题:Python pybullet.ER_BULLET_HARDWARE_OPENGL属性的具体用法?Python pybullet.ER_BULLET_HARDWARE_OPENGL怎么用?Python pybullet.ER_BULLET_HARDWARE_OPENGL使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类pybullet
的用法示例。
在下文中一共展示了pybullet.ER_BULLET_HARDWARE_OPENGL属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _render
# 需要导入模块: import pybullet [as 别名]
# 或者: from pybullet import ER_BULLET_HARDWARE_OPENGL [as 别名]
def _render(self, mode="rgb_array", close=False):
if mode != "rgb_array":
return np.array([])
base_pos = self.minitaur.GetBasePosition()
view_matrix = self._pybullet_client.computeViewMatrixFromYawPitchRoll(
cameraTargetPosition=base_pos,
distance=self._cam_dist,
yaw=self._cam_yaw,
pitch=self._cam_pitch,
roll=0,
upAxisIndex=2)
proj_matrix = self._pybullet_client.computeProjectionMatrixFOV(
fov=60, aspect=float(RENDER_WIDTH)/RENDER_HEIGHT,
nearVal=0.1, farVal=100.0)
(_, _, px, _, _) = self._pybullet_client.getCameraImage(
width=RENDER_WIDTH, height=RENDER_HEIGHT, viewMatrix=view_matrix,
projectionMatrix=proj_matrix, renderer=pybullet.ER_BULLET_HARDWARE_OPENGL)
rgb_array = np.array(px)
rgb_array = rgb_array[:, :, :3]
return rgb_array
示例2: _render
# 需要导入模块: import pybullet [as 别名]
# 或者: from pybullet import ER_BULLET_HARDWARE_OPENGL [as 别名]
def _render(self, mode='human', close=False):
if mode != "rgb_array":
return np.array([])
base_pos,orn = self._p.getBasePositionAndOrientation(self._racecar.racecarUniqueId)
view_matrix = self._p.computeViewMatrixFromYawPitchRoll(
cameraTargetPosition=base_pos,
distance=self._cam_dist,
yaw=self._cam_yaw,
pitch=self._cam_pitch,
roll=0,
upAxisIndex=2)
proj_matrix = self._p.computeProjectionMatrixFOV(
fov=60, aspect=float(RENDER_WIDTH)/RENDER_HEIGHT,
nearVal=0.1, farVal=100.0)
(_, _, px, _, _) = self._p.getCameraImage(
width=RENDER_WIDTH, height=RENDER_HEIGHT, viewMatrix=view_matrix,
projectionMatrix=proj_matrix, renderer=pybullet.ER_BULLET_HARDWARE_OPENGL)
rgb_array = np.array(px)
rgb_array = rgb_array[:, :, :3]
return rgb_array
示例3: render
# 需要导入模块: import pybullet [as 别名]
# 或者: from pybullet import ER_BULLET_HARDWARE_OPENGL [as 别名]
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
示例4: _render
# 需要导入模块: import pybullet [as 别名]
# 或者: from pybullet import ER_BULLET_HARDWARE_OPENGL [as 别名]
def _render(self, mode, close):
base_pos=[0,0,0]
if (hasattr(self,'robot')):
if (hasattr(self.robot,'body_xyz')):
base_pos = self.robot.body_xyz
view_matrix = p.computeViewMatrixFromYawPitchRoll(
cameraTargetPosition=base_pos,
distance=self._cam_dist,
yaw=self._cam_yaw,
pitch=self._cam_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)
(_, _, px, _, _) = p.getCameraImage(
width=self._render_width, height=self._render_height, viewMatrix=view_matrix,
projectionMatrix=proj_matrix,
renderer=p.ER_BULLET_HARDWARE_OPENGL
)
rgb_array = np.array(px).reshape((self._render_width, self._render_height, -1))
if close: return None
rgb_array = rgb_array[:, :, :3]
return rgb_array
示例5: render_map
# 需要导入模块: import pybullet [as 别名]
# 或者: from pybullet import ER_BULLET_HARDWARE_OPENGL [as 别名]
def render_map(self):
base_pos=[0, 0, -3]
if (hasattr(self,'robot')):
if (hasattr(self.robot,'body_xyz')):
base_pos[0] = self.robot.body_xyz[0]
base_pos[1] = self.robot.body_xyz[1]
view_matrix = p.computeViewMatrixFromYawPitchRoll(
cameraTargetPosition=base_pos,
distance=35,
yaw=0,
pitch=-89,
roll=0,
upAxisIndex=2)
proj_matrix = p.computeProjectionMatrixFOV(
fov=60, aspect=float(self._render_width)/self._render_height,
nearVal=0.1, farVal=100.0)
(_, _, px, _, _) = p.getCameraImage(
width=self._render_width, height=self._render_height, viewMatrix=view_matrix,
projectionMatrix=proj_matrix,
renderer=p.ER_BULLET_HARDWARE_OPENGL
)
rgb_array = np.array(px).reshape((self._render_width, self._render_height, -1))
rgb_array = rgb_array[:, :, :3]
return rgb_array
示例6: _render
# 需要导入模块: import pybullet [as 别名]
# 或者: from pybullet import ER_BULLET_HARDWARE_OPENGL [as 别名]
def _render(self, mode, close):
base_pos=[0,0,0]
if (hasattr(self,'robot')):
if (hasattr(self.robot,'body_xyz')):
base_pos = self.robot.body_xyz
view_matrix = p.computeViewMatrixFromYawPitchRoll(
cameraTargetPosition=base_pos,
distance=self._cam_dist,
yaw=self._cam_yaw,
pitch=self._cam_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)
(_, _, px, _, _) = p.getCameraImage(
width=self._render_width, height=self._render_height, viewMatrix=view_matrix,
projectionMatrix=proj_matrix,
renderer=p.ER_BULLET_HARDWARE_OPENGL
)
rgb_array = np.array(px)
if close: return None
rgb_array = rgb_array[:, :, :3]
return rgb_array
示例7: render_map
# 需要导入模块: import pybullet [as 别名]
# 或者: from pybullet import ER_BULLET_HARDWARE_OPENGL [as 别名]
def render_map(self):
base_pos=[0, 0, -3]
if (hasattr(self,'robot')):
if (hasattr(self.robot,'body_xyz')):
base_pos[0] = self.robot.body_xyz[0]
base_pos[1] = self.robot.body_xyz[1]
view_matrix = p.computeViewMatrixFromYawPitchRoll(
cameraTargetPosition=base_pos,
distance=35,
yaw=0,
pitch=-89,
roll=0,
upAxisIndex=2)
proj_matrix = p.computeProjectionMatrixFOV(
fov=60, aspect=float(self._render_width)/self._render_height,
nearVal=0.1, farVal=100.0)
(_, _, px, _, _) = p.getCameraImage(
width=self._render_width, height=self._render_height, viewMatrix=view_matrix,
projectionMatrix=proj_matrix,
renderer=p.ER_BULLET_HARDWARE_OPENGL
)
rgb_array = np.array(px)
rgb_array = rgb_array[:, :, :3]
return rgb_array
示例8: _render
# 需要导入模块: import pybullet [as 别名]
# 或者: from pybullet import ER_BULLET_HARDWARE_OPENGL [as 别名]
def _render(self, mode, close=False):
if (mode=="human"):
self.isRender = True
if mode != "rgb_array":
return np.array([])
base_pos=[0,0,0]
if (hasattr(self,'robot')):
if (hasattr(self.robot,'body_xyz')):
base_pos = self.robot.body_xyz
view_matrix = self._p.computeViewMatrixFromYawPitchRoll(
cameraTargetPosition=base_pos,
distance=self._cam_dist,
yaw=self._cam_yaw,
pitch=self._cam_pitch,
roll=0,
upAxisIndex=2)
proj_matrix = self._p.computeProjectionMatrixFOV(
fov=60, aspect=float(self._render_width)/self._render_height,
nearVal=0.1, farVal=100.0)
(_, _, px, _, _) = self._p.getCameraImage(
width=self._render_width, height=self._render_height, viewMatrix=view_matrix,
projectionMatrix=proj_matrix,
renderer=pybullet.ER_BULLET_HARDWARE_OPENGL
)
rgb_array = np.array(px)
rgb_array = rgb_array[:, :, :3]
return rgb_array
示例9: render
# 需要导入模块: import pybullet [as 别名]
# 或者: from pybullet import ER_BULLET_HARDWARE_OPENGL [as 别名]
def render(self, bullet_client=None):
if bullet_client is None:
bullet_client = self._p
view_matrix = bullet_client.computeViewMatrixFromYawPitchRoll(
cameraTargetPosition=self.pos,
distance=self.dist,
yaw=self.yaw,
pitch=self.pitch,
roll=self.roll,
upAxisIndex=2)
proj_matrix = bullet_client.computeProjectionMatrixFOV(
fov=self.fov,
aspect=float(self.render_width)/self.render_height,
nearVal=0.1, farVal=100.0)
(_, _, px, _, _) = bullet_client.getCameraImage(
width=self.render_width, height=self.render_height,
viewMatrix=view_matrix,
projectionMatrix=proj_matrix,
renderer=pybullet.ER_BULLET_HARDWARE_OPENGL
)
rgb_array = np.array(px).reshape(self.render_height,
self.render_width, 4)
rgb_array = rgb_array[:, :, :3]
return rgb_array
示例10: renderTarget
# 需要导入模块: import pybullet [as 别名]
# 或者: from pybullet import ER_BULLET_HARDWARE_OPENGL [as 别名]
def renderTarget(self, targetPosition, bullet_client=None):
if bullet_client is None:
bullet_client = self._p
self.targetPosition = targetPosition
view_matrix = bullet_client.computeViewMatrix(
cameraEyePosition=self.eyePosition,
cameraTargetPosition=self.targetPosition,
cameraUpVector=self.upVector)
proj_matrix = bullet_client.computeProjectionMatrixFOV(
fov=self.fov,
aspect=float(self.render_width)/self.render_height,
nearVal=0.1, farVal=100.0)
(_, _, px, _, _) = bullet_client.getCameraImage(
width=self.render_width, height=self.render_height,
viewMatrix=view_matrix,
projectionMatrix=proj_matrix,
renderer=pybullet.ER_BULLET_HARDWARE_OPENGL
)
rgb_array = np.array(px).reshape(self.render_height,
self.render_width, 4)
rgb_array = rgb_array[:, :, :3]
return rgb_array
示例11: renderPitchRoll
# 需要导入模块: import pybullet [as 别名]
# 或者: from pybullet import ER_BULLET_HARDWARE_OPENGL [as 别名]
def renderPitchRoll(self, distance, roll, pitch, yaw, bullet_client=None):
if bullet_client is None:
bullet_client = self._p
# self.targetPosition = targetPosition
view_matrix = bullet_client.computeViewMatrixFromYawPitchRoll(
cameraTargetPosition=self.pos,
distance=distance,
yaw=yaw,
pitch=pitch,
roll=roll,
upAxisIndex=2)
proj_matrix = bullet_client.computeProjectionMatrixFOV(
fov=self.fov,
aspect=float(self.render_width)/self.render_height,
nearVal=0.1, farVal=100.0)
(_, _, px, _, _) = bullet_client.getCameraImage(
width=self.render_width, height=self.render_height,
viewMatrix=view_matrix,
projectionMatrix=proj_matrix,
renderer=pybullet.ER_BULLET_HARDWARE_OPENGL
)
rgb_array = np.array(px).reshape(self.render_height,
self.render_width, 4)
rgb_array = rgb_array[:, :, :3]
return rgb_array
示例12: render
# 需要导入模块: import pybullet [as 别名]
# 或者: from pybullet import ER_BULLET_HARDWARE_OPENGL [as 别名]
def render(self, bullet_client = None):
if bullet_client is None:
bullet_client = self._p
view_matrix = bullet_client.computeViewMatrixFromYawPitchRoll(
cameraTargetPosition = self.pos,
distance=self.dist,
yaw=self.yaw,
pitch=self.pitch,
roll=self.roll,
upAxisIndex=2)
proj_matrix = bullet_client.computeProjectionMatrixFOV(
fov=self.fov, aspect=float(self.render_width)/self.render_height,
nearVal=0.1, farVal=100.0)
(_, _, px, _, _) = bullet_client.getCameraImage(
width=self.render_width, height=self.render_height,
viewMatrix=view_matrix,
projectionMatrix=proj_matrix,
renderer=pybullet.ER_BULLET_HARDWARE_OPENGL
)
rgb_array = np.array(px).reshape(self.render_height, self.render_width, 4)
rgb_array = rgb_array[:, :, :3]
return rgb_array
示例13: renderTarget
# 需要导入模块: import pybullet [as 别名]
# 或者: from pybullet import ER_BULLET_HARDWARE_OPENGL [as 别名]
def renderTarget(self, targetPosition, bullet_client = None):
if bullet_client is None:
bullet_client = self._p
self.targetPosition = targetPosition
view_matrix = bullet_client.computeViewMatrix(
cameraEyePosition = self.eyePosition,
cameraTargetPosition = self.targetPosition,
cameraUpVector=self.upVector)
proj_matrix = bullet_client.computeProjectionMatrixFOV(
fov=self.fov, aspect=float(self.render_width)/self.render_height,
nearVal=0.1, farVal=100.0)
(_, _, px, _, _) = bullet_client.getCameraImage(
width=self.render_width, height=self.render_height,
viewMatrix=view_matrix,
projectionMatrix=proj_matrix,
renderer=pybullet.ER_BULLET_HARDWARE_OPENGL
)
rgb_array = np.array(px).reshape(self.render_height, self.render_width, 4)
rgb_array = rgb_array[:, :, :3]
return rgb_array
示例14: renderPitchRoll
# 需要导入模块: import pybullet [as 别名]
# 或者: from pybullet import ER_BULLET_HARDWARE_OPENGL [as 别名]
def renderPitchRoll(self, distance, roll, pitch, yaw, bullet_client = None):
if bullet_client is None:
bullet_client = self._p
self.targetPosition = targetPosition
view_matrix = bullet_client.computeViewMatrixFromYawPitchRoll(
cameraTargetPosition = self.pos,
distance=distance,
yaw=yaw,
pitch=pitch,
roll=roll,
upAxisIndex=2)
proj_matrix = bullet_client.computeProjectionMatrixFOV(
fov=self.fov, aspect=float(self.render_width)/self.render_height,
nearVal=0.1, farVal=100.0)
(_, _, px, _, _) = bullet_client.getCameraImage(
width=self.render_width, height=self.render_height,
viewMatrix=view_matrix,
projectionMatrix=proj_matrix,
renderer=pybullet.ER_BULLET_HARDWARE_OPENGL
)
rgb_array = np.array(px).reshape(self.render_height, self.render_width, 4)
rgb_array = rgb_array[:, :, :3]
return rgb_array
示例15: record_video_frame
# 需要导入模块: import pybullet [as 别名]
# 或者: from pybullet import ER_BULLET_HARDWARE_OPENGL [as 别名]
def record_video_frame(self):
if self.record_video and self.gui:
frame = np.reshape(p.getCameraImage(width=self.width, height=self.height, renderer=p.ER_BULLET_HARDWARE_OPENGL, physicsClientId=self.id)[2], (self.height, self.width, 4))[:, :, :3]
# frame = cv2.cvtColor(frame, cv2.COLOR_RGB2BGR)
# self.video_writer.write(frame)