in status_led_pkg/status_led_pkg/status_led_node.py [0:0]
def set_led_blink_callback(self, req, res):
"""Callback method for the led_blink service. Calls the two color siren LED effect
on the led to simulate blink with the colors passed as parameters.
Args:
req (SetStatusLedBlinkSrv.Request): Request object with led_index (int),
color1(str), color2(str) and delay(float)
time sent as part of the service call.
res (SetStatusLedBlinkSrv.Response): Response object with error(int) flag
indicating successful service call
(0: success or 1: failure).
Returns:
SetStatusLedBlinkSrv.Response: Response object with error(int) flag indicating
successful service call(0: success or 1: failure).
"""
try:
self.start(constants.SupportedLEDEffects.TWO_COLOR_SIREN,
led_index=req.led_index,
color1=req.color1,
color2=req.color2,
delay=req.delay)
res.error = 0
return res
except Exception as ex:
self.get_logger().error(f"Failed to set led blink light: {ex}")
res.error = 1
return res