def compute_reward(self):
        """ Compute rewards
            Calls each reward function which had a non-zero scale (processed in self._prepare_reward_function())
            adds each terms to the episode sums and to the total reward
        """
        self.rew_buf[:] = 0.
        self.rew_buf_pos[:] = 0.
        self.rew_buf_neg[:] = 0.
        if self.reward_functions is not None:
            for i in range(len(self.reward_functions)):
                name = self.reward_names[i]
                rew = self.reward_functions[i]()
                if "success" not in name:
                    self.rew_buf += rew
                    if torch.sum(rew) >= 0:
                        self.rew_buf_pos += rew
                    elif torch.sum(rew) <= 0:
                        self.rew_buf_neg += rew
                self.episode_sums[name] += rew
        else:
            rew, rew_components = self.reward_container.compute_reward()
            self.rew_buf += rew
            for name, rew_term in rew_components.items():
                self.episode_sums[name] += rew_term
                if torch.sum(rew_term) >= 0:
                    self.rew_buf_pos += rew_term
                elif torch.sum(rew_term) <= 0:
                    self.rew_buf_neg += rew_term
            self.episode_sums["success"] += self.reward_container.compute_success()
        self.episode_sums["total"] += self.rew_buf

        if self.cfg.commands.num_commands > 0:
            self.command_sums["lin_vel_raw"] += self.base_lin_vel[:, 0]
            self.command_sums["ang_vel_raw"] += self.base_ang_vel[:, 2]
            self.command_sums["lin_vel_residual"] += (self.base_lin_vel[:, 0] - self.commands[:, 0]) ** 2
            self.command_sums["ang_vel_residual"] += (self.base_ang_vel[:, 2] - self.commands[:, 2]) ** 2
            self.command_sums["ep_timesteps"] += 1
 Compute rewards
            Calls each reward function which had a non-zero scale (processed in self._prepare_reward_function())
            adds each terms to the episode sums and to the total reward
        
globe_walking/go1_gym/envs/base/legged_robot.py