## 3 Error Correction Framework
### Stage 2: Realtime (Dynamic) Error Correction  
The UR5 controller CB2 has a limit of data exchange at 10 Hz for normal communication and 125 Hz for realtime communication [16]. The realtime 125 Hz frequency is not guaranteed by the Universal Robot [16]. The packets can be lost or missed using the realtime port, so the RTDE (realtime data exchange) software package is recommended for using critical realtime communication [17]. RTDE is only available for controller CB3 or above [17]. The best available robot to carry out the project at that time was a Comau NM45 with a C4G controller. The realtime position update can be enabled using the sensor tracking option for the C4G controller [18]. The ABB provides a similar tracking for dynamic error  
Figure 2: CEC system architecture. correction through the add-on package called DPM (dynamic pose modification), but that also requires explicit control and a sensor mechanism for applying the error correction [10]. The NRTEC (network control system for realtime error correction and compensation) used the SoA (service-oriented architecture) design pattern. The system was developed using a modular approach through web services for the communication between those modules. Each module is independent of each other, yet communicate and contribute to the system to function. Figure 5 gives the basic architecture of the system. It illustrates the system flow and the components involved in the system. The purpose of the NRTEC system manager is to receive the robot position from the robot controller and measured robot position from the Leica Tracker through the network. It also provides the error feedback to the error correction and compensation module to perform the calibration procedure. It also sends the error feedback to the database for logging and analysis purposes. The error correction and compensation module then gives the compensated positional output to the robot controller so it can fix the robot position. It also gives the position output to the network-based controller to close the loop. The database stores the information about the resources (e.g., Leica Tracker, robot), activities performed during the process, the output of the activities and the output of the whole process. It also stores the measured position of the robot, error and the position reported by  
Figure 3: Small-scale system flow chart (**Left**) and physical cell (**Right**). **Networked-Based Control System:** This includes the control system (MPC: model-based predictive controller) to form the feedback loop in the system. The major advantage it gives in NRTEC is its compatibility with realtime systems. PID is the simplest controller, to begin with, and was used until stage 1 for the static error correction. MPC is a multivariable controller [19], which means multiple variables can be controlled by implementing MPC in the system. It helps to control multiple variables at the same time and can apply adjustments to them. In our case, that is compensation. MPC is needed for specifically controlling the error in each variable. There are six variables involved in the positional and orientation error correction: X, Y and Z for the position and rotation around that axis RX, RY and RZ. MPC is implemented to control the error in each axis and its rotation. 2. **Calibration Calculation:** The main purpose of the system is to correct robot's kinematical errors, which can occur because of its geometry, weight, noise or temperature. The mathematical calibration model for kinematic positional error correction is used. The kinematics error correction is chosen to correct the geometrical errors in the robot system. The errors are calculated using the DH (Denavit-Hartenberg) model. 3. **Robot Control Programs:** The robot controller has a set of programs that help to provide data to the other modules such as NCS (networked control system) and the calibration calculation module. It holds the program for: i. Position feedback, which gives the current robot position--in the robot controller coordinate system. ii.