def getReward(self):
        # Lagoudakis (2002) reward function
        # reward = (net change in tilt^2) + (net change in dist_to_goal^2) * 0.01
        if self.rewardType == 1 :
            # Lagoudakis reward function
            delta_tilt = self.env.getTilt()**2 - self.env.last_omega**2
            delta_dist = self.calc_last_dist_to_goal() - self.calc_dist_to_goal()
            return -delta_tilt - delta_dist * 0.01
                
        if self.rewardType == 2 :
            # proportional reward
            if np.abs(self.env.getTilt()) > self.max_tilt:
                return -1
                
            dist_to_goal = self.calc_dist_to_goal()
            if dist_to_goal == 0:
                return 1
            # range [0.1856 - 1]
            tiltReward = 1/((10*self.env.getTilt())**2 + 1)
            # ~0.1 to ~1
            distReward = 10/dist_to_goal + 1
            headingReward = 5/((10*self.env.getPSIG())**2 + 1)
            #print tiltReward, distReward, headingReward
            return tiltReward + 0.1*distReward + 0.01*headingReward
dataset/ETHPy150Open chrisdembia/agent-bicycle/randlov1998/tasks.py/LSPIGotoTask.getReward/swapped operands of `-`