Skip to content

Commit

Permalink
refactor(hmi_node.py): extract status_publisher_timer_period_sec vari…
Browse files Browse the repository at this point in the history
…able for better readability and maintainability

refactor(tts_node.py): extract status_publisher_timer_period_sec variable for better readability and maintainability
  • Loading branch information
maciejmajek committed Sep 9, 2024
1 parent 3e50e72 commit f83b024
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/rai_hmi/rai_hmi/hmi_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,11 @@ def __init__(self):
String, "to_human", 10, callback_group=self.callback_group
)

status_publisher_timer_period_sec = 0.25
self.create_timer(
0.25, self.status_callback, callback_group=self.callback_group
status_publisher_timer_period_sec,
self.status_callback,
callback_group=self.callback_group,
)

self.status_publisher = self.create_publisher(String, "hmi_status", 10) # type: ignore
Expand Down
4 changes: 3 additions & 1 deletion src/rai_tts/rai_tts/tts_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ def __init__(self):
self.job_id: int = 0
self.queued_job_id = 0
self.tts_client = self._initialize_client()
self.create_timer(0.25, self.status_callback)

status_publisher_timer_period_sec = 0.25
self.create_timer(status_publisher_timer_period_sec, self.status_callback)
threading.Thread(target=self._process_queue).start()
self.get_logger().info("TTS Node has been started") # type: ignore
self.threads_number = 0
Expand Down

0 comments on commit f83b024

Please sign in to comment.