def calc_dist_to_goal(self):
        # Returns distance to goal. Distance is zero whenever the
        # front tire is within the goal radius.
        # unpack variables
        x_goal = self.env.x_goal
        y_goal = self.env.y_goal
        r_goal = self.env.r_goal
        xf = self.env.getXF()
        yf = self.env.getYF()
        
        sqrd_dist_to_goal = ( x_goal - xf )**2 + ( y_goal -yf )**2 
        temp = np.max([0, sqrd_dist_to_goal - r_goal**2])

        return np.sqrt(temp)
dataset/ETHPy150Open chrisdembia/agent-bicycle/randlov1998/tasks.py/LSPIGotoTask.calc_dist_to_goal/original