def timer_callback(self):
    ' Calculate Mx1, My1, ...... Mx6, My6 '
    if (self.t == 0):
        self.Phix1 = 0
        self.Phiy1 = 0
        self.Phix3 = 0
        self.Phiy3 = 0
        self.t += 1
    Mx1 = (self.x3 - self.x1)
    My1 = (self.y3 - self.y1)
    Mx3 = (self.x1 - self.x3)
    My3 = (self.y1 - self.y3)
    ' Use MLP to Predict control inputs '
    relative_pose_1 = [Mx1, My1, self.Phix1, self.Phiy1]
    relative_pose_3 = [Mx3, My3, self.Phix3, self.Phiy3]
    u1_predicted = MLP_Model.predict(relative_pose_1, loaded_model)
    u3_predicted = MLP_Model.predict(relative_pose_3, loaded_model)
    self.Phix1 = u3_predicted[0][0]
    self.Phiy1 = u3_predicted[0][1]
    self.Phix3 = u1_predicted[0][0]
    self.Phiy3 = u1_predicted[0][1]
    u1_predicted_np = np.array([[u1_predicted[0][0]], [u1_predicted[0][1]]])
    u3_predicted_np = np.array([[u3_predicted[0][0]], [u3_predicted[0][1]]])
    ' Calculate V1/W1, V2/W2, V3/W3, V4/W4, V5/W5, V6/W6 '
    S1 = np.array([[self.v1], [self.w1]])
    G1 = np.array([[1, 0], [0, (1 / L)]])
    R1 = np.array([[math.cos(self.Theta1), math.sin(self.Theta1)], [(- math.sin(self.Theta1)), math.cos(self.Theta1)]])
    S1 = np.dot(np.dot(G1, R1), u1_predicted_np)
    S3 = np.array([[self.v3], [self.w3]])
    G3 = np.array([[1, 0], [0, (1 / L)]])
    R3 = np.array([[math.cos(self.Theta3), math.sin(self.Theta3)], [(- math.sin(self.Theta3)), math.cos(self.Theta3)]])
    S3 = np.dot(np.dot(G3, R3), u3_predicted_np)
    ' Calculate VL1/VR1, VL2/VR2, VL3/VR3, VL4/VR4, VL5/VR5, VL6/VR6 '
    D = np.array([[(1 / 2), (1 / 2)], [((- 1) / (2 * d)), (1 / (2 * d))]])
    Di = np.linalg.inv(D)
    Speed_L1 = np.array([[self.vL1], [self.vR1]])
    Speed_L3 = np.array([[self.vL3], [self.vR3]])
    M1 = np.array([[S1[0]], [S1[1]]]).reshape(2, 1)
    M3 = np.array([[S3[0]], [S3[1]]]).reshape(2, 1)
    Speed_L1 = np.dot(Di, M1)
    Speed_L3 = np.dot(Di, M3)
    VL1 = float(Speed_L1[0])
    VR1 = float(Speed_L1[1])
    VL3 = float(Speed_L3[0])
    VR3 = float(Speed_L3[1])
    ' Publish Speed Commands to Robot 1 '
    msgl1 = Float32()
    msgr1 = Float32()
    msgl1.data = VL1
    msgr1.data = VR1
    self.publisher_l1.publish(msgl1)
    self.publisher_r1.publish(msgr1)
    ' Publish Speed Commands to Robot 3 '
    msgl3 = Float32()
    msgr3 = Float32()
    msgl3.data = VL3
    msgr3.data = VR3
    self.publisher_l3.publish(msgl3)
    self.publisher_r3.publish(msgr3)
    self.i += 1
Calculate Mx1, My1, ...... Mx6, My6
def timer_callback(self):
    '  '
    if (self.t == 0):
        self.Phix1 = 0
        self.Phiy1 = 0
        self.Phix3 = 0
        self.Phiy3 = 0
        self.t += 1
    Mx1 = (self.x3 - self.x1)
    My1 = (self.y3 - self.y1)
    Mx3 = (self.x1 - self.x3)
    My3 = (self.y1 - self.y3)
    ' Use MLP to Predict control inputs '
    relative_pose_1 = [Mx1, My1, self.Phix1, self.Phiy1]
    relative_pose_3 = [Mx3, My3, self.Phix3, self.Phiy3]
    u1_predicted = MLP_Model.predict(relative_pose_1, loaded_model)
    u3_predicted = MLP_Model.predict(relative_pose_3, loaded_model)
    self.Phix1 = u3_predicted[0][0]
    self.Phiy1 = u3_predicted[0][1]
    self.Phix3 = u1_predicted[0][0]
    self.Phiy3 = u1_predicted[0][1]
    u1_predicted_np = np.array([[u1_predicted[0][0]], [u1_predicted[0][1]]])
    u3_predicted_np = np.array([[u3_predicted[0][0]], [u3_predicted[0][1]]])
    ' Calculate V1/W1, V2/W2, V3/W3, V4/W4, V5/W5, V6/W6 '
    S1 = np.array([[self.v1], [self.w1]])
    G1 = np.array([[1, 0], [0, (1 / L)]])
    R1 = np.array([[math.cos(self.Theta1), math.sin(self.Theta1)], [(- math.sin(self.Theta1)), math.cos(self.Theta1)]])
    S1 = np.dot(np.dot(G1, R1), u1_predicted_np)
    S3 = np.array([[self.v3], [self.w3]])
    G3 = np.array([[1, 0], [0, (1 / L)]])
    R3 = np.array([[math.cos(self.Theta3), math.sin(self.Theta3)], [(- math.sin(self.Theta3)), math.cos(self.Theta3)]])
    S3 = np.dot(np.dot(G3, R3), u3_predicted_np)
    ' Calculate VL1/VR1, VL2/VR2, VL3/VR3, VL4/VR4, VL5/VR5, VL6/VR6 '
    D = np.array([[(1 / 2), (1 / 2)], [((- 1) / (2 * d)), (1 / (2 * d))]])
    Di = np.linalg.inv(D)
    Speed_L1 = np.array([[self.vL1], [self.vR1]])
    Speed_L3 = np.array([[self.vL3], [self.vR3]])
    M1 = np.array([[S1[0]], [S1[1]]]).reshape(2, 1)
    M3 = np.array([[S3[0]], [S3[1]]]).reshape(2, 1)
    Speed_L1 = np.dot(Di, M1)
    Speed_L3 = np.dot(Di, M3)
    VL1 = float(Speed_L1[0])
    VR1 = float(Speed_L1[1])
    VL3 = float(Speed_L3[0])
    VR3 = float(Speed_L3[1])
    ' Publish Speed Commands to Robot 1 '
    msgl1 = Float32()
    msgr1 = Float32()
    msgl1.data = VL1
    msgr1.data = VR1
    self.publisher_l1.publish(msgl1)
    self.publisher_r1.publish(msgr1)
    ' Publish Speed Commands to Robot 3 '
    msgl3 = Float32()
    msgr3 = Float32()
    msgl3.data = VL3
    msgr3.data = VR3
    self.publisher_l3.publish(msgl3)
    self.publisher_r3.publish(msgr3)
    self.i += 1