Пример #1
0
 def render_obs(self, dynamics, goals):
     if self.obs_target is None:
         self.obs_target = r3d.FBOTarget(self.obs_hw[0], self.obs_hw[1])
         self._make_scene()
     self.update_state(dynamics=dynamics, goals=goals)
     self.cam1p.look_at(*self.fpv_lookat)
     r3d.draw(self.scene, self.cam1p, self.obs_target)
     return np.flipud(self.obs_target.read())
 def render_chase(self, dynamics, goal, mode="human"):
     if mode == "human":
         if self.window_target is None:
             self.window_target = r3d.WindowTarget(self.window_w,
                                                   self.window_h,
                                                   resizable=self.resizable)
             self._make_scene()
         self.update_state(dynamics=dynamics, goal=goal)
         self.cam3p.look_at(*self.chase_cam.look_at())
         r3d.draw(self.scene, self.cam3p, self.window_target)
         return None
     elif mode == "rgb_array":
         if self.video_target is None:
             self.video_target = r3d.FBOTarget(self.window_h, self.window_h)
             self._make_scene()
         self.update_state(dynamics=dynamics, goal=goal)
         self.cam3p.look_at(*self.chase_cam.look_at())
         r3d.draw(self.scene, self.cam3p, self.video_target)
         return np.flipud(self.video_target.read())