def isFinished(self):
        # Criterion for ending an episode.
        # When the agent reaches the goal, the task is considered learned.
        # When the agent falls down, the episode is over.
        dist_to_goal = self.calc_dist_to_goal()
        heading = self.calc_angle_to_goal()
        heading2 = self.env.getPsi()

        if np.abs(self.env.getTilt()) > self.max_tilt:
            print 'distance to goal ', dist_to_goal
            return True

        if dist_to_goal < 1e-3:
            print 'reached goal'
            return True

        return False
dataset/ETHPy150Open chrisdembia/agent-bicycle/randlov1998/tasks_gotorewards.py/GotoTask.isFinished/original