Vision / Position Hybrid Control for a Hexa Robot Using Bacterial Foraging Optimization in Real-time Pose Adjustment

: This paper presents a novel architecture of the vision / position hybrid control for a Hexa parallel robot. The 3D vision system is combined with the Proportional-Integral-Derivative (PID) position controller to form a two-level closed-loop controller of the robot. The 3D vision system measures the pose of the end-e ﬀ ector after the PID control. The measurement of the 3D vision system is used as a feedback of the second closed-loop control. The 3D vision system has a simple structure using two ﬁxed symmetric cameras at the top of the robot and four planar colored markers on the surface of the end-e ﬀ ector. The 3D vision system detects and reconstructs the 3D coordinates of colored markers. Based on the distance and coplanarity constraints of the colored markers, the optimization problem is modeled for the real-time adjustment, which is implemented during the operation of the robot to minimize the measurement error of the 3D vision system due to both the initial calibration of the stereo camera and the external noise a ﬀ ecting image processing. The bacterial foraging optimization is appropriately conﬁgured to solve the optimization problem. The experiment is performed on a speciﬁc Hexa parallel robot to assess the e ﬀ ectiveness and feasibility of the proposed real-time adjustment using the bacterial foraging optimization. The experimental result shows that it has high accuracy and fast computation time although the experiment is conducted on a laptop with an average hardware conﬁguration. An experimental comparison of the performance between the proposed method and another control method is also implemented. The results show the superiority and application potential of the proposed method.


Introduction
Since proposed by Stewart [1] in 1965, the parallel manipulators [2] have become popular. Several structures have been studied and proposed. A six-degree-of-freedom parallel structure was presented in [3,4], and today it is known as Hexa parallel robot. Its design is highly rigid that allows it to move and accelerate quickly with precision and stability. Therefore, it is suitable for pick and place industrial applications. However, kinematics and dynamics problems are difficult to solve [5,6]. The inverse kinematics problem is solvable in the closed-form expression while the forward kinematics problem is a multi-dimensional optimization problem with a wide search space. Therefore, a suitable algorithm needs to be selected to achieve high efficiency.
Recently, bio-inspired algorithms [26] have been a popular approach for solving complex optimization problems in science and engineering. Ni et al. [27] present a survey of a bio-inspired intelligent algorithm (BIA) and applications for robot control. Particle swarm optimization, a kind of BIA, has been proposed for some applications of robot control [28][29][30][31]. Bacterial foraging optimization (BFO) for distributed optimization and control was introduced by Passino [32] in 2002. This is an evolutionary optimization algorithm, which emulates the foraging strategy of the E. Coli bacteria. It is suitable to solve non-gradient optimization problems. In this paper, BFO is used to solve the optimization problem of the real-time adjustment of the 3DVS. The experimental results show that the BFO algorithm has high accuracy and fast computation time. Therefore, this may be a promising solution for performing simultaneous intelligent adjustments in robot control.
Based on the above discussion, the primary contributions of this paper are summarized as follows: • Although there are many studies of hybrid control in the literature, it is not often mentioned in applications of Hexa robots due to difficulty in control related to the complex structure of parallel manipulators. In this paper, a vision/position hybrid controller for Hexa parallel robot has been proposed. The 3DVS is combined with the PID position controller to form a two-level closed-loop controller of the robot. The 3DVS is designed with a simple structure consisting of one stereo camera at the top of the robot and four planar colored markers on the surface of the end-effector. Based on the colored markers, the 3DVS measures the pose of the end-effector after the PID control. The measurement of the 3DVS is used as a feedback of the second closed-loop control, which ensures achieving the desired trajectory of the robot. • Based on the distance and coplanarity constraints of the colored markers, the optimization problem is modeled to minimize the measurement error of the 3DVS due to the error of camera parameters and the external noise affecting image processing. This is the real-time adjustment, which is implemented right in the operation of the robot to self-correct errors and adapt to environmental impacts.

•
The BFO algorithm is appropriately configured to solve the optimization problem of the real-time adjustment process. The experimental results show that it has high accuracy and fast computation time although the experiment is conducted on a laptop with an average hardware configuration.
The remainder of this paper is arranged as follows: Section 2 describes the system and vision/position hybrid controller of the Hexa robot. Section 3 presents the 3DVS. Section 4 describes the real-time adjustment using BFO. Section 5 presents the calculation of the pose of the active plate. Section 6 describes the setup of the experiments. Section 7 discusses the experimental results. Section 8 is the conclusion. Figure 1 illustrates the model of the Hexa robot used in this study. The active plate is connected to the base by six pairs of arms and rods [15]. Two different coordinate systems are set on the robot. The fixed coordinate system {O} is located at the center of the base, which has the Z-axis perpendicular to the base and a positive direction facing up. The positive direction of the X-axis is towards the middle of the edge A 1 A 2 . The direction of the Y-axis is determined by the right-hand rule. The moving coordinate system {P} is located at the center of the active plate, which has the Z-axis perpendicular to the active plate and the positive direction facing up. The positive direction of the X-axis is towards the middle of the edge C 1 C 2 . The direction of the Y-axis is determined by the right-hand rule. The position of the i th arm is specified by the θ i angle. The position of the active plate is specified by the center point P(X P , Y P , Z P ) and the Euler angles (α, β, γ). Inverse kinematics equations of the Hexa robot [15] must be determined to convert the desired position of the active plate into the angles of arms. plate is specified by the center point ( , , ) P P P P X Y Z and the Euler angles ( , , )    . Inverse kinematics equations of the Hexa robot [15] must be determined to convert the desired position of the active plate into the angles of arms.    The rotation angles of arms are calculated as follow:

System Description
where  is the conversion function of the inverse kinematics problem [15]; The torque  can be expressed as follows: where  is a transfer function of the position compensator.
The PID position control is the first closed-loop for controlling the rotation angle i  of arms to reach the desired angle r  . It works efficiently and has very high accuracy. However, because of disturbance, the position i  is slid a bit to c  resulting in the position error of the active plate [15].
The disturbance may be due to the following reasons: • Dynamics are ignored in the system, so inertia and gravity affect positioning accuracy.

•
The gearbox backlash and the mechanical vibration of the system also affect the accuracy.

•
Slippage of the position of actuators due to the dynamics coupling effect between the links.
To eliminate the position error due to this disturbance, the double-loop PID control was proposed in [15]. In this paper, a 3DVS is used to measure the pose of the active plate after the first control loop. The high-accuracy measurement of the vision system is used as a feedback of the second closed-loop control, which ensures achieving the desired trajectory of the robot at high accuracy.  Figure 2 is the architecture of the hybrid controller in which a vision system is combined with a PID position controller to form a two-level closed-loop controller of the Hexa robot. x d , x i , x c , and x r are vectors (6 × 1), which include both position and orientation information. θ c , θ i , and θ r are vectors (6 × 1), which represent the rotation angles of six arms as shown in Figure 1. τ is a vector (6 × 1), which represents torques applied to the arms.  Figure 3 shows the 3DVS in the experimental model of the robot used in the study. The 3DVS includes a stereo camera fixed at the top of the robot and the colored markers on the surface of the active plate. The stereo camera points at the active plate, captures photos, and calculates the 3D coordinates of makers. The pose of the active plate i x is specified by the 3D coordinates of the markers as shown in Section 5. The measurement process of the 3DVS is presented in Figure 4. The rotation angles of arms are calculated as follow: where H is the conversion function of the inverse kinematics problem [15]; x r is the reference position of the active plate; x d is the desired position; x c is the real position measured by the 3DVS. The torque τ can be expressed as follows: where T is a transfer function of the position compensator. The PID position control is the first closed-loop for controlling the rotation angle θ i of arms to reach the desired angle θ r . It works efficiently and has very high accuracy. However, because of disturbance, the position θ i is slid a bit to θ c resulting in the position error of the active plate [15]. The disturbance may be due to the following reasons: Dynamics are ignored in the system, so inertia and gravity affect positioning accuracy.

•
The gearbox backlash and the mechanical vibration of the system also affect the accuracy.

•
Slippage of the position of actuators due to the dynamics coupling effect between the links.
To eliminate the position error due to this disturbance, the double-loop PID control was proposed in [15]. In this paper, a 3DVS is used to measure the pose of the active plate after the first control loop. The high-accuracy measurement of the vision system is used as a feedback of the second closed-loop control, which ensures achieving the desired trajectory of the robot at high accuracy. Figure 3 shows the 3DVS in the experimental model of the robot used in the study. The 3DVS includes a stereo camera fixed at the top of the robot and the colored markers on the surface of the active plate. The stereo camera points at the active plate, captures photos, and calculates the 3D coordinates of makers. The pose of the active plate x i is specified by the 3D coordinates of the markers as shown in Section 5. The measurement process of the 3DVS is presented in Figure 4.
After the measurement, the pose of the active plate x i is adjusted to minimize the error due to the initial calibration of the stereo camera and noise affecting the image processing in the measurement process. This adjustment is performed in real time using BFO as presented in Section 4.
The inverse kinematics problem and PID position control were detailed in [15]. This paper focuses on the 3DVS and real-time adjustment using BFO. After that, the experiment of hybrid control was implemented to verify the proposed method as presented in Section 6. A comparison with the traditional PID control and the double-loop PID control in [15] was also conducted to show the feasibility and superiority of the proposed method.  Figure 3 shows the 3DVS in the experimental model of the robot used in the study. The 3DVS includes a stereo camera fixed at the top of the robot and the colored markers on the surface of the active plate. The stereo camera points at the active plate, captures photos, and calculates the 3D coordinates of makers. The pose of the active plate i x is specified by the 3D coordinates of the markers as shown in Section 5. The measurement process of the 3DVS is presented in Figure 4.    After the measurement, the pose of the active plate i x is adjusted to minimize the error due to the initial calibration of the stereo camera and noise affecting the image processing in the measurement process. This adjustment is performed in real time using BFO as presented in Section 4.
The inverse kinematics problem and PID position control were detailed in [15]. This paper focuses on the 3DVS and real-time adjustment using BFO. After that, the experiment of hybrid control was implemented to verify the proposed method as presented in Section 6. A comparison with the traditional PID control and the double-loop PID control in [15] was also conducted to show the feasibility and superiority of the proposed method. Figure 5 shows the so-called pinhole camera model of the symmetric vision system. For each camera, a 3D point of the mark ( , , ) X Y Z is projected onto a point ( , ) uv in the image plane using a perspective transformation [33] in which the intrinsic and extrinsic parameters of cameras are determined by the initial calibration using checkerboard and the stereo camera calibrator of MATLAB. These parameters are used to compute rectification and undistortion transformations for each head of a camera in the 3DVS [33]. Then image frames become undistorted images, which can be used to calculate the depths and coordinates of the mark as follows:

The 3D Reconstruction of the Stereo Camera
where c D is the distance between two cameras (baseline) expressed in millimeter unit.   Figure 5 shows the so-called pinhole camera model of the symmetric vision system. For each camera, a 3D point of the mark (X, Y, Z) is projected onto a point (u, v) in the image plane using a perspective transformation [33] in which the intrinsic and extrinsic parameters of cameras are determined by the initial calibration using checkerboard and the stereo camera calibrator of MATLAB. These parameters are used to compute rectification and undistortion transformations for each head of a camera in the 3DVS [33]. Then image frames become undistorted images, which can be used to calculate the depths and coordinates of the mark as follows:

The 3D Reconstruction of the Stereo Camera
where D c is the distance between two cameras (baseline) expressed in millimeter unit. (u l , v l ) and (u r , v r ) are the projection points of the left and right cameras, respectively, expressed in the pixel unit. (c l x , c l y ) is the principal point of the left camera. f l x and f l y are focal lengths of the left camera. All parameters here are based on the undistorted image frames.
Note that, in image processing and marks detection, the projection points (u l , v l ) and (u r , v r ) are counted by real numbers instead of integers. The goal is to achieve high accuracy in the adjustment process and avoid errors due to pixel rounding because deviations per pixel can lead to a very large calculation error. The projection points of the markers in the left and right images are determined by shape, color, and area. camera. All parameters here are based on the undistorted image frames.
Note that, in image processing and marks detection, the projection points ( , ) ll uv and ( , ) rr uv are counted by real numbers instead of integers. The goal is to achieve high accuracy in the adjustment process and avoid errors due to pixel rounding because deviations per pixel can lead to a very large calculation error. The projection points of the markers in the left and right images are determined by shape, color, and area.

The Constraints of the Colored Markers
The 3DVS uses four planar colored markers to create two constraints:

•
Distance constraints: the distances from the red, yellow, and green markers to the blue mark are known constants.

•
Coplanarity constraint: four colored markers are on the surface of the plate, so their central points must be on the same plane.
These constraints will be used for the optimization problem in real-time adjustment. The coordinates of the colored markers after the adjustment are used to calculate the Euler angles of the active plate.

Distance Constraints
From (3), the coordinates of the red, yellow, and green markers are calculated as follows:

The Constraints of the Colored Markers
The 3DVS uses four planar colored markers to create two constraints:

•
Distance constraints: the distances from the red, yellow, and green markers to the blue mark are known constants.

•
Coplanarity constraint: four colored markers are on the surface of the plate, so their central points must be on the same plane.
These constraints will be used for the optimization problem in real-time adjustment. The coordinates of the colored markers after the adjustment are used to calculate the Euler angles of the active plate.

Distance Constraints
From (3), the coordinates of the red, yellow, and green markers are calculated as follows: where the notations R, Y, and G indicate the colors red, yellow, and green of markers, respectively. The distances from the blue marker to the red, yellow, and green markers are calculated respectively as follow: The distances D j are compared with the real distance D r and the errors are calculated as follows: In optimal calibration problem, the distance errors ε j are as small as possible.

Coplanarity Constraints
The plane Π passing through the red, yellow, and green markers at points (X j , Y j , Z j ) can be described by an equation of the form: with: The distance from the blue marker to the plane Π is: In an optimal calibration problem, the distance δ is as small as possible.

Real-time Adjustment Using BFO
Even though the stereo camera was initially calibrated very well, the coordinates calculated from (4) still have errors. The errors are not only due to the camera parameters but also due to the fluctuation of the light around the camera, which leads to a wrong positioning of the colored markers in image processing. The error of image processing significantly affects the results. Assume that D c = 120 mm, f x = 700 pixels, disparity = 140 pixels, and depth Z = 600 mm. If the disparity is changed only one pixel after the image processing, the depth will be Z = 595.745 mm. The error is about 4.26 mm (0.71% of depth). This error is still good when most stereo cameras on the market today have an error of about 2% of the measuring distance. However, it is not good enough for applications that require high accuracy like Hexa robots.
To eliminate the errors, a real-time adjustment is executed during the robot moving. This process will adjust the projection points to change the 3D coordinates of the colored marks into the correct values. It takes place after image processing, so it is possible to handle both the remaining error due to the initial calibration of the stereo camera and the error of image processing due to light source noise. First, the optimization problem is established. Then, the BFO algorithm is used to solve it.

The Optimization Problem
Assuming that all projection points are shifted, the calculation in (4) is adjusted as follows: where the notations B, R, Y, and G indicate the colors blue, red, yellow, and green of marks, respectively. δu sub ject to : where the errors ε j are calculated by (5) and (6). Note that, the coordinates (X j , Y j , Z j ) of the colored marks in (5) are calculated by (9). L * and U * are lower and upper boundaries of the parameters, respectively. ε d and δ d are the desired distance errors.
To determine the goodness of a solution, in programming, a total cost function will be calculated as follow: Note that the weighting values w * would be adjusted experimentally to get the best solution.

Introduction to BFO
The bacterial foraging algorithm for distributed optimization and control was introduced by Passino [32] in 2002. This is an evolutionary optimization algorithm, which emulates the foraging strategy of the E. Coli bacteria. It is suitable to solve non-gradient optimization problems. In this method, each solution will be expressed as a bacterium determined by a position vector θ. The set of solutions for the problem is expressed as a bacterial population. In foraging for food (optimizing the problem), the main action of bacteria, including gathering to a nutrient region (good solution) and avoiding noxious region (not good solution) by changing the moving direction, is called chemotaxis. Other processes, including reproduction, elimination, and dispersal, represent natural evolutionary rules: good individuals will be retained while bad ones are at risk of being eliminated. In this paper, BFO is used to solve the multi-objective optimization problem in Section 4.1.

Applying BFO for Real-time Adjustment
The flowchart of the BFO algorithm is shown in Figure 6. The position of the i th bacterium θ i is defined by a vector M × 1, where i = 1 . . . S, M = 12 is the number of parameters to be optimized including δu B l , δv B l , δu R l , δv R l , δu Y l , δv Y l , δu G l , δv G l , δu B r , δu R r , δu Y r , and δu G r as presented in Section 4.1.
The BFO parameters need to be defined including the number of bacteria S, swimming length Ns, number of chemotaxis steps Nc, number of reproduction steps Nr, number of elimination and dispersal events Ne, and the probability of elimination/dispersal Ped.
Step size of swimming C for bacteria is a vector M × 1 corresponding to the vector θ. The attractant and repellant can be calculated as follows: In the beginning, the index of the elimination and dispersal step is set to zero ( 0 l = ). where I a (i) and I r (i) are attractant and repellant, respectively, between the i th bacterium and other bacteria. The attractant and repellant can be calculated as follows:

Chemotaxis
where d attract and w attract are the depth and width of the attractant, respectively. h repellant and w repellant are the height and width of the repellant, respectively. In the beginning, the index of the elimination and dispersal step is set to zero (l = 0).

Chemotaxis
A direction vector ∆ is randomly generated for each bacterium. ∆(i) is a vector M × 1 corresponding to the vector θ. Each element of the vector ∆(i) is a random integer in the range [−1,1]. The movement (swimming) of a bacterium is done and the new position is updated as follows: In each movement, the new cost J is calculated and compared with the old values to keep the best position θ i . The new fitness F is calculated and compared with the old values. If the fitness F is improved, the swimming process will continue; otherwise, it is stopped. The health of i th bacterium H(i) is the cumulative sum of the fitness F in a chemotaxis step. The maximum iterations of the swimming process are Ns. After the swimming process, the best cost J(i), health H(i), and position vector θ i of the i th bacterium are stored to use in the reproduction step.

Reproduction
The position vectors θ i of bacteria are sorted in ascending order of the health H. The first half of the position vectors θ i will be copied and overwritten into the second half. This is to remove bad elements and retain good elements. The total number of bacteria remains the same.

Elimination and Dispersal
This step reviews all bacteria. At each position, a random number is generated. If this number is less than the probability of elimination/dispersal Ped, the elimination and dispersal event is executed. The easiest way to execute this event is to replace the current position vector with a new random vector as in the initialization step.

The Finish
After the BFO stopped, the position vector θ i with the highest health H is the optimal adjustment, which is used to calculate the correct coordinates of the colored markers by (9).

The Pose of the Active Plate
The pose is the position and orientation. After the real-time adjustment, the correct coordinates of colored markers with respect to the coordinate system of the stereo camera are transformed to the world coordinates of the Hexa robot as presented in Figure 1. The position of the active plate is specified by the world coordinate of the blue marker. The orientation (Euler angles) of the active plate is specified as follows: • The angle α (rotation around the z-axis): is the angle between the x-axis and the line passing through the blue and red markers.

•
The angle β (rotation around the y-axis): is the angle between the plane Π and the OYZ-plane, where the OYZ-plane has an equation of the form x = 0. The plane Π is described by (7).

•
The angle γ (rotation around the x-axis): is the angle between the plane Π and the OXZ-plane, where the OXZ-plane has an equation of form y = 0.

Experimental Configuration Parameters
The experiment of the proposed method is implemented on the real robot as shown in Figure 3. The control software runs on a laptop with CPU Intel Core i5-2430M, Intel HD Graphics 3000 onboard, DDR3 8 GB, SSD Intel 120 GB. Figure 7 is the interface of the control software.

Validation of the Proposed Method
To evaluate the effectiveness of the real-time adjustment using BFO, the active plate is moved through 60 different positions. The positions are selected along with the height of the workspace. The purpose is to evaluate the robustness of the proposed method because the measurement error is small at positions near the cameras and large at positions far away from the cameras. After each position, the pose of the active plate is measured by 3DVS. The measurement is recorded twice: before and after the real-time adjustment using BFO. The computation time of the BFO algorithm at each point is also measured for further analysis.

The Comparison
As discussed in Section 2, to eliminate the position error due to the disturbance, the double-loop PID controller was proposed in [15]. In this paper, the vision/position hybrid controller has been proposed. For comparison, the same experiment is repeated, in which the active plate is moved on a helix trajectory as shown in Figure 8. The angles of motors are tracked and recorded for further analysis.

Validation of the Proposed Method
To evaluate the effectiveness of the real-time adjustment using BFO, the active plate is moved through 60 different positions. The positions are selected along with the height of the workspace. The purpose is to evaluate the robustness of the proposed method because the measurement error is small at positions near the cameras and large at positions far away from the cameras. After each position, the pose of the active plate is measured by 3DVS. The measurement is recorded twice: before and after the real-time adjustment using BFO. The computation time of the BFO algorithm at each point is also measured for further analysis.

The Comparison
As discussed in Section 2, to eliminate the position error due to the disturbance, the double-loop PID controller was proposed in [15]. In this paper, the vision/position hybrid controller has been proposed. For comparison, the same experiment is repeated, in which the active plate is moved on a helix trajectory as shown in Figure 8. The angles of motors are tracked and recorded for further analysis.   Table 1 summaries the errors in the validation. The mean absolute error (MAE), mean squared error (MSE), and normalized root-mean-square error (NRMSE) are significantly reduced after the real-time adjustment using BFO. The mean absolute error is less than 0.9305 mm in axes and less than 0.2802 degrees in Euler angles. This accuracy is good enough for the most common applications of the Hexa parallel robot.    Table 1 summaries the errors in the validation. The mean absolute error (MAE), mean squared error (MSE), and normalized root-mean-square error (NRMSE) are significantly reduced after the real-time adjustment using BFO. The mean absolute error is less than 0.9305 mm in axes and less than 0.2802 degrees in Euler angles. This accuracy is good enough for the most common applications of the Hexa parallel robot.        Figure 11. Validation of the real-time adjustment using BFO in z-axis. Figure 11. Validation of the real-time adjustment using BFO in z-axis.           Figure 15 shows the computation time of the real-time adjustment using BFO. The average computation time is 149.5516 ms. The maximum computation time is 272.0304 ms. This computation time is acceptable with a non-gradient optimization problem using the BFO algorithm. Normally, Symmetry 2020, 12, 564 16 of 20 the real-time adjustment is performed at the end of each movement, so it has a negligible effect on the performance of the Hexa robot. In the future, when the computer is faster and the computation time is shorter, the parameters of the BFO algorithm could be expanded to increase the accuracy.

Validation Result
Symmetry 2020, 12, x FOR PEER REVIEW 17 of 21 Figure 15 shows the computation time of the real-time adjustment using BFO. The average computation time is 149.5516 ms. The maximum computation time is 272.0304 ms. This computation time is acceptable with a non-gradient optimization problem using the BFO algorithm. Normally, the real-time adjustment is performed at the end of each movement, so it has a negligible effect on the performance of the Hexa robot. In the future, when the computer is faster and the computation time is shorter, the parameters of the BFO algorithm could be expanded to increase the accuracy.  Figure 16-21 presents the resulted comparisons of the rotation angles between using the double-loop PID controller [15] and using the proposed vision/position hybrid controller when the active plate is moved on the helix trajectory as discussed in Section 6.3. Table 2 shows the resulted errors of the comparison. As presented in Section 2, the effect of disturbance behind the PID control loop results in position errors. In the case of double-loop PID controller, if the active plate deviates from the desired trajectory, the double-loop PID controller adjusts it to the correct position. The maximum MAE is 0.34077 degrees. In the case of the proposed hybrid controller, MSE, MAE, and NRMSE are much lower. The maximum MAE is only 0.1715 degrees. This superiority is due to the real-time adjustment using the BFO algorithm.

Comparison Result
Figures 16-21 presents the resulted comparisons of the rotation angles between using the double-loop PID controller [15] and using the proposed vision/position hybrid controller when the active plate is moved on the helix trajectory as discussed in Section 6.3. Table 2 shows the resulted errors of the comparison. As presented in Section 2, the effect of disturbance behind the PID control loop results in position errors. In the case of double-loop PID controller, if the active plate deviates from the desired trajectory, the double-loop PID controller adjusts it to the correct position. The maximum MAE is 0.34077 degrees. In the case of the proposed hybrid controller, MSE, MAE, and NRMSE are much lower. The maximum MAE is only 0.1715 degrees. This superiority is due to the real-time adjustment using the BFO algorithm.

Conclusions
In this study, a novel architecture of the vision/position hybrid controller is proposed and applied to the Hexa parallel robot. The 3DVS is combined with the PID position controller to form a two-level closed-loop controller of the robot. The 3DVS is designed with a simple structure consisting of one stereo camera at the top of the robot and four planar colored markers on the surface of the end-effector. Based on the colored markers, the 3DVS measures the pose of the end-effector after the PID control. The measurement of the 3DVS is used as a feedback of the second closed-loop control, which ensures achieving the desired trajectory of the robot. To minimize the measurement error of the 3DVS due to the error of the stereo camera parameters and the external noise affecting image processing, the optimization problem is modeled based on the distance and coplanarity constraints of the colored markers. This optimization problem is solved by using BFO in the real-time adjustment process, which is implemented right in the operation of the robot. The experiment is performed on a specific Hexa parallel robot to assess the effectiveness and feasibility of the proposed real-time adjustment using the BFO. The experimental result shows that it has high accuracy. The MAE decreased significantly from about 4.45 mm for translation and 2.14 degrees for rotation to about 0.93 mm and 0.26 degrees, respectively. The computation time of the BFO algorithm is encouraging with responses in milliseconds, although the experiment was conducted on a laptop with an average hardware configuration. Besides, the experimental comparison between the proposed method and another control method was also performed. Compared to the double-loop PID control method in another research, the MAE of rotation angles of the arms is reduced by about 50 percent. The results show the superiority and application potential of the proposed method.

Conclusions
In this study, a novel architecture of the vision/position hybrid controller is proposed and applied to the Hexa parallel robot. The 3DVS is combined with the PID position controller to form a two-level closed-loop controller of the robot. The 3DVS is designed with a simple structure consisting of one stereo camera at the top of the robot and four planar colored markers on the surface of the end-effector. Based on the colored markers, the 3DVS measures the pose of the end-effector after the PID control. The measurement of the 3DVS is used as a feedback of the second closed-loop control, which ensures achieving the desired trajectory of the robot. To minimize the measurement error of the 3DVS due to the error of the stereo camera parameters and the external noise affecting image processing, the optimization problem is modeled based on the distance and coplanarity constraints of the colored markers. This optimization problem is solved by using BFO in the real-time adjustment process, which is implemented right in the operation of the robot. The experiment is performed on a specific Hexa parallel robot to assess the effectiveness and feasibility of the proposed real-time adjustment using the BFO. The experimental result shows that it has high accuracy. The MAE decreased significantly from about 4.45 mm for translation and 2.14 degrees for rotation to about 0.93 mm and 0.26 degrees, respectively. The computation time of the BFO algorithm is encouraging with responses in milliseconds, although the experiment was conducted on a laptop with an average hardware configuration. Besides, the experimental comparison between the proposed method and another control method was also performed. Compared to the double-loop PID control method in another research, the MAE of rotation angles of the arms is reduced by about 50 percent. The results show the superiority and application potential of the proposed method.