def after_step()

in gym-compete/gym_compete/new_envs/agents/humanoid_goalkeeper.py [0:0]


    def after_step(self, action):
        action = np.clip(action, self.action_space.low, self.action_space.high)
        forward_reward = 0.
        ctrl_cost = .1 * np.square(action).sum()
        cfrc_ext = self.get_cfrc_ext()
        contact_cost = .5e-6 * np.square(cfrc_ext).sum()
        contact_cost = min(contact_cost, 10)
        qpos = self.get_qpos()
        agent_standing = qpos[2] >= 1.0
        at_goal = (qpos[0] <= self.GOAL_X + 0.05) and (abs(qpos[1]) <= self.GOAL_Y)
        survive = 5.0 if agent_standing and at_goal else -5.
        reward = forward_reward - ctrl_cost - contact_cost + survive

        reward_info = dict()
        reward_info['reward_forward'] = forward_reward
        reward_info['reward_ctrl'] = ctrl_cost
        reward_info['reward_contact'] = contact_cost
        reward_info['reward_survive'] = survive
        reward_info['reward_move'] = reward
        # print("keeper", reward_info)

        done = bool(qpos[2] <= 0.5)

        return reward, done, reward_info