You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Defines the track border and gives high rewards if all 4 wheels stay on the track, which leaves it to the model to find the optimal path.
defreward_function(params):
# Example of rewarding the agent to stay inside the two borders of the track# Read input parametersall_wheels_on_track=params['all_wheels_on_track']
distance_from_center=params['distance_from_center']
track_width=params['track_width']
# Give a very low reward by defaultreward=1e-3# Give a high reward if no wheels go off the track and# the agent is somewhere in between the track bordersifall_wheels_on_trackand (0.5*track_width-distance_from_center) >=0.05:
reward=1.0# Always return a float valuereturnfloat(reward)