**4. Control**

184 Serial and Parallel Robot Manipulators – Kinematics, Dynamics, Control and Optimization

conducting experiment are listed in the experiment tab. Instrumentation tab allows building instrument panels in order to change and monitor the variables of a model. Supported simulations and connected boards are shown in platform tab. Test automation tab has

Bottom side is called "Tool Window" having log viewer, file selector, interpreter and open experiment tabs. It is seen errors and warnings in the log viewer tab and files under selected

In order to create a GUI for an experiment, it should be opened an empty layout from filenew layout click. A lot of instruments are listed in the instrument selector right side on the control desk. Virtual instruments and data acquisition elements are shown in Figure 7 below. An instrument can be placed on the layout plotting with mouse left clicked after selecting from virtual instruments panel. Its position and size can be changed and its properties such as color, text, precision and etc can be settled according to needs. It can be

functions about automation tasks, other software solution of Dspace.

saved and added to an experiment after completing GUI.

folder are listed where an application can be loaded by drag and drop action.

Fig. 7. Virtual instruments and data acquisition in the instruments selector window

A controller is needed to move top platform from initial position to desired position and orientation. It will generate required forces for each motor. Position and trajectory control of the platform can be reduced to leg position control after inverse kinematic and path planning algorithms. A PID (proportional-integrator-derivative) and sliding mode position controllers were developed and implemented. Control algorithms designed in Simulink environment and embedded in the Dspace DS1103 real time controller.

All robots are electro-mechanic devices consisting of actuators, sensors and mechanical structure. In order to control the robots for desired motions kinematic and dynamic equations of the system should be known. Firstly kinematic solution should be computed before controller design. A schematic model of the SP for kinematic solution is illustrated in Figure 9. In the figure, base *B={X,Y,Z}* and top *T={x,y,z}* coordinate systems are placed and base and top joint points are labeled as *B*i (i=1,2, .. 6) and *T*i (i=1,2, .. 6).

It is needed to find leg lengths to reach the moving platform to its desired position and orientation according to fixed platform (inverse kinematics). Required leg vectors ( *Li* ) for given position vector *P* and orientation matrix *R* are obtained by using the following equation. Finally, norm of the vectors ( *Li* ) are leg lengths ( *<sup>i</sup> l* ) (Fitcher, 1986; Kim & Chung, 1999; Sefrioui & Gosselin, 1993).

$$L\_i = R\_{XYZ}T\_i + P - B\_i \qquad \text{i : 1, 2, ..., 6} \tag{1}$$

In order to have *Ti* and *Bi* position vectors based on robot structure, an m-file is written and a Simulink model is designed to obtain inverse kinematic solution by using Equation 1. The model shown in Figure 10 uses the m-file to get required variables and takes the desired position (*x*, *y*, *z*) and orientation (*φ, θ, ψ*) of the top platform. It outputs the leg lengths. Desired block in this model is shown in Figure 11. The reference inputs can be entered in this block.

Position Control and Trajectory Tracking of the Stewart Platform 187

The leg system is basically composed of dc motor, precision linear bearing & ball screw and

+ -

 *m m*

*<sup>m</sup>* is the motor position (*radian*),

is the load torque, *Va* is the armature voltage (*V*),

(2)

(3)

*m ma K i* (4)

(5)

*l* 

*Jm*

*<sup>m</sup>* is

*b*

coupling elements. Dc motor model is given below (Küçük & Bingül, 2008).

*La Ra*

*Em ai*

Controller

*dt*

 

*La* is the armature inductance (*H*), *Ra* is the armature resistance (*Ω*), *Em* is the reverse EMF (*V*), *ai* is the armature current (*A*), *Kb* is the reverse EMF constant, *Km* is the torque constant.

> *<sup>a</sup> a aa a m di L Ri V E*

> > *<sup>m</sup> m b <sup>d</sup> E K*

*<sup>m</sup> ml m d J dt* 

Before controller design a startup algorithm is needed to get robot to its home position. The position of each motor is controlled after startup. Motors have incremental encoders therefore firstly they must be brought their zero or home position. When SP system is energized, an index search algorithm looks what the position of the each leg is. The algorithm simply searches index signal of the leg and when it is found encoders are reset by hardware. Designed Simulink model for this purpose is illustrated in Figure 13. Movements to the home position for possible two situations (from upper and lower sides to zero) are

*dt* 

> 2 2

**4.1 Leg model** 

Driver

*Va*

Fig. 12. DC motor model

**4.2 Startup algorithm** 

shown in Figure 14.

The symbols represent the following variables here;

the produced torque by the motor (*Nm*), *<sup>l</sup>*

Fig. 9. Schematic diagram of the Stewart platform

Fig. 10. Simulink model for inverse kinematic solution

Fig. 11. A subsystem for desired references

#### **4.1 Leg model**

186 Serial and Parallel Robot Manipulators – Kinematics, Dynamics, Control and Optimization

*B*5

*B*6

*T*5

*B*1

*<sup>T</sup>*<sup>6</sup> 16.41456206°

*T*2

*T*1

*B*<sup>4</sup> *B*<sup>3</sup>

*T*<sup>4</sup> *T*<sup>3</sup>

*B*2

25.68141134°

293.26616983

Fig. 9. Schematic diagram of the Stewart platform

Fig. 10. Simulink model for inverse kinematic solution

Fig. 11. A subsystem for desired references

*B*

*<sup>l</sup>* <sup>2</sup>*<sup>l</sup>* <sup>3</sup>*<sup>l</sup>* <sup>4</sup>*<sup>l</sup>* <sup>5</sup>*<sup>l</sup>* <sup>6</sup>*<sup>l</sup>*

1

250

188.67975191

*T*

The leg system is basically composed of dc motor, precision linear bearing & ball screw and coupling elements. Dc motor model is given below (Küçük & Bingül, 2008).

#### Fig. 12. DC motor model

The symbols represent the following variables here; *<sup>m</sup>* is the motor position (*radian*), *<sup>m</sup>* is the produced torque by the motor (*Nm*), *<sup>l</sup>* is the load torque, *Va* is the armature voltage (*V*), *La* is the armature inductance (*H*), *Ra* is the armature resistance (*Ω*), *Em* is the reverse EMF (*V*), *ai* is the armature current (*A*), *Kb* is the reverse EMF constant, *Km* is the torque constant.

$$L\_a \frac{di\_a}{dt} + R\_a i\_a = V\_a - E\_m \tag{2}$$

$$E\_m = K\_b \frac{d\theta\_m}{dt} \tag{3}$$

$$
\pi\_m = \mathcal{K}\_m \dot{\imath}\_a \tag{4}
$$

$$
\tau\_m - \tau\_l = \mathcal{J}\_m \frac{d^2 \theta\_m}{dt^2} \tag{5}
$$

#### **4.2 Startup algorithm**

Before controller design a startup algorithm is needed to get robot to its home position. The position of each motor is controlled after startup. Motors have incremental encoders therefore firstly they must be brought their zero or home position. When SP system is energized, an index search algorithm looks what the position of the each leg is. The algorithm simply searches index signal of the leg and when it is found encoders are reset by hardware. Designed Simulink model for this purpose is illustrated in Figure 13. Movements to the home position for possible two situations (from upper and lower sides to zero) are shown in Figure 14.

Position Control and Trajectory Tracking of the Stewart Platform 189

( ) sin 2

*t t y y t t yt y y y t t t t*

0 0

with zero.

0

10

0

20


0

mm/sn2

the Equation 6.

follows.

**4.4 PID controller** 

5

mm/sn

5

mm

10

*f*

<sup>0</sup> 0 0

0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2

0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2

0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2

time (sec)

Equation 6 was embedded in Simulink block. Only end position and path period is given to this structure and other parameters are automatically calculated. This form of motion starts and finishes with zero velocity and zero acceleration. Position, velocity and acceleration values are quite soft changes. This is very important for motors to start and stop more softly. Main model of the trajectory planning with reference inputs is shown in Figure 16 below. Detail of the blocks named 'path' in the Figure 16 is shown in Figure 17 which implements

PID control is one of the classical control methods and widely used in the industrial applications. The difference between the set point and the actual output is represented by the *e(t)* error signal. This signal is applied to a PID controller, control signal, *u(t)* is as

> () () () () *PI D <sup>d</sup> u t K e t K e t dt K e t*

*dt*

(7)

Fig. 15. An example of trajectory generation with Kane function

where *y(t)* is the position function, *y0* is the initial position, *yf* is the finish position, *t* is time, *t0* is initial time and *tf* is the finish time. An example of the trajectory generation is given below (Figure 15) using Equation 6. As can be seen from figure, position, velocity and acceleration curves are given for two seconds and velocity and acceleration start and finish

2 *f*

*f f*

0 0

(6)

position

velocity

acceleration

Fig. 13. Simulink model for initialization algorithm

Fig. 14. Initialization routine

#### **4.3 Trajectory generation**

For step inputs, the leg lengths obtained from inverse kinematics solution input to independent position control system for each motor. This movement is defined in the joint space. In order to move robot along a straight line, a trajectory planning algorithm is developed. Thus, it can be determined start and stop times of the motion besides desired position and orientation inputs. Also, motors are synchronized each other during the motion. If classical polynomial-based trajectory equations are examined, the following deficiencies are determined: i) there are need many initial and finish values in order to find the polynomial coefficients ii) the acceleration values, especially initially require high levels, iii) the coefficients need to be calculated again each time when the conditions changes. Kane's transition function is used to resolve these shortcomings and it is given the following equation (Reckdahl, 1996).

Fig. 13. Simulink model for initialization algorithm

0 1 2 3 4 5

0 1 2 3 4 5

from lower side to zero

from upper side to zero

Time (sec)

0

0

Fig. 14. Initialization routine

**4.3 Trajectory generation** 

equation (Reckdahl, 1996).

0.05

PWM Duty Cycle

0.1

0.05

PWM Duty Cycle

0.1


0.02



Leg Length

For step inputs, the leg lengths obtained from inverse kinematics solution input to independent position control system for each motor. This movement is defined in the joint space. In order to move robot along a straight line, a trajectory planning algorithm is developed. Thus, it can be determined start and stop times of the motion besides desired position and orientation inputs. Also, motors are synchronized each other during the motion. If classical polynomial-based trajectory equations are examined, the following deficiencies are determined: i) there are need many initial and finish values in order to find the polynomial coefficients ii) the acceleration values, especially initially require high levels, iii) the coefficients need to be calculated again each time when the conditions changes. Kane's transition function is used to resolve these shortcomings and it is given the following

0

Leg Length

0 1 2 3 4 5

0 1 2 3 4 5

Time (sec)

$$y(t) = y\_0 + \left(y\_f - y\_0\right)\frac{t - t\_0}{t\_f - t\_0} - \frac{y\_f - y\_0}{2\pi}\sin\left(2\pi\frac{t - t\_0}{t\_f - t\_0}\right) \tag{6}$$

where *y(t)* is the position function, *y0* is the initial position, *yf* is the finish position, *t* is time, *t0* is initial time and *tf* is the finish time. An example of the trajectory generation is given below (Figure 15) using Equation 6. As can be seen from figure, position, velocity and acceleration curves are given for two seconds and velocity and acceleration start and finish with zero.

Fig. 15. An example of trajectory generation with Kane function

Equation 6 was embedded in Simulink block. Only end position and path period is given to this structure and other parameters are automatically calculated. This form of motion starts and finishes with zero velocity and zero acceleration. Position, velocity and acceleration values are quite soft changes. This is very important for motors to start and stop more softly. Main model of the trajectory planning with reference inputs is shown in Figure 16 below. Detail of the blocks named 'path' in the Figure 16 is shown in Figure 17 which implements the Equation 6.

#### **4.4 PID controller**

PID control is one of the classical control methods and widely used in the industrial applications. The difference between the set point and the actual output is represented by the *e(t)* error signal. This signal is applied to a PID controller, control signal, *u(t)* is as follows.

$$u(t) = K\_P e(t) + K\_I \int e(t)dt + K\_D \frac{d}{dt}e(t) \tag{7}$$

Position Control and Trajectory Tracking of the Stewart Platform 191

contains some subsystems such as leg trajectory, encoder, initial, PID, pwm and sign. These

Project has a Control Desk interface for experiments and it is shown below. All system information can be entered through this interface. It contains variables that can be used in the development phase. Reference input values can be easily entered through the interface. Leg trajectory subsystem detail was given before, so it will be continued giving other blocks. Firstly, encoder subsystem given in Figure 20 is described. Each encoder is read using an encoder block and then pulses are converted to metric unit (mm) and scaled. Round

subsystem shown in Figure 21 is used to eliminate errors less than 500 nanometer.

Fig. 19. Control Desk GUI for data acquisition and parameter update

Fig. 18. Main PID controller Simulink model

subsystems perform the tasks mentioned above.

Fig. 16. Reference inputs with trajectory planning

Fig. 17. Implementing Equation 6 in Simulink model

General control schema is summarized as follows: initialization, reference input, inverse kinematic, measurement, closed loop controller, input/outputs and additional blocks for safety reasons. Main PID Simulink model diagram is given Figure 18 below. The model

Fig. 16. Reference inputs with trajectory planning

Fig. 17. Implementing Equation 6 in Simulink model

General control schema is summarized as follows: initialization, reference input, inverse kinematic, measurement, closed loop controller, input/outputs and additional blocks for safety reasons. Main PID Simulink model diagram is given Figure 18 below. The model

Fig. 18. Main PID controller Simulink model

contains some subsystems such as leg trajectory, encoder, initial, PID, pwm and sign. These subsystems perform the tasks mentioned above.

Project has a Control Desk interface for experiments and it is shown below. All system information can be entered through this interface. It contains variables that can be used in the development phase. Reference input values can be easily entered through the interface.

Leg trajectory subsystem detail was given before, so it will be continued giving other blocks. Firstly, encoder subsystem given in Figure 20 is described. Each encoder is read using an encoder block and then pulses are converted to metric unit (mm) and scaled. Round subsystem shown in Figure 21 is used to eliminate errors less than 500 nanometer.

Fig. 19. Control Desk GUI for data acquisition and parameter update

Position Control and Trajectory Tracking of the Stewart Platform 193

Initial subsystem model is shown in Figure 23 and its details were given before. It takes the index signals of the motors and produces a predefined duty cycle value for PWM

Motors are controlled using 25 KHz PWM signals for amplitude and sign signals for motor directions according to controller outputs. In order to generate PWM signals slave dsp of the DS1103 is used. PWM block in the main model is given below. Saturation blocks are used to determine upper limit of the PWM duty cycles. In Figure 24, PWM and sign subsystems in

After creating controller model and user interfaces, experiments can be done and results can be observed. Firstly, PID parameters were determined via trial-error experiments in order to obtain desired responses. A lot of experiments can be done simply and system responses can be taken easily. Output data can be saved '\*.mat' extension in order to analyze in detail in Matlab. Some real time responses are given below. For 1 *mm* motion along the *z* direction,

An orientation step response in *x* direction and a 500 *nm* step response in *z* direction were given in Figure 26. As can be seen from figures, PID parameters were selected to obtain fast rising time, no steady state error and smaller overshoot. PID controller works in a wide

responses of the legs with references and control outputs are shown in Figure 25.

range between 500 *nm* to 100 *mm* with good control behavior.

generation, motor direction signals and status of the initialization routine.

Fig. 23. Initial subsystem

the main model are shown.

**4.4.1 Position control** 

Fig. 20. Encoder subsystem

Fig. 21. Round subsystem

A PID controller is added for each leg. These subsystems are shown in figure below. It is a classic way of creating simple and efficient closed control loops.

Fig. 22. PID subsystem in main model and simple PID structure

A PID controller is added for each leg. These subsystems are shown in figure below. It is a

classic way of creating simple and efficient closed control loops.

Fig. 22. PID subsystem in main model and simple PID structure

Fig. 20. Encoder subsystem

Fig. 21. Round subsystem

Initial subsystem model is shown in Figure 23 and its details were given before. It takes the index signals of the motors and produces a predefined duty cycle value for PWM generation, motor direction signals and status of the initialization routine.

### Fig. 23. Initial subsystem

Motors are controlled using 25 KHz PWM signals for amplitude and sign signals for motor directions according to controller outputs. In order to generate PWM signals slave dsp of the DS1103 is used. PWM block in the main model is given below. Saturation blocks are used to determine upper limit of the PWM duty cycles. In Figure 24, PWM and sign subsystems in the main model are shown.

### **4.4.1 Position control**

After creating controller model and user interfaces, experiments can be done and results can be observed. Firstly, PID parameters were determined via trial-error experiments in order to obtain desired responses. A lot of experiments can be done simply and system responses can be taken easily. Output data can be saved '\*.mat' extension in order to analyze in detail in Matlab. Some real time responses are given below. For 1 *mm* motion along the *z* direction, responses of the legs with references and control outputs are shown in Figure 25.

An orientation step response in *x* direction and a 500 *nm* step response in *z* direction were given in Figure 26. As can be seen from figures, PID parameters were selected to obtain fast rising time, no steady state error and smaller overshoot. PID controller works in a wide range between 500 *nm* to 100 *mm* with good control behavior.

Position Control and Trajectory Tracking of the Stewart Platform 195

0 2 4 x 10-4

0 2 4 x 10-4

Several trajectory experiments were performed using trajectory generation algorithm mentioned in section 4.3. If motion time and end points are entered in to the user interface, the trajectory is created automatically and motion starts. In order to show the performance of trajectory tracking, some examples are given below. For these examples, references, trajectories and leg errors are illustrated in Figure 27-31. Several cases are examined in the

> 0 0.01

> 0 0.01

> 0 0.01

(a) (b)

Fig. 27. (a) Trajectory tracking in *z* direction (b) Errors of the legs

0 1 2 3 4

Ref. Out.

0 1 2 3 4

0 1 2 3 4

Time (sec)

<sup>0</sup> <sup>1</sup> <sup>2</sup> <sup>3</sup> <sup>4</sup> <sup>5</sup> -0.01

<sup>0</sup> <sup>1</sup> <sup>2</sup> <sup>3</sup> <sup>4</sup> <sup>5</sup> -0.01

<sup>0</sup> <sup>1</sup> <sup>2</sup> <sup>3</sup> <sup>4</sup> <sup>5</sup> -0.01

Time (sec)

Responses of the Legs (mm)

0 2 4 x 10-4

0 2 4 x 10-4

0 2 4 x 10-4

Errors of the Legs (mm)

0 0.01

0 0.01

0 0.01 0 1 2 3 4

0 1 2 3 4

0 1 2 3 4

Time (sec)

<sup>0</sup> <sup>1</sup> <sup>2</sup> <sup>3</sup> <sup>4</sup> <sup>5</sup> -0.01

<sup>0</sup> <sup>1</sup> <sup>2</sup> <sup>3</sup> <sup>4</sup> <sup>5</sup> -0.01

<sup>0</sup> <sup>1</sup> <sup>2</sup> <sup>3</sup> <sup>4</sup> <sup>5</sup> -0.01

Time (sec)

0 1 2 3 4

0 1 2 3 4

0 1 2 3 4

Time (sec)

**4.4.2 Trajectory control** 

Responses of the Legs (mm)

Ref. Out. -1 0

0 0.2 0.4

0 0.5 1

0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5

0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5

Time (sec)

<sup>0</sup> <sup>1</sup> <sup>2</sup> <sup>3</sup> <sup>4</sup> -2

0 1 2 3 4

0 1 2 3 4

Time (sec)

Fig. 26. (a) 1º rotation in *x* direction (b) 500 *nm* linear motion in *z* direction

(a) (b)



> 0 1 2

results.

0 0.2 0.4 0.6 0.8 1 rot x pos x rot y pos y rot z pos z

0 0.2 0.4 0.6 0.8 1

Legs (mm)

References (mm)

Fig. 24. PWM and Sign subsystems shown in the main model

Fig. 25. (a) 1 *mm* step response of the top position in *z* direction (b) PID controller outputs

Fig. 26. (a) 1º rotation in *x* direction (b) 500 *nm* linear motion in *z* direction

#### **4.4.2 Trajectory control**

194 Serial and Parallel Robot Manipulators – Kinematics, Dynamics, Control and Optimization

Fig. 24. PWM and Sign subsystems shown in the main model

0 1 2 3

<sup>0</sup> <sup>1</sup> <sup>2</sup> <sup>3</sup> -10

<sup>0</sup> <sup>1</sup> <sup>2</sup> <sup>3</sup> -10

<sup>0</sup> <sup>1</sup> <sup>2</sup> <sup>3</sup> -10

Time (sec)

Control Outputs




<sup>0</sup> <sup>1</sup> <sup>2</sup> <sup>3</sup> -10

<sup>0</sup> <sup>1</sup> <sup>2</sup> <sup>3</sup> -10

<sup>0</sup> <sup>1</sup> <sup>2</sup> <sup>3</sup> -10

Time (sec)




Fig. 25. (a) 1 *mm* step response of the top position in *z* direction (b) PID controller outputs

0 1 2 3

0 1 2 3

Time (sec)

(a) (b)

Responses of the Legs (mm)

Ref. Out.

0 0.5 1

0 0.5 1

0 0.5 1

0 1 2 3

0 1 2 3

0 1 2 3

Time (sec)

0 0.5 1

0 0.5 1

0 0.5 1 Several trajectory experiments were performed using trajectory generation algorithm mentioned in section 4.3. If motion time and end points are entered in to the user interface, the trajectory is created automatically and motion starts. In order to show the performance of trajectory tracking, some examples are given below. For these examples, references, trajectories and leg errors are illustrated in Figure 27-31. Several cases are examined in the results.

Fig. 27. (a) Trajectory tracking in *z* direction (b) Errors of the legs

Position Control and Trajectory Tracking of the Stewart Platform 197

0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5

<sup>0</sup> 0.5 <sup>1</sup> 1.5 <sup>2</sup> 2.5 <sup>3</sup> 3.5 <sup>4</sup> 4.5 <sup>5</sup> -4

Time (sec)

Nonlinear control has a very important role in the robot control applications. An important reason for this situation is to create knowledge-based systems which simplify the modeling of complex dynamics in the robot control. SMC is one of the suitable methods used in the

SMC is a special case of the variable structure control systems. Variable structure control systems have a structure using feedback control laws and decision making laws together. Decision-making rule called as switching function selects a special feedback control structure according to the behavior of the system. Variable structure control system is designed to force the system states to slide a special surface called the sliding surface in the state space. Once the sliding surface is reached, the SMC tries to keep the states very close to

If it is considered the change in the position error, second order equation of motion given

*x a x a x f t bu*

*a1*, *a2* and *b* are the positive parameters and *f(t)* is a function depending on load torque,

and as Equation 10 is linear and doesn't depend on *f(t),* sliding mode on the s = 0 line allows

(8)

<sup>0</sup> 1 2 *u u sign s s cx x* ( ), (9)

1 1 *cx x* 0 (10)

*r m* 

(Utkin, 1993).

with Equation 2, 3, 4 and 5 can be written as follows according to *x*<sup>1</sup>

1 2

*x x*

2 11 22

rot x pos x rot y pos y rot z pos z

knowledge-based systems (Küçük & Bingül, 2008).

the sliding surface (Küçük & Bingül, 2008).

reference input and their derivatives in Equation 8.

For discontinuous control:

to decreasing error exponentially.

Legs (mm)

Fig. 31. Linear motion in *y* direction

**4.5 Sliding mode controller** 

References (mm)

Fig. 28. (a) Trajectory tracking in *z* direction (b) Leg errors

Fig. 29. (a) Rotation in *x* direction (b) Rotation in *x* direction

Fig. 30. (a) Rotation in *z* direction (b) Linear motion in *x* direction

Fig. 31. Linear motion in *y* direction

#### **4.5 Sliding mode controller**

196 Serial and Parallel Robot Manipulators – Kinematics, Dynamics, Control and Optimization

0 5

0 5 x 10-3

0 0.01

> 0 0.02 0.04 0.06 0.08

rot x pos x rot y pos y rot z pos z

Legs (mm)

References (mm)

Legs (mm)

References (radian)

<sup>0</sup> <sup>1</sup> <sup>2</sup> <sup>3</sup> <sup>4</sup> <sup>5</sup> -5

<sup>0</sup> <sup>1</sup> <sup>2</sup> <sup>3</sup> <sup>4</sup> <sup>5</sup> -5

<sup>0</sup> <sup>1</sup> <sup>2</sup> <sup>3</sup> <sup>4</sup> <sup>5</sup> -0.01

Time (sec)

x 10-3 Errors of the Legs (mm)

<sup>0</sup> <sup>1</sup> <sup>2</sup> <sup>3</sup> <sup>4</sup> <sup>5</sup> -5

<sup>0</sup> <sup>1</sup> <sup>2</sup> <sup>3</sup> <sup>4</sup> <sup>5</sup> -5

<sup>0</sup> <sup>1</sup> <sup>2</sup> <sup>3</sup> <sup>4</sup> <sup>5</sup> -5

Time (sec)

rot x pos x rot y pos y rot z pos z

0 5 x 10-3

0 5 x 10-3

0 5 x 10-3

0 0.5 1 1.5 2 2.5 3 3.5 4 4.5

<sup>0</sup> 0.5 <sup>1</sup> 1.5 <sup>2</sup> 2.5 <sup>3</sup> 3.5 <sup>4</sup> 4.5 <sup>5</sup> -10

0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5

<sup>0</sup> 0.5 <sup>1</sup> 1.5 <sup>2</sup> 2.5 <sup>3</sup> 3.5 <sup>4</sup> 4.5 <sup>5</sup> -2

Time (sec)

Time (sec)

rot x pos x rot y pos y rot z pos z

(a) (b)

(a) (b)

(a) (b)

Fig. 30. (a) Rotation in *z* direction (b) Linear motion in *x* direction

Fig. 28. (a) Trajectory tracking in *z* direction (b) Leg errors

0.5 1 1.5 2 2.5 3 3.5 4 4.5 5

<sup>0</sup> 0.5 <sup>1</sup> 1.5 <sup>2</sup> 2.5 <sup>3</sup> 3.5 <sup>4</sup> 4.5 <sup>5</sup> -10

Time (sec)

0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5

<sup>0</sup> 0.5 <sup>1</sup> 1.5 <sup>2</sup> 2.5 <sup>3</sup> 3.5 <sup>4</sup> 4.5 <sup>5</sup> -2

Time (sec)

Fig. 29. (a) Rotation in *x* direction (b) Rotation in *x* direction

0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5

0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5

Time (sec)

0 0.5 1 References (mm)

> 0 0.5 1

0 0.02 0.04 0.06 0.08

rot x pos x rot y pos y rot z pos z

> rot x pos x rot y pos y rot z pos z

0 0.01 0.02 0.03 0.04 0.05

Legs (mm)

References (radian)

Legs (mm)

References (radian)

Legs (mm)

Nonlinear control has a very important role in the robot control applications. An important reason for this situation is to create knowledge-based systems which simplify the modeling of complex dynamics in the robot control. SMC is one of the suitable methods used in the knowledge-based systems (Küçük & Bingül, 2008).

SMC is a special case of the variable structure control systems. Variable structure control systems have a structure using feedback control laws and decision making laws together. Decision-making rule called as switching function selects a special feedback control structure according to the behavior of the system. Variable structure control system is designed to force the system states to slide a special surface called the sliding surface in the state space. Once the sliding surface is reached, the SMC tries to keep the states very close to the sliding surface (Küçük & Bingül, 2008).

If it is considered the change in the position error, second order equation of motion given with Equation 2, 3, 4 and 5 can be written as follows according to *x*<sup>1</sup> *r m* (Utkin, 1993).

$$\begin{aligned} \dot{\mathbf{x}}\_1 &= \mathbf{x}\_2\\ \dot{\mathbf{x}}\_2 &= -a\_1 \mathbf{x}\_1 - a\_2 \mathbf{x}\_2 + f\left(t\right) - bu \end{aligned} \tag{8}$$

*a1*, *a2* and *b* are the positive parameters and *f(t)* is a function depending on load torque, reference input and their derivatives in Equation 8.

For discontinuous control:

$$
\mu = \mu\_0 \text{sign}(\mathbf{s}), \qquad \mathbf{s} = \mathbf{c}\mathbf{x}\_1 + \mathbf{x}\_2 \tag{9}
$$

and as Equation 10 is linear and doesn't depend on *f(t),* sliding mode on the s = 0 line allows to decreasing error exponentially.

$$
\dot{\alpha}\mathbf{x}\_1 + \dot{\mathbf{x}}\_1 = \mathbf{0} \tag{10}
$$

Derivative of the sliding surface is:

$$\dot{s} = c\mathbf{x}\_2 - a\_1\mathbf{x}\_1 - a\_2\mathbf{x}\_2 + f(t) - bu\_0 \text{sign}(s) \tag{11}$$

From equation,

$$
\delta u\_0 > \left| c\mathbf{x}\_2 - a\_1 \mathbf{x}\_1 - a\_2 \mathbf{x}\_2 + f(t) \right| \tag{12}
$$

*s* and *s* have opposite signs and the state 0 *s* will approach the sliding line after a while. Inequality given with Equation 12 determines the required voltage to force the system to sliding mode (Utkin, 1993).

A candidate Lyapunov function can be selected as follows for stability analysis (Kassem & Yousef, 2009),

$$
v = \frac{1}{2}\sigma^2\tag{13}$$

Position Control and Trajectory Tracking of the Stewart Platform 199

controller. This integrator is switched on only small limited range between ± 0,008 mm. This integrator does not affect the performance of sliding mode controller. It does not slow down the system response. Also, integrator is disabled during trajectory tracking by switching.

Some real time responses for position control are given below. In Figure 34, errors of the legs were shown in the motions linear and rotation in the *x* and *z* direction with 15 *mm* and 20º inputs. As can be seen from the figures, overshoot and steady state error are very small. But,

> -5 0 5

0 10 20

> -5 0 5

Fig. 34. (a) Linear motion in *x* direction with 15 *mm* reference (b) Rotation in *z* direction with

Figure 35 shows a phase diagram of the system with SMC. In the phase diagram, the states of the system are leg position and leg velocity. As can be seen from the figure, SMC pushes states to sliding line and the states went to the desired values along sliding line when 5 *mm*

<sup>0</sup> <sup>1</sup> <sup>2</sup> <sup>3</sup> <sup>4</sup> <sup>5</sup> -10

<sup>0</sup> <sup>1</sup> <sup>2</sup> <sup>3</sup> <sup>4</sup> <sup>5</sup> -10

<sup>0</sup> <sup>1</sup> <sup>2</sup> <sup>3</sup> <sup>4</sup> <sup>5</sup> -10

Time (sec)

Errors of the Legs (mm)

0 10 20

> -5 0 5

0 10 20

<sup>0</sup> <sup>1</sup> <sup>2</sup> <sup>3</sup> <sup>4</sup> <sup>5</sup> -10

<sup>0</sup> <sup>1</sup> <sup>2</sup> <sup>3</sup> <sup>4</sup> <sup>5</sup> -10

<sup>0</sup> <sup>1</sup> <sup>2</sup> <sup>3</sup> <sup>4</sup> <sup>5</sup> -10

Time (sec)

Fig. 33. Simulink model of SMC with integrator for one leg

**4.5.1 Position control** 

system response is slower.

Errors of the Legs (mm)

0 0.2 0.4


<sup>0</sup> <sup>1</sup> <sup>2</sup> <sup>3</sup> <sup>4</sup> <sup>5</sup> -0.2

0 1 2 3 4 5

0 1 2 3 4 5

Time (sec)

(a) (b)

step input along the *z* axis in Cartesian space was applied to the system.

0 1 2 3 4 5

0 1 2 3 4 5

<sup>0</sup> <sup>1</sup> <sup>2</sup> <sup>3</sup> <sup>4</sup> <sup>5</sup> -0.2

20º reference

Time (sec)


0 0.2 0.4

The stability condition from Lyapunov's second theorem,

$$\frac{1}{2}\frac{d\sigma^2}{dt} = \sigma\dot{\sigma} \le -K|\sigma|\tag{14}$$

where *K* is a positive constant.

After theoretical steps, sliding mode controller was designed in Simulink similar to PID controller. Main model is shown in Figure 32. Details of some subsystems different from using subsystems in PID will be given only.

Fig. 32. Main sliding mode controller model

"smc" subsystem is shown in the Figure 33. This model contains sliding mode control and integrator algorithm for one leg. In order to reduce the chattering, a rate limiter block was added to output. In order to eliminate the steady state error, an integrator was added to the

Fig. 33. Simulink model of SMC with integrator for one leg

controller. This integrator is switched on only small limited range between ± 0,008 mm. This integrator does not affect the performance of sliding mode controller. It does not slow down the system response. Also, integrator is disabled during trajectory tracking by switching.
