0%

Amazon DeepRacer re:Invent 2018

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import math


def reward_function(params):
next_point = params['closest_waypoints'][1]
is_left_of_center = params['is_left_of_center']
speed = params['speed']

short_path_waypoint = list(range(48, 60))
is_short_path = (next_point in short_path_waypoint and not is_left_of_center) or (
next_point not in short_path_waypoint and is_left_of_center)
is_turning = next_point in list(range(22, 42))

if is_turning:
return math.sin(speed + 0.1) * 1.5 if is_short_path else math.sin(speed + 0.1)
return math.sin(speed - 1.25) * 1.25 if is_short_path else math.sin(speed - 1.25)