in deepracer_navigation_pkg/deepracer_navigation_pkg/deepracer_navigation_node.py [0:0]
def scale_continuous_value(self, action, min_old, max_old, min_new, max_new):
"""Helper method that return the scaled continuous action space values
from min_old, max_old to min_new, max_new.
Args:
action (float): The action value to be scaled
min_old (float): The minimum bound value before scaling
max_old (float): The maximum bound value before scaling
min_new (float): The minimum bound value after scaling
max_new (float): The maximum bound value after scaling
Returns:
(float): scaled action value
"""
if max_old == min_old:
self.get_logger().error("Unsupported minimum and maximum action space bounds for scaling values. \
min_old: {}; max_old: {}".format(min_old, max_old))
return ((max_new - min_new) / (max_old - min_old)) * (action - min_old) + min_new