def test_percentage_steering_angle(self): self.assertEqual(reward.percentage_steering_angle(0.0), 1.0) self.assertTrue(math.isclose(reward.percentage_steering_angle(math.radians(15.0)), 0.5)) self.assertTrue(math.isclose(reward.percentage_steering_angle(math.radians(20.0)), 1/3)) self.assertTrue(math.isclose(reward.percentage_steering_angle(math.radians(30.0)), 0.0)) self.assertTrue(math.isclose(reward.percentage_steering_angle(math.radians(-30.0)), 0.0)) self.assertTrue(math.isclose(reward.percentage_steering_angle(math.radians(-20.0)), 1/3))
def test_percentage_steering_angle(self): reward.MAX_STEERING_ANGLE = 30 self.assertEqual(reward.percentage_steering_angle(0.0), 1.0) self.assertTrue( math.isclose(reward.percentage_steering_angle(15.0), 0.5)) self.assertTrue( math.isclose(reward.percentage_steering_angle(20.0), 1 / 3)) self.assertTrue( math.isclose(reward.percentage_steering_angle(30.0), 0.0)) self.assertTrue( math.isclose(reward.percentage_steering_angle(-30.0), 0.0)) self.assertTrue( math.isclose(reward.percentage_steering_angle(-20.0), 1 / 3))