How to generate sin curve from these params?

98 Views Asked by At

Im reading this article https://medium.com/axel-springer-tech/how-to-win-aws-deepracer-ce15454f594a

I want to apply the same steering reward function but I don't know how the author get these numbers:

reward *= math.sin(0.4949 * (0.475 * (speed - 1.5241) + 0.5111 * steering_angle ** 2))

Their speed is 0-8 and steering -15 to 15 while my speed is 0-4 and steering -30 to 30.

When I input speed 1 and steering_angle 15 I expect a high reward because 15 degrees need a slower speed.

Appreciate any help thanks

1

There are 1 best solutions below

0
On BEST ANSWER

I used Wolfram Alpha with

plot sin(0.4949 * (0.475 * (s - 1.5241) + 0.5111 * a^2)) for s in (0,8) and for a in (-5,5)

to plot it ($s$ - speed, $a$ - steering angle):

enter image description here

It looks like it could be written down formula for the 3D reward function: enter image description here

mentioned before.

Such a form of the reward function could be prepared and adjusted by hand - take a symmetric function (e.g., sine with an offset of $\frac{\pi}{2}$), and then use Desmos or Geogebra, for example, to plot, modify and check the best values for your case. The square seems to take into the account negative values of the steering angle.