in deepracer_navigation_pkg/deepracer_navigation_pkg/deepracer_navigation_node.py [0:0]
def get_non_linearly_mapped_speed(self, scaled_action_space_speed):
"""Helper method that non linearly maps the scaled speed value to a value passed
as part of the servo message calculated as a solution to the formula y = ax^2 + bx.
Where a and b are the coffecients in the equation of a parabola (y = ax^2 + bx) passing
through the points [0, 0], [maximum_speed/2, 0.8] and [maximum_speed, 1.0].
Args:
scaled_action_space_speed (float): scaled action space speed
Returns:
float: non linearly mapped speed value between [0.0, 1.0]
"""
mapped_speed = self.speed_mapping_coeficients['a'] * scaled_action_space_speed**2 + \
self.speed_mapping_coeficients['b'] * scaled_action_space_speed
return max(min(mapped_speed, 1.0), -1.0)