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.
        if self.cfg.rewards.reward_container_name == "OriginalReward":
            for i in range(len(self.reward_functions)):
                name = self.reward_names[i]
                rew = self.reward_functions[i]() * self.reward_scales[name]
                self.rew_buf += rew
                self.episode_sums[name] += rew
                self.command_sums[name] += rew
            if self.cfg.rewards.only_positive_rewards:
                self.rew_buf[:] = torch.clip(self.rew_buf[:], min=0.)
        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
                self.command_sums[name] += rew_term
            self.episode_sums["success"] += self.reward_container.compute_success()

        self.episode_sums["total"] += self.rew_buf

        if self.cfg.rewards.reward_container_name == "OriginalReward" and "termination" in self.reward_scales:
            rew = self.reward_container._reward_termination() * self.reward_scales["termination"]
            self.rew_buf += rew
            self.episode_sums["termination"] += rew
            self.command_sums["termination"] += rew

        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
        
forward_locomotion/go1_gym/envs/base/legged_robot.py