Frontiers in Computing and Intelligent Systems ISSN: 2832-6024 | Vol. 11, No. 1, 2025 22 The Simulation of Pose Control for Stewart Platform Based on Gain‐Enhanced PID with Generalized Boolean Algebra Ke Ouyang, Jin Chen *, Zhongtao Cao, Wenqiang Li School of Shanghai Polytechnic University, Shanghai 201209, China * Corresponding author: Jin Chen (Email: 996821784@qq.com) Abstract: Due to the nonlinear and time-varying uncertainties commonly present in practical industrial systems, traditional PID controllers often fail to achieve optimal control performance under significant input variations. This paper proposes a gain- enhanced PID control method optimized by generalized Boolean algebra, applying Boolean algebraic logic control strategies to traditional PID control to improve parameter adaptability and real-time control performance. Using MATLAB/Simulink simulation tools, a dual-loop control simulation model is established for the Stewart platform, incorporating both conventional PID control and the gain-enhanced PID control optimized by generalized Boolean algebra. Both models are configured with identical PID parameters for simulation, and comparative experimental results are presented. The experimental results demonstrate that, in the Simulink simulation model of the Stewart platform's pose control system, the proposed gain-enhanced PID control system optimized by generalized Boolean algebra improves the dynamic performance and response speed compared to the traditional PID control system, enhancing the real-time performance and stability of the Stewart platform control. Keywords: Generalized Boolean Algebra; Variable Gain PID; Simulink Simulation; Stewart Platform. 1. Introduction The main components of the Stewart platform include an upper platform, a lower platform, and six actuating rods that can undergo free extension and retraction. Typically, the upper platform serves as the load platform and is capable of six degrees of freedom in motion, while the lower platform is fixed to the ground [1]. Compared to serial mechanisms, the Stewart platform offers advantages such as superior dynamic performance, high rigidity, strong load-bearing capacity, compact structure, and high positioning accuracy [2]. These features make it widely used in various fields such as entertainment, marine, aerospace, and manufacturing. Due to the strong coupling, nonlinearity, significant interference, and the difficulty of establishing mathematical models, as well as the relatively poor dynamic performance and adaptability of traditional PID controllers, this paper addresses the high real- time and positioning accuracy requirements of the six-degree- of-freedom parallel platform. An optimized variable gain PID controller based on Boolean algebra is designed to enhance the system's dynamic performance and real-time response. 2. Electromechanical Cylinder-Driven Stewart Platform 2.1. Kinematic Modeling of the Stewart Platform The schematic of the Stewart platform under study is shown in Figure 1. Before developing the complete kinematic model, the following assumptions are established: The center point of the upper platform is denoted as OL= [x, y,z,α,β,γ], where x,y,z represent the translational displacements of the center point OL of the upper platform relative to the center point Ow of the lower platform along the x, y, and z axes, i.e., the movement of the moving coordinate system relative to the base coordinate system. The angles α, β, γ represent the rotational angles of the upper platform's coordinate system about the x, y, and z axes of the lower platform, i.e., the rotation of the moving coordinate system relative to the base coordinate system. Figure 1. Stewart Platform Coordinate System Diagram In Figure 1, W−xyz denotes the world coordinate system (static coordinate system), L−xyz represents the relative coordinate system (moving coordinate system), P1, P2, P3, P4, P5, P6 are the hinge points of the upper platform, and B1, B2, B3, B4, B5, B6 are the hinge points of the lower platform. The upper and lower platforms are connected by linkages and electric cylinders, where the linkage vectors Li (for i=1,2,...,6) correspond to the vectors BiPi. This paper uses Euler angles α,β,γ to describe the rigid body pose through rotational transformations about the Z, Y, and X axes. The Euler transformation R(α,β,γ) is expressed as: R α,β,γ =R z,α R y,β R x,γ (1) 23 where: R z,α = cosγ -sinγ 0 sinγ cosγ 0 0 0 1 (2) R y,β = cos β 0 sinβ 0 1 0 -sinβ 0 cosβ (3) R x,γ = 1 0 0 0 cosα -sinα 0 sinα cosα (4) From the above equations, the composite rotation matrix R(α,β,γ) is given by: R α,β,γ = cγcβ sγsβsα-sγcα cγsβcα+sγsα sγcβ sγsβsα+cwcα sγsβcα-cγsα -sβ cβsα cβcα (5) where c and s denote the cosine and sine functions, respectively. 2.2. Kinematic Inverse Solution of the Stewart Platform When the center position of the moving platform and the Euler angles of rotation, i.e., OL=[x,y,z,α,β,γ], are known, the task is to solve for the lengths of the actuators. This is known as the kinematic inverse solution of the Stewart platform. In this paper, an analytical method is employed to solve the kinematic inverse problem, and the following definitions are made: Let i=(i=1,2,…,6), where ni represents the unit vector of the spatial position of the i -th actuator, Li is the length of the i -th actuator, and Lini corresponds toBiPi. bi represents BiOw, P is DwDL , and pi is OLPi . For the analysis of the spatial vector of the i-th actuator branch, as shown in Figure 2, according to the spatial vector law, the following equation holds: wbi+Li wni=wp+wpi (6) This leads to the expression for the length of the actuator: Li= wp+wRL Lpi- wbi T wp+wRL Lpi- wbi (7) where wRL is the rotation matrix R(α,β,γ) representing the transformation from the coordinate system {OL} to the coordinate system {Ow}. Figure 2. Vector Diagram of the i-th Actuator Branch 2.3. Kinematic Forward Solution of the Stewart Platform The kinematic forward solution of the Stewart parallel mechanism involves determining the pose of the end-effector platform (position and orientation) given the initial lengths and variations of the actuators. The kinematic forward problem of parallel mechanisms is quite complex, mainly due to the highly nonlinear nature of the system of equations, the large computational load, and the existence of multiple solutions, which makes it difficult to solve using conventional methods [3]. Zhang Hui [4] and others from Tsinghua University compared four methods for solving the kinematic forward problem: analytical methods, search methods, optimization methods, and iterative methods. They found that the solution obtained using the Newton-Raphson method converges quickly and effectively, providing high accuracy. However, this method relies on the choice of initial guess, and an improper initial guess may cause the algorithm to fail to converge. In this study, a dynamic initial value correction method is adopted. If non-convergence is detected during iteration, the initial guess is corrected using a correction coefficient, and the Newton iteration is restarted. The forward kinematic equation can be derived from the inverse kinematic equation, i.e., equation (4), with some modifications. However, due to the complexity of representing the forward kinematic equation analytically, it is expressed using vectors or matrices. Let: Fi 5 i=0 x,y,z,α,β,γ = wp+wRL Lp -wbι T wp+wRL Lpι- wbι -Li 2 (8) Next, we apply the Newton-Raphson iteration formula: xn+1=xn-f(xn)/f'(xn) (9) Iteration is an infinite approximation process. However, considering the practical constraints of control time and computation time, the iteration process is limited to a finite number of steps. In practice, the iteration process is stopped when the absolute difference between consecutive iterations is smaller than the allowed error εε, i.e., when: ∣xn-xn-1∣<ε (10) 3. Variable Gain PID Control Algorithm Optimized Based on Generalized Boolean Algebra 3.1. Principle of the PID Control Algorithm PID control is a method of controlling a system by applying a linear combination of proportional, integral, and derivative operations on the deviation (target value - actual value) [5]. The structural framework of the PID control algorithm is shown in Figure 3. Figure 3. Structure Block Diagram of PID Control Algorithm 24 The expression of the PID control algorithm is given by: u(t)=kpe(t)+ki∫e(t)dt+kd de(t) dt (11) Where Kp, Ki, and Kd are the key parameters of the controller, representing the proportional, integral, and derivative coefficients, respectively. The proportional term Kp ensures that the controlled variable moves in the direction of reducing the error. The integral term Ki eliminates steady-state error, improving system accuracy. The derivative term Kd adjusts the system's dynamic performance or disturbance rejection capabilities. 3.2. Disadvantages of Traditional PID Control Algorithm in Controlling Input Time- varying Uncertain Systems Traditional non-adaptive PID parameters are generally constant, and once they are tuned and set, they do not change significantly. This becomes very limiting for complex and dynamic industrial systems, as well as for achieving high- precision control. For example, in a two-phase hybrid stepper motor position control system, the same PID controller parameters Kp=26, Ki=8.8, and Kd=4.9 are used to control target positions of 100mm and 200mm. A simulation model of the system is established in MATLAB/Simulink, and the control results are shown in Figure 4. In this study, a two- phase hybrid stepper motor is used to control the output rod length. Therefore, the PID controlled system is modeled by the transfer function of the position loop of the two-phase hybrid stepper motor. G(s)= 4.1851 s2+0.0283s+4.1851 (12) Figure 4. Traditional PID control effect with large input variation As can be clearly seen from Figure 4, the controller tuning effect for the target value of 100mm is very good with this set of control parameters. However, for the target value of 200mm, the same set of parameters results in a noticeable delay in the controller's output adjustment and a larger steady- state error. This issue arises from the suboptimal performance of the traditional PID controller when applied to time-varying and uncertain input systems. Therefore, this study proposes a variable-gain PID control optimized based on general Boolean algebra to adapt to changes in the controlled object's characteristics. 3.3. The Principle of Gain-Varying PID Control Optimized Based on Generalized Boolean Algebra The control strategy based on the controller designed according to generalized Boolean algebra theory is shown in Table 1. In Table 1, Kn (where n=0,1,…,4) represents the coefficients of the five control strategies adopted by the generalized Boolean controller, corresponding to the following control actions: hold, fine-tune, weak-tune, slightly-tune, and emphasize. The subscript nn indicates the strength of the control action. The input variables in Table 1 are explained as follows: the target rod length r(t), which represents the six rod length values obtained from the inverse kinematics algorithm of the Stewart platform for the target pose; the actual rod length c(t) at a given time; the rod length error e(t), defined as e(t)=r(t)−c(t)e(t)=r(t)−c(t); the cumulative rod length error ∫e(t)d(t); the rate of change of the rod length error de(t) d(t) ; the dead zone for the error (±ε), which defines the acceptable range of actual rod length error (e.g.,±0.1 mm); the dead zone for the rate of change of the error (±δ), which defines the acceptable range of the actual rate of change of the rod length error (e.g., ±0.1 mm); and the system's allowable steady-state error [±e(∞)], which defines the acceptable range for the cumulative rod length error (e.g., ±0.1 mm) [7][8][8][9]. The controller output variable is the rod length at the current time, expressed as: Kn(PID)=Kn[Kpe(t)+Ki∫e(t)dt+Kdde(t)/dt] (n=0,1…4) (13) For different motion characteristics of the generalized Boolean control system at a given moment, the control process can be illustrated as follows: when e(t)>0.1,∫e(t)dt≤0.1,and de(t) d(t) >0.1, this motion characteristic indicates that the controller's output needs to be strengthened to adjust the rod length more aggressively. In this case, the "emphasize" control strategy should be applied, selecting K3 as the gain coefficient for the PID calculation, i.e., the controller output will be: K3(PID)=K3[Kpe(t)+Ki∫e(t)dt+Kdde(t)/dt] Table 1. Generalized Boolean PID Control Truth Table e(t) ∫e(t)dt de(t)/dt >δ ≤δ <-δ >ε >e(∞) K4(PID) K4(PID) K3(PID) ≤e(∞) K3(PID) K3(PID) K3(PID) <-e(∞) K3(PID) K3(PID) K3(PID) ≤ε >e(∞) K2(PID) K1(PID) K1(PID) ≤e(∞) K1(PID) K0(PID) K1(PID) <-e(∞) K1(PID) K1(PID) K2(PID) <-ε >e(∞) K4(PID) K4(PID) K3(PID) ≤e(∞) K3(PID) K3(PID) K3(PID) <-e(∞) K3(PID) K3(PID) K3(PID) 25 On the other hand, when e(t)≤0.1, ∫e(t)dt≤0.1, and >0.1, this motion characteristic indicates that the current controller output is already very close to the target rod length, and only a fine-tuning control strategy is required. In this case, K1 should be selected as the gain coefficient for the PID calculation, so the controller output will be: K1(PID)=K1[Kpe(t)+Ki∫e(t)dt+Kdde(t)/dt] 4. Design of Pose Control System for Stewart Platform and Its Simulink Simulation Implementation 4.1. Design of Dual-Loop Control System for Attitude and Position Loops in Stewart Platform This paper presents a dual-loop control system for the pose control of a parallel six-degree-of-freedom platform, where the attitude loop is the outer PID loop and the motor-driven rod length position loop is the inner loop. The control system design structure is shown in Figure 4. From a closed-loop structure perspective, the dual-loop control system consists of two negative feedback loops. The attitude loop PID controller and the position loop are connected in a cascade configuration, with the position loops based on the generalized Boolean algebra-optimized variable-gain PID controllers. The six position loops are connected in parallel, each using a generalized Boolean algebra-optimized variable-gain PID controller. For a given set of target platform pose values (x, y, z, α, β, γ), the current platform pose is obtained either through the Stewart kinematics forward solution module or pose sensors. The current pose is then compared with the target pose to form the attitude loop PID control. The output of the attitude loop PID controller is processed through the Stewart kinematics inverse solution module to calculate the required rod lengths for the six actuators. These calculated rod lengths are then fed as inputs to the six motor position loops, each based on the generalized Boolean algebra-optimized variable-gain PID controllers. The output of these controllers, representing the current rod lengths, is compared with the target rod lengths to form the closed-loop control of the position loops. Figure 5. Structural Block Diagram of the Pose Control System for a Stewart Platform 4.2. Simulink Simulation Implementation Based on the previously discussed forward and inverse kinematics of the Stewart platform and the variable gain PID control principle optimized by generalized Boolean algebra, a Matlab/Simulink model for the pose control of the parallel six-degree-of-freedom platform is established, as shown in Figure 6. The forward and inverse kinematics of the Stewart platform are implemented by coding in the S- function module in Simulink, with the radius of the lower platform set to R=175 mm and the radius of the upper platform set to r=135 mm. As described earlier, the positions of the joint points in their respective coordinate systems are obtained, and the pose inverse kinematics of the Stewart platform can be derived through analytical methods. The forward kinematics are similarly derived and will not be repeated here. Figure 6. Simulink Simulation Model for Stewart Platform Pose Control 26 The Simulink simulation models of the generalized Boolean PID controller are shown in Figures 7, 8and9. Figure 7. The Simulink-based partial simulation model of the Gain-Enhanced PID with Generalized Boolean Algebra Figure 8. The Simulink-based partial simulation model of the Gain-Enhanced PID with Generalized Boolean Algebra Figure 9. The Simulink-based partial simulation model of the Gain-Enhanced PID with Generalized Boolean Algebra 5. Comparison and Analysis of Controller Performance In this study, the Simulink simulation solver is configured to use a variable-step solver, specifically the ode45 (Dormand-Prince) solver. The minimum step size is set to 0.01, and the maximum step size is set to "auto." The parameters of the Boolean algebra-optimized variable-gain PID controller are set as follows: Kp=26, Ki=8.8, Kd=5.8, K0=1,K1=1.2,K2=1.4,K3=1.6,and K4=1.8. To compare the control performance of the Boolean algebra-optimized variable-gain PID controller with the traditional PID controller, the parameters of the traditional PID controller are set to Kp=26, Ki=8.8, and Kd=5.8 based on the principle of single-variable testing. The simulation experiments compare the control performance of both controllers on a Stewart platform with a target pose of (x,y,z,α,β,γ)=(22.9098,−17.8869,97.6143, −3.9260,2.3843,18.3712). The inverse kinematics calculation for this pose yields the following six leg lengths (in mm): 200.6856, 108.6878, 168.4683, 130.0941, 158.3568, and 115.0001. The control effects for the Stewart platform pose using the Boolean algebra-optimized variable-gain PID controller are shown in Figure 10, while the results for the traditional PID controller are shown in Figure 11. The 27 comparison of the actuator control effects for the individual branches, using both the Boolean algebra-optimized variable- gain PID controller and the traditional PID controller, is provided in Figures 12-17. In terms of attitude control for the Stewart platform, the Boolean algebra-optimized PID controller clearly demonstrates faster convergence. Specifically, the six system outputs for the target pose (x,y,z,α,β,γ) converge to the target values in approximately 1.2 seconds, whereas the outputs for the traditional PID controller in the x, y, α, β, and γ directions take at least 1.4 seconds to reach the target values. The z- direction output of the traditional PID controller takes approximately 2 seconds to begin converging toward the target value of 97.6143. The direct outputs of the position control loop for the actuators in the inner loop provide a more straightforward view of the control performance. It is evident that the Boolean algebra-optimized variable- gain PID controller offers superior dynamic performance, stability, real-time response, and accuracy compared to the traditional PID controller. Figure 10. The control performance of the Boolean algebra- optimized variable-gain PID controller for the Stewart platform pose Figure 11. The control performance of the traditional PID controller for the Stewart platform pose Figure 12. Comparison of the control effects of the Boolean algebra-optimized variable-gain PID and traditional PID controllers for the first branch leg length Figure 13. Comparison of the control effects of the Boolean algebra-optimized variable-gain PID and traditional PID controllers for the second branch leg length Figure 14. Comparison of the control effects of the Boolean algebra-optimized variable-gain PID and traditional PID controllers for the third branch leg length Figure 15. Comparison of the control effects of the Boolean algebra-optimized variable-gain PID and traditional PID controllers for the fourth branch leg length Figure 16. Comparison of the control effects of the Boolean algebra-optimized variable-gain PID and traditional PID controllers for the fifth branch leg length Figure 17. Comparison of the control effects of the Boolean algebra-optimized variable-gain PID and traditional PID controllers for the sixth branch leg length 6. Conclusion This paper addresses the issue that traditional PID controllers cannot achieve ideal control performance when there are large variations in the input. To solve this problem, a Boolean algebra-optimized variable-gain PID control algorithm is proposed. This approach integrates traditional PID control techniques with a Boolean algebra logic control system. By leveraging the disturbance rejection and real-time capabilities of Boolean algebra logic control, the algorithm enhances the dynamic performance, real-time response, and control accuracy of the traditional PID control method. In the study, a Simulink simulation model of a parallel six- degree-of-freedom platform pose control system is developed in the MATLAB environment to compare the performance of the two controllers in controlling the Stewart platform, which exhibits high coupling, low linearity, and time-varying adopts a uncertainties. The control strategy cascaded dual-loop 28 control system consisting of the platform attitude loop and the motor-driven leg position loop. The results show that, compared to the traditional PID control system, the Boolean algebra-optimized PID control system offers superior dynamic performance, improved stability, and better real-time response. References [1] wart D.A platform with six degrees of freedom[J].Proceedings of the Institution of Mechanical Engineers.Part A:Jour— nal ofPower and Energy,1965,180(15):371-386. [2] Wang, H. (2019). Research on precise calibration of Stewart platform based on improved cuckoo algorithm (Master's thesis). University of Chinese Academy of Sciences, Beijing. [3] Geng, M., Zhao, T., Wang, C., et al. (2015). Forward kinematics solution of parallel mechanisms based on quasi- Newton method. Journal of Mechanical Engineering, 51(9), 28-36. [4] Zhang, H., Wang, Q., Ye, P., et al. (2002). General kinematic forward numerical solution method and its application for Stewart platform. Journal of Mechanical Engineering, 38(Supplement), 108-111. [5] Guo L. Feedback and uncertainty: Some basic problems and results. Annual Reviews in Control, 2020,49: 27-36. [6] Zhang, N. (2005). New Control Principles [M]. Beijing: National Defense Industry Press. [7] Chen, J., Chen, G., Wang, Z., et al. (2011). Parameter space analysis of PID generalized Boolean algebra controller. In Proceedings of the 30th Chinese Control Conference, Vol. D (pp. XXX-XXX). Beijing: Control Theory Professional Committee, Chinese Association of Automation. [8] Li, H., Yang, T., Peng, D. (2016). Research and development of a temperature controller based on embedded ARM platform. Automation Instrumentation, 37(3), 95-98. [9] Liu, K. (2012). Research on iterative learning control algorithm for direct blowing pulverizing system (Master's thesis). Changsha University of Science and Technology, Changsha