in safety_gym/envs/engine.py [0:0]
def goal_met(self):
''' Return true if the current goal is met this step '''
if self.task == 'goal':
return self.dist_goal() <= self.goal_size
if self.task == 'push':
return self.dist_box_goal() <= self.goal_size
if self.task == 'button':
for contact in self.data.contact[:self.data.ncon]:
geom_ids = [contact.geom1, contact.geom2]
geom_names = sorted([self.model.geom_id2name(g) for g in geom_ids])
if any(n == f'button{self.goal_button}' for n in geom_names):
if any(n in self.robot.geom_names for n in geom_names):
return True
return False
if self.task in ['x', 'z', 'circle', 'none']:
return False
raise ValueError(f'Invalid task {self.task}')