| 119 | |
| 120 | # Python CPU/GPU Class |
| 121 | class VecTaskPython(VecTask): |
| 122 | |
| 123 | def get_state(self): |
| 124 | return torch.clamp(self.task.states_buf, -self.clip_obs, self.clip_obs).to(self.rl_device) |
| 125 | |
| 126 | def step(self, actions): |
| 127 | actions_tensor = torch.clamp(actions, -self.clip_actions, self.clip_actions) |
| 128 | |
| 129 | self.task.step(actions_tensor) |
| 130 | |
| 131 | return torch.clamp(self.task.obs_buf, -self.clip_obs, self.clip_obs).to(self.rl_device), self.task.rew_buf.to(self.rl_device), self.task.reset_buf.to(self.rl_device), self.task.extras |
| 132 | |
| 133 | def reset(self): |
| 134 | actions = 0.01 * (1 - 2 * torch.rand([self.task.num_envs, self.task.num_actions], dtype=torch.float32, device=self.rl_device)) |
| 135 | |
| 136 | # step the simulator |
| 137 | self.task.step(actions) |
| 138 | |
| 139 | return torch.clamp(self.task.obs_buf, -self.clip_obs, self.clip_obs).to(self.rl_device) |
nothing calls this directly
no outgoing calls
no test coverage detected