in status_led_pkg/status_led_pkg/status_led_node.py [0:0]
def __init__(self):
"""Create a StatusLedNode.
"""
super().__init__("status_led_node")
self.get_logger().info("status_led_node started")
# Service to set a solid light effect with the color passed as parameter.
self.led_solid_service = self.create_service(SetStatusLedSolidSrv,
constants.LED_SOLID_SERVICE_NAME,
self.set_led_solid_callback)
# Service to set a solid blink effect with the color passed as parameter.
self.led_blink_service = self.create_service(SetStatusLedBlinkSrv,
constants.LED_BLINK_SERVICE_NAME,
self.set_led_blink_callback)
# Queue to maintain the effects to be executed.
self.effect_queue = queue.Queue()
# Thread where the effect loop is run looking for next effect to execute
# from the effect queue.
self.loop_thread = None
# List of LEDControl objects for each led_index.
self.leds = list()
# List of thread objects running the effect for each led_index.
self.threads = list()
# List of thread event objects for each led_index.
self.stop = list()
for _ in range(0, 3):
self.leds.append(None)
self.threads.append(None)
self.stop.append(threading.Event())
# Heartbeat timer.
self.timer_count = 0
self.timer = self.create_timer(5.0, self.timer_callback)