## 3 Presenting a ROS-Based Condition Monitoring Architecture
### Conceptual Idea  
Once the connection with the cobot as an Ethernet TCP/IP client is established, it is possible to read data or execute instructions (e.g., motion commands) using the Omron TM ROS package [3]. The idea is to develop a CM architecture that runs in parallel during the normal functioning of the cobot and define a methodology to automatically analyze data to detect anomalies or malfunctions in the system. However, as discussed during the introduction, there are many aspects to consider in order to achieve this goal. For this purpose, in this Section, first we analyze a simple program to understand critical points in defining a valid CM strategy showing an example of data acquisition. Then, a solution to obtain comparable data sequences that are useful for further fault detection and diagnosis is discussed and presented. Supposing that a simple program named \"Test\" made by a sequence of motion commands is executed by the robot, like the following:  
1. Point-to-point (PTP) motion from A to B;
2. Line move from B to C;
3. PTP motion from C to A;
4. PTP motion from A to B;
5. Line move from B to D;  
Figure 1: Connection schematic view.  
6. PTP motion from D to E;
7. PTP motion from E to A;
8.... etc. During the execution, we perform acquisitions of position data for a single joint n involved in these motions (Figure 2).  
Referring to Figure 2, if we think to look for some kind of repeatability in the \"Test\" program, this can be found during the execution of the PTP motion from point A to B. In fact, as discussed in the Introduction, to identify faulty features, we need to compare data in healthy and faulty conditions. However, having comparable data means acquiring those data under certain working conditions (i.e., type of movement, speed, target positions, etc.), otherwise it becomes a struggle to define a technique for the automatic detection of anomalies. Just to clarify this last sentence, supposing now, to acquire the joint n torque position during the previously defined sequence of motions (Figure 3). It is possible to notice in Figure 3 that the torque signal shape is strictly related to the working conditions of the system and varies according to the movement executed by the cobot. Therefore, finding a way to analyze the entire signal and defining an algorithm to detect automatically defecting features (if any) taking into account every possible working condition becomes really difficult if not impossible. However, if we think to analyze the torque signal only under certain conditions (e.g., only when the system is executing the PTP motion from A to B), we can obtain comparable data sequences (blue highlighted parts of Figure 3). In this way, in the case of a joint n malfunction, detecting and identifying changes in the values of the joint n torque become easier. Hence, to solve this problem, in the next section, a method for extracting repetitive data sequences (named \"units\") is studied for the automatic detection of anomalies based on data labeling and indexing.  
Figure 2: Example of a single joint n position acquisition during the execution of the “Test” program. The colors below the graph’s \(x\) axis represent the motion commands executed during the acquisition.