## 2 Materials and Methods
### Implementation
#### 2.2.1 Mid-Level Nodes  
The mid-level nodes process information provided by the sensors and services of the TIAGo robot and issue commands to the actuators and services. These nodes are categorized by their functionality:  
* Navigation node: The robot implements the ROS stack navigation (see [[http://wiki.ros.org/navigation](http://wiki.ros.org/navigation)]([http://wiki.ros.org/navigation](http://wiki.ros.org/navigation)), date accessed 4 June 2024) for autonomous navigation and it is leveraged for use in assistive tasks. For this purpose, a map of the environment has to be generated beforehand. Then, on this map, the points of interest (POIs) are saved in a list with an ID associated with them. POIs are those locations where containers can be found like the position of the robot in front of the table, and where the user can be found, which is the position in front of the bed. In this way, the coordinator or web app nodes will request this navigation node to move to a POI by providing its ID.
* Vision node: This node scans images to identify ArUco markers and calculate their 3D positions in space. This node constantly executes a loop, scanning RGB images from both cameras (head and gripper) by using the library aruco_ros (see [[https://wiki.ros.org/aruco_ros](https://wiki.ros.org/aruco_ros)]([https://wiki.ros.org/aruco_ros](https://wiki.ros.org/aruco_ros)), date accessed 13 August 2024), which provides real-time marker-based 3D pose estimation. However, just the corner pixels will be used. When an ArUco marker is detected, the pixel centroid is computed and published along with its number ID by ROS topic. In  
Figure 3: Diagram of the software structure implemented.  
addition, a modified image with the centroid, ID, and bounding box is plotted for visualization, like in the example from Figure 4.  
Regarding markers detected with the RGB-D camera on the head, their position in space can also be determined. For this purpose, the value of the depth image corresponding to the centroid pixel is used, and the coordinates are computed using the camera's intrinsic parameters. This information is also published via ROS topics.
* Manipulation node: This node is composed of three sub-nodes to control the head, the gripper, and the arm-torso group, as previously shown in Figure 3. The head control enables the routine coordinator to request a specific point in space for the camera to focus on. This is achieved by calculating the values of the pan and tilt controllers based on the intrinsic parameters of the camera. The gripper control involves commanding the gripper controllers to either open to their maximum aperture or close until no further movement is achieved, indicating a grip. On the other hand, the MoveIt library [30] is used to control the arm-torso group. This allows us to plan safe trajectories that avoid self-collision and to define constraints or virtual obstacles.
* TTS node: This node is for the text-to-speech (TTS). Explanatory behavior is a crucial feature of a human assistive robot [31]. For this purpose, at the beginning of each routine or movement, the coordinator node requests advice through the TTS node on which the task or action is to be performed. This node also receives requests to'speak' social expressions, e.g., salutations, when initiated.
* Diagnosis node: This node collects information about the robot's state and publishes it to the web app for its display. This information includes the battery level, current state (stop or move), current sub-task (e.g., navigating), localization values, and actuator state (normal or overheat). In case an alert occurs, like a low battery level, this node commands the TTS to inform about the issue.