**4. Robot system integrating robot controller and PLC**

The XML file in **Figure 9** is a configuration file consisting of programs of robot task, PLC, and an input/output data processing. As shown in **Figure 9**, the program consists of three periodic threads, where the period of all SW modules is 10 ms. main.so consists of a ladder program, which is converted to C/C++ program, and a C++ program that calls the program, which is shown in **Figure 12**. The robot task program in **Figure 13** is stored in Robot.so. The reason why we only used thread type is that, comparing to process type, it runs more precisely with real-time. The execution order is as follows: the input/output data processing module, the robot task module, and the PLC module. Of course, users can modify the execution order by changing priorities of modules. Once this configuration file is processed, the robot system will operate as shown in **Figure 10**, which can be configured and operated with the process.

Defined in **Figure 11**, shared variables are used in the integrated application system of **Figure 10**, in the PLC ladder program in **Figure 12** and also in the robot control program in **Figure 13**. The name space 'PLC\_ROBOT' is used in **Figure 13**, which makes the program look more sophisticated. As shown in **Figures 11** and **13**,

the name space 'PLC\_ROBOT' indicates that shared variables are utilized. The PLC

'POU\_PROGRAM()' and made into a thread to run. Through this, various types of

ladder program shown in **Figure 12** is converted to C/C++ function named

**Figure 9.**

**Figure 10.**

**115**

*Results from integrated application systems.*

*Configuration xml file for integrated application system.*

*Real-Time Robot Software Platform for Industrial Application*

*DOI: http://dx.doi.org/10.5772/intechopen.91014*

*Real-Time Robot Software Platform for Industrial Application DOI: http://dx.doi.org/10.5772/intechopen.91014*

**Figure 9.** *Configuration xml file for integrated application system.*

**Figure 10.** *Results from integrated application systems.*

the name space 'PLC\_ROBOT' indicates that shared variables are utilized. The PLC ladder program shown in **Figure 12** is converted to C/C++ function named 'POU\_PROGRAM()' and made into a thread to run. Through this, various types of

**4. Robot system integrating robot controller and PLC**

*Example code of a sporadic process program handled by an event handler.*

operated with the process.

*Industrial Robotics - New Paradigms*

**Figure 8.**

**114**

The XML file in **Figure 9** is a configuration file consisting of programs of robot task, PLC, and an input/output data processing. As shown in **Figure 9**, the program consists of three periodic threads, where the period of all SW modules is 10 ms. main.so consists of a ladder program, which is converted to C/C++ program, and a C++ program that calls the program, which is shown in **Figure 12**. The robot task program in **Figure 13** is stored in Robot.so. The reason why we only used thread type is that, comparing to process type, it runs more precisely with real-time. The execution order is as follows: the input/output data processing module, the robot task module, and the PLC module. Of course, users can modify the execution order by changing priorities of modules. Once this configuration file is processed, the robot system will operate as shown in **Figure 10**, which can be configured and

Defined in **Figure 11**, shared variables are used in the integrated application system of **Figure 10**, in the PLC ladder program in **Figure 12** and also in the robot control program in **Figure 13**. The name space 'PLC\_ROBOT' is used in **Figure 13**, which makes the program look more sophisticated. As shown in **Figures 11** and **13**,

### **Figure 11.** *Shared variables used in integrated application systems.*

**Figure 13.**

**117**

*Robot joint control SW module.*

*Real-Time Robot Software Platform for Industrial Application*

*DOI: http://dx.doi.org/10.5772/intechopen.91014*

**Figure 12.**

*PLC ladder program example using shared variable.*

```
Real-Time Robot Software Platform for Industrial Application
DOI: http://dx.doi.org/10.5772/intechopen.91014
```
**Figure 13.** *Robot joint control SW module.*

**Figure 12.**

**116**

**Figure 11.**

*PLC ladder program example using shared variable.*

*Shared variables used in integrated application systems.*

*Industrial Robotics - New Paradigms*

PLC programs can be operated. Threads that link shared variables to I/O modules are defined in the libiodispat.so, which is illustrated in the third part of **Figure 11**, and the middleware executes the thread. If the thread libiodispat.so periodically reads sensing data from the input module and stores into shared variables, then control threads of robot of Robot.so and PLC of main.so access shared variables.
