deepracer_follow_the_leader_ws/ftl_navigation_pkg/ftl_navigation_pkg/ftl_navigation_node.py [233:271]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        if categorized_throttle == 0.0 or max_speed_pct == 0.0:
            return 0.0

        # get the parameter value to calculate the coefficients a, b in the equation y=ax^2+bx
        # The lower the update_speed_scale_value parameter, higher the impact on the
        # final mapped_speed.
        # Hence the update_speed_scale_value parameter is inversely associated with max_speed_pct
        # and bounded by MANUAL_SPEED_SCALE_BOUNDS.
        # Ex: max_speed_pct = 0.5; update_speed_scale_value = 3
        #     max_speed_pct = 1.0; update_speed_scale_value = 1
        # Lower the update_speed_scale_value: categorized_throttle value gets mapped to
        # higher possible values.
        #   Example: update_speed_scale_value = 1.0;
        #            categorized_throttle = 0.8 ==> mapped_speed = 0.992
        # Higher the update_speed_scale_value: categorized_throttle value gets mapped to
        # lower possible values.
        #   Example: update_speed_scale_value = 3.0;
        #            categorized_throttle = 0.8 ==> mapped_speed = 0.501

        inverse_max_speed_pct = (1 - max_speed_pct)
        update_speed_scale_value = \
            constants.MANUAL_SPEED_SCALE_BOUNDS[0] + \
            inverse_max_speed_pct * \
            (constants.MANUAL_SPEED_SCALE_BOUNDS[1] - constants.MANUAL_SPEED_SCALE_BOUNDS[0])
        speed_mapping_coefficients = dict()

        # recreate the mapping coefficients for the non-linear equation ax^2 + bx based on
        # the update_speed_scale_value.
        # These coefficents map the [update_speed_scale_value, update_speed_scale_value/2]
        # values to DEFAULT_SPEED_SCALE values [1.0, 0.8].
        speed_mapping_coefficients["a"] = \
            (1.0 / update_speed_scale_value**2) * \
            (2.0 * constants.DEFAULT_SPEED_SCALES[0] - 4.0 * constants.DEFAULT_SPEED_SCALES[1])
        speed_mapping_coefficients["b"] = \
            (1.0 / update_speed_scale_value) * \
            (4.0 * constants.DEFAULT_SPEED_SCALES[1] - constants.DEFAULT_SPEED_SCALES[0])
        return math.copysign(1.0, categorized_throttle) * \
            (speed_mapping_coefficients["a"] * abs(categorized_throttle)**2 +
             speed_mapping_coefficients["b"] * abs(categorized_throttle))
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



deepracer_follow_the_leader_ws/webserver_pkg/webserver_pkg/vehicle_control.py [83:121]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    if categorized_throttle == 0.0 or max_speed_pct == 0.0:
        return 0.0

    # get the parameter value to calculate the coefficients a, b in the equation y=ax^2+bx
    # The lower the update_speed_scale_value parameter, higher the impact on the
    # final mapped_speed.
    # Hence the update_speed_scale_value parameter is inversely associated with max_speed_pct
    # and bounded by MANUAL_SPEED_SCALE_BOUNDS.
    # Ex: max_speed_pct = 0.5; update_speed_scale_value = 3
    #     max_speed_pct = 1.0; update_speed_scale_value = 1
    # Lower the update_speed_scale_value: categorized_throttle value gets mapped to
    # higher possible values.
    #   Example: update_speed_scale_value = 1.0;
    #            categorized_throttle = 0.8 ==> mapped_speed = 0.992
    # Higher the update_speed_scale_value: categorized_throttle value gets mapped to
    # lower possible values.
    #   Example: update_speed_scale_value = 3.0;
    #            categorized_throttle = 0.8 ==> mapped_speed = 0.501

    inverse_max_speed_pct = (1 - max_speed_pct)
    update_speed_scale_value = \
        constants.MANUAL_SPEED_SCALE_BOUNDS[0] + \
        inverse_max_speed_pct * \
        (constants.MANUAL_SPEED_SCALE_BOUNDS[1] - constants.MANUAL_SPEED_SCALE_BOUNDS[0])
    speed_mapping_coefficients = dict()

    # recreate the mapping coefficeints for the non-linear equation ax^2 + bx based on
    # the update_speed_scale_value.
    # These coefficents map the [update_speed_scale_value, update_speed_scale_value/2]
    # values to DEFAULT_SPEED_SCALE values [1.0, 0.8].
    speed_mapping_coefficients["a"] = \
        (1.0 / update_speed_scale_value**2) * \
        (2.0 * constants.DEFAULT_SPEED_SCALES[0] - 4.0 * constants.DEFAULT_SPEED_SCALES[1])
    speed_mapping_coefficients["b"] = \
        (1.0 / update_speed_scale_value) * \
        (4.0 * constants.DEFAULT_SPEED_SCALES[1] - constants.DEFAULT_SPEED_SCALES[0])
    return math.copysign(1.0, categorized_throttle) * \
        (speed_mapping_coefficients["a"] * abs(categorized_throttle)**2 +
         speed_mapping_coefficients["b"] * abs(categorized_throttle))
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



