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