bullet_cartpole.py 文件源码

python
阅读 31 收藏 0 点赞 0 评论 0

项目:cartpoleplusplus 作者: matpalm 项目源码 文件源码
def render_rgb(self, camera_idx):
    cameraPos = [(0.0, 0.75, 0.75), (0.75, 0.0, 0.75)][camera_idx]
    targetPos = (0, 0, 0.3)
    cameraUp = (0, 0, 1)
    nearVal, farVal = 1, 20
    fov = 60
    _w, _h, rgba, _depth, _objects = p.renderImage(self.render_width, self.render_height,
                                                   cameraPos, targetPos, cameraUp,
                                                   nearVal, farVal, fov)
    # convert from 1d uint8 array to (H,W,3) hacky hardcode whitened float16 array.
    # TODO: for storage concerns could just store this as uint8 (which it is)
    # and normalise 0->1 + whiten later.
    rgba_img = np.reshape(np.asarray(rgba, dtype=np.float16),
                          (self.render_height, self.render_width, 4))
    rgb_img = rgba_img[:,:,:3]  # slice off alpha, always 1.0
    rgb_img /= 255
    return rgb_img
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号