hbp_nrp_cleserver.server.ROSNotificator module¶
This module implements a ROS Notificator interface for status/error messages.
-
class
ROSNotificator
[source]¶ Bases:
object
This class encapsulates publishing of state/errors/task status to the frontend/clients.
-
publish_error
(error_msg)[source]¶ Publishes an error message
- Parameters
error_msg – and cle_ros_msgs.CLEError message to publish.
-
publish_state
(state_msg)[source]¶ Publishes a state message
- Parameters
state_msgs – A string of formatted JSON to publish.
-
start_task
(task_name, subtask_name, number_of_subtasks, block_ui)[source]¶ Sends a status notification that a task starts on the ROS status topic. This method will save the task name and the task size in class members so that it could be reused in subsequent call to the update_task method.
- Param
task_name: Title of the task (example: initializing experiment).
- Param
subtask_name: Title of the first subtask. Could be empty (example: loading Virtual Room).
- Param
number_of_subtasks: Number of expected subsequent calls to update_current_task(_, True, _).
- Param
block_ui: Indicate that the client should block any user interaction.
-
task_notifier
(task_name, subtask_name)[source]¶ Task notifier context manager
- Parameters
task_name –
subtask_name –
-
update_task
(new_subtask_name, update_progress, block_ui)[source]¶ Sends a status notification that the current task is updated with a new subtask.
- Param
subtask_name: Title of the first subtask. Could be empt (example: loading Virtual Room).
- Param
update_progress: Boolean indicating if the index of the current subtask should be updated (usually yes).
- Param
block_ui: Indicate that the client should block any user interaction.
-