By
Stevie Andrea Lucardi 11110077
A thesis submitted to the Faculty of
ENGINEERING AND INFORMATION TECHNOLOGY
in partial fulfillment of the requirements for the
BACHELOR’S DEGREE in
MECHATRONICS ENGINEERING
SWISS GERMAN UNIVERSITY EduTown BSD City
Tangerang 15339 Indonesia
August 2014
Revision after the Thesis Defense on 18 July 2014
Stevie Andrea Lucardi STATEMENT BY THE AUTHOR
I hereby declare that this submission is my own work and to the best of my knowledge, it contains no material previously published or written by another person, nor material which to a substantial extent has been accepted for the award of any other degree or diploma at any educational institution, except where due acknowledgement is made in the thesis.
Stevie Andrea Lucardi
_____________________________________________
Student Date
Approved by:
Dr. Ir. Tutuko Prajogo, MSMfge
_____________________________________________
Thesis Advisor Date
Erikson Ferry Sinaga, ST. M.Kom
_____________________________________________
Thesis Co-Advisor Date
Dr. Ir. Gembong Baskoro, M.Sc
_____________________________________________
Dean Date
Stevie Andrea Lucardi ABSTRACT
DESIGNING AND DEVELOPING AN INTEGRATED SYSTEM TO CONTROL A SIMULATED KUKA ROBOT IN JACK SOFTWARE
By
Stevie Andrea Lucardi
Dr. Ir. Tutuko Prajogo, MSMfge, Advisor Erikson Ferry Sinaga, ST. M.Kom, Co-Advisor
SWISS GERMAN UNIVERSITY
The purpose of this thesis work is to design and develop a method to control a stand- alone or synchronized process in Jack software by an external controller which is integrated to other systems, such as FMS Simulator, through Modbus RTU over TCP protocol. Controlling processes in throughout different subsystem is difficult and needs an elaborate design/planning.
To prove the method of controlling a process in Jack, a controller, i.e. KUKA Controller, is developed to control a simulated KUKA robot in Jack and synchronization with Kiva AGV is developed by performing an Automated Storage and Retrieval System. Token Ring method is used to control the synchronization between KUKA Master and Kiva Master at the Modbus network level.
This thesis has proved a method to control simulation scene of Jack by multiple controllers simultaneously. However, a deeper exploration of Jack Script is needed to fix some errors and to extend the simulation to the higher level, such as colliding detection.
Keywords: Jack, Interface, Stand alone, Synchronization, Modbus protocol.
Stevie Andrea Lucardi
© Copyright 2014 by Stevie Andrea Lucardi
All rights reserved
Stevie Andrea Lucardi DEDICATION
I dedicate this thesis for the only Lord God, Jesus Christ.
Stevie Andrea Lucardi ACKNOWLEDGEMENTS
I want to express my gratitude to God for His love, His grace, and His patient that He gives me the opportunity and the strength to do this thesis and His guidance to break through every difficulties I faced during this thesis.
I want to thank my family who always keep supporting me in my whole life. I want to thank Dr. Ir. Tutuko Prajogo, MSMfge, who is my thesis advisor, Erikson Ferry Sinaga, ST. M.Kom, who is my thesis co advisor, and Dr. Rusman Rusyadi, B.Eng., M.Sc for giving me many advices to do this thesis.
I would like to thank my thesis partner, Jonathan Marshell Kevin, who motivates me to finish my thesis. And also to my friends, Mascellia Tifanny Agung, Adrian Rhesa, Harsyadi Adhiarsa, Victorino Aditya, Ruth Damayanti, Evan Petra, Kelvin Recia, Gandhi Winata, Glenn Vialli, Aaron Richard Wijaya, Linda Wijaya, Bhagya Rio Ellardo, Glenn Sulistio, and many others, who share joy and happiness during the thesis and keep supporting each other which have made this tough process felt delightful.
Stevie Andrea Lucardi TABLE OF CONTENTS
Page
STATEMENT BY THE AUTHOR ... 2
ABSTRACT ... 3
DEDICATION ... 5
ACKNOWLEDGEMENTS ... 6
LIST OF FIGURES ... 11
LIST OF TABLES... 13
CHAPTER 1 – INTRODUCTION ... 14
1.1 Thesis Background ... 14
1.2 Thesis Goal ... 14
1.3 Thesis Scope ... 15
1.4 Thesis Methodology ... 15
1.5 Thesis Limitation ... 15
1.6 Thesis Organization ... 16
2 CHAPTER 2 – LITERATURE REVIEW ... 17
2.1 Jack... 17
2.1.1 Figure ... 17
2.1.2 JackScript Console ... 18
2.2 Odroid U3 ... 19
2.3 KUKA ... 21
2.4 Qt... 22
2.5 TCP/IP ... 23
2.6 Modbus RTU ... 24
2.7 FMS Server ... 25
3 CHAPTER 3 – METHODOLOGY ... 26
3.1 Hardware and Software Overview ... 26
3.2 System Solution Overview ... 27
3.3 Designing TCP Client Library ... 28
3.4 Designing Modbus Library... 29
3.5 KUKA Master Design ... 34
3.5.1 Main Window... 34
3.5.2 Logic Controller ... 34
Stevie Andrea Lucardi
3.5.3 HMI ... 35
3.6 KUKA Gateway Design ... 36
3.6.1 Main Window... 36
3.6.2 HMI ... 37
3.6.3 Designing Protocol Conversion of KUKA Gateway ... 37
3.6.4 Interaction Diagram of KUKA Gateway ... 40
3.7 Python Scripts Structure Design ... 42
3.7.1 KUKA Figure ... 43
3.7.2 Basic Command ... 44
3.7.3 KUKA Controller – Version 1 ... 45
3.7.4 Server Module ... 48
3.7.5 KUKA Controller – Version 2 ... 49
3.7.6 Thread Connection ... 50
3.7.7 Main Program – Version 1 ... 51
3.7.8 Main Program – Version 2 ... 51
3.7.9 System Module – Version 1 ... 52
3.7.10 KUKA Controller – Version 3 ... 53
3.7.11 Main Program – Version 3 ... 54
3.7.12 KUKA Thread ... 54
3.7.13 Setting ... 56
3.7.14 Create Thread ... 56
3.7.15 System Module – Version 2 ... 56
3.8 Synchronization Process ... 56
3.8.1 Synchronized System Overview ... 57
3.8.2 Synchronization Strategy between Masters ... 58
3.8.3 Token Ring Distribution Strategy ... 61
3.8.4 Warehouse / Factory Layout for a Process Synchronization ... 61
3.8.5 Designing Simulation Controller Systems ... 63
3.8.6 Designing Simulation Controller Python Script ... 63
3.8.7 Designing Memory Map of Masters... 64
3.8.8 Designing Logic Controller of KUKA Master for Synchronization ... 65
3.8.9 Simulation Procedure for Storing an Item ... 68
3.8.10 Simulation Procedure for Retrieving an Item ... 69
4 CHAPTER 4 – RESULTS AND DISCUSSIONS ... 70
4.1 Testing TCP Client Library ... 70
4.2 Testing Modbus Library ... 71
Stevie Andrea Lucardi
4.4 Testing KUKA Gateway – messageRecvJack function ... 75
4.5 Testing KUKA Controller – Version 1 ... 77
4.6 Testing Server Module ... 78
4.7 Testing KUKA Controller – Version 2 ... 79
4.8 Testing Main Program – Version 1 ... 79
4.9 Testing Main Program – Version 2 ... 80
4.10 Testing System Module – Version 1 ... 81
4.11 Testing KUKA Controller – Version 3 ... 81
4.12 Testing Main Program – Version 3 ... 81
4.13 Importing Qt Project (KUKA Master) to Odroid U3 ... 82
4.14 Testing Stand-Alone Process ... 83
4.15 Testing Synchronized Process ... 84
4.16 Testing System Module – Version 2 ... 84
5 CHAPTER 5 – CONCLUSIONS AND RECCOMENDATIONS ... 85
5.1 Conclusions ... 85
5.2 Recommendations ... 85
GLOSSARY ... 86
REFERENCES ... 87
APPENDIX A – Petrinets ... 89
A.1 Petrinet of KUKA Master... 89
A.2 Petrinet of KUKA Gateway... 90
A.3 Petrinet of Python Scripts Structure for 3 clients ... 91
A.4 Petrinet of KUKA Robot for Synchronization with Kiva AGV ... 92
APPENDIX B – KUKA Master ... 93
B.1 main.cpp ... 93
B.2 mainwindow.h ... 93
B.3 mainwindow.cpp ... 95
B.4 tcpclient.h ... 106
B.5 tcpclient.cpp ... 107
B.6 modbus.h... 109
B.7 modbus.cpp ... 110
B.8 logiccontroller.h ... 119
B.9 logiccontroller.cpp ... 120
APPENDIX C – KUKA Gateway ... 126
C.1 main.cpp ... 126
Stevie Andrea Lucardi
C.2 mainwindow.h ... 126
C.3 mainwindow.cpp ... 127
C.4 ui_mainwindow.h ... 138
C.5 widget_connection.h ... 141
C.6 widget_connection.cpp ... 142
C.7 tcpclient.h ... 144
C.8 tcpclient.cpp ... 145
C.9 widget_modbus.h ... 147
C.10 widget_modbus.cpp ... 148
C.11 modbus.h ... 150
C.12 modbus.cpp ... 151
C.13 widget_admin.h ... 160
C.14 widget_admin.cpp ... 161
APPENDIX D – Python Scripts ... 164
D.1 basicCommand.py ... 164
D.2 kukaController.py ... 165
D.3 serverModule.py ... 169
D.4 threadConnection.py ... 170
D.5 kukaThread.py ... 171
D.6 systemModule.py ... 174
D.7 mainProgram.py ... 174
D.8 setting.py ... 175
D.9 createThread.py... 176
D.10 simCon.py ... 176
D.11 simConThread.py ... 177
CURRICULUM VITAE ... 179
Stevie Andrea Lucardi LIST OF FIGURES
Figure 2.1: Human Figure (left) and Jack Scene (right) [3]... 18
Figure 2.2: JackScript Console... 18
Figure 2.3: Odroid U3 (left) [5] and U3 IO Shield (right) [6] ... 19
Figure 2.4: Diagram of Odroid U3 and U3 IO Shield Connection [5] ... 19
Figure 2.5: KUKA Robots – KR 100-3 (left) and KL 250-3 (right) [12] ... 21
Figure 2.6: Modbus RTU, Modbus ASCII, and Modbus TCP Frame Formats ... 24
Figure 2.7: FMS Server ... 25
Figure 3.1: System Overview ... 26
Figure 3.2: System Solution Overview ... 27
Figure 3.3: Class Diagram of TcpClient (Simplified) ... 28
Figure 3.4: UML Class Diagram of Modbus (Simplified) ... 30
Figure 3.5: Activity Diagram of sendQuery Function ... 31
Figure 3.6: Activity Diagram of receive Function ... 32
Figure 3.7: Activity Diagram of receive Function of Master ... 32
Figure 3.8: Activity Diagram of receive Function of Slave ... 33
Figure 3.9: KUKA Master System Solution ... 34
Figure 3.10: KUKA Gateway System Solution ... 36
Figure 3.11: Activity Diagram of Check Coil ... 38
Figure 3.12: Activity Diagram of on Receiving a Response from Jack ... 38
Figure 3.13: Interaction Diagram of KUKA Gateway ... 41
Figure 3.14: Python Script Controller Structure ... 42
Figure 3.15: KUKA figure ... 43
Figure 3.16: KUKA Controller ... 45
Figure 3.17: Class Diagram of serverModule ... 48
Figure 3.18: KUKA Controller Version 1 (top) and Version 2 (bottom) ... 49
Figure 3.19: Class Diagram of threadConnection ... 50
Figure 3.20: Structure of Main Program - Version 1 ... 51
Figure 3.21: Structure of Main Program - Version 2 ... 52
Figure 3.22: Class Diagram of systemModule ... 53
Figure 3.23: Structure of Main Program – Version 3 ... 54
Stevie Andrea Lucardi
Figure 3.24: Class Diagram of kukaThread ... 55
Figure 3.25: Warehouse Layout for Synchronization Process ... 57
Figure 3.26: Synchronization Using Higher Level Controller ... 58
Figure 3.27: Synchronization Using IO Shared ... 59
Figure 3.28: Synchronization Using Token Ring Method ... 60
Figure 3.29: Synchronization Strategy ... 61
Figure 3.30: Jack Scene ... 62
Figupre 3.31: Conveyor In and Conveyor Out Position ... 62
Figure 3.32: Predefine Position of KUKA robot ... 63
Figure 3.33: Thread of Logic Controller ... 66
Figure 3.34: KUKA Storing Process ... 66
Figure 3.35: KUKA Retrieving Process ... 67
Figure 3.36: State Transition Diagram of KUKA Robot for Synchronization ... 67
Figure 4.1: Received Messages by FMS Server ... 70
Figure 4.2: Communication Log of KUKA Master 1 and KUKA Master 2 ... 70
Figure 4.3: Master Communication Log ... 71
Figure 4.4: Slave Communication Log ... 71
Figure 4.5: Slave Memory Map - Coil... 71
Figure 4.6: Slave Memory Map – Register ... 72
Figure 4.7: Communication Log of KUKA Gateway ... 73
Figure 4.8: Received Message at Chat Client ... 74
Figure 4.9: Commands Sent by Chat Client ... 75
Figure 4.10: Communication Log of KUKA Gateway ... 76
Figure 4.11: Memory map of KUKA Gateway... 76
Figure 4.12: Testing KUKA Controller ... 77
Figure 4.13: Testing Server Module ... 78
Figure 4.14: Result of KUKA Controller - Version 2 ... 79
Figure 4.15: Testing Main Program V2 ... 80
Figure 4.16: HMI layout changes from Windows (top) to XUbuntu (bottom) ... 82
Figure 4.17: Testing Stand Alone ... 83
Figure 4.18: Synchronized Process ... 84
Figure 4.19: Error Message from Jack ... 84
Stevie Andrea Lucardi LIST OF TABLES
Table 2.1: Specification Comparison of Mini PCs [5][7][8][9][10] ... 20
Table 3.1: Memory Mapping - Coil... 39
Table 3.2: Memory Mapping - Register ... 40
Table 3.3: KUKA joints limits ... 43
Table 3.4: List of Basic Command Functions ... 44
Table 3.5: Public Function of KUKA Controller ... 46
Table 3.6: Command List of KUKA Controller ... 47
Table 3.7: Description of operand [JOINT] ... 47
Table 3.8: Description of operand [JOINTS] ... 48
Table 3.9: Member Function of Simulation Controller ... 64
Table 3.10: Command List of Simulation Controller ... 64
Table 3.11: Memory Map of Simulation Controller Master ... 64
Table 3.12: Memory Map of Kiva Master ... 65
Table 3.13: Memory Map of KUKA Master ... 65