in gym-compete/gym_compete/new_envs/agents/ant_fighter.py [0:0]
def after_step(self, action):
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()
center_reward = - np.sqrt(np.sum((0. - qpos[:2])**2))
agent_standing = qpos[2] - self.arena_height >= 0.28
survive = 5.0 if agent_standing else -5.
reward = center_reward - ctrl_cost - contact_cost + survive
# reward = survive
reward_info = dict()
# reward_info['reward_forward'] = forward_reward
reward_info['reward_center'] = center_reward
reward_info['reward_ctrl'] = ctrl_cost
reward_info['reward_contact'] = contact_cost
reward_info['reward_survive'] = survive
reward_info['reward_move'] = reward
done = bool(qpos[2] - self.arena_height <= 0.28)
return reward, done, reward_info