in deepracer_navigation_pkg/deepracer_navigation_pkg/deepracer_navigation_node.py [0:0]
def set_throttle_scale_cb(self, req, res):
"""Callback for the navigation_throttle service. Allows clients to dynamically set the
throttle scale value while the car is in autonomous driving mode.
Args:
req (NavThrottleSrv.Request): Request object with the throttle scale value.
res (NavThrottleSrv.Response): Response object with error(int) flag to indicate
if the service call was successful.
Returns:
NavThrottleSrv.Response: Response object with error(int) flag to indicate
if the service call was successful.
"""
self.throttle_scale = req.throttle
self.get_logger().info(f"Setting throttle to {req.throttle}")
res.error = 0
return res