Home
Acknowledgments - Repositorio Digital UPCT
Contents
1. 28 1 0 Valves gg Gateway H E PLC BI Compatible PROFIBUS DP Sle EQ CiR Object EHE Closed Loop Controller Egg Configured Stations 0 UR BH DP VO slaves S i Module Order number Firmware MPI address l address O address Comment i 2 314 0 657 314 66603 0 20 2 a AUN GO T T pm 5 5 eg EA E o RAE ox Gut 1 mg 2005P 4 Aw mg ET 2001 l mg 200M T M r I p EMIT H E ET 2005 DA o I o ae Gy ET 2000 HE Press F1 to get Help Astarte w ay eu ill 4 SIMATIC Manager Project 87 Document1 Microsoft Config SIMATIC 401 5 9 21 00 Picture 5 12 Twelveth picture PROFIBUS network configuration 48 5 Motor PLC connection via PFOFIBUS 13 Write the motor address which was selected in the switches inside the motor for more information see the motor datasheet in the Appendix 4 In this case the first and second switches are on so it indicates the address 3 Config SIMATIC 300 1 Configuration Project la il Station Edit Insert PLC View Options Window Help e x Dae amp a ee ES 92 0 UR Profile p
2. 5 Diagnostics Press F1 to get Help a offline 1465 5 2 4 Insert Cha 21 aeg gt 1 Manager opc 1 5 1 oB1 SH pocumentt Microsoft w d oXAX mMAIS55 Picture 8 22 New S7 program 3 _79 8 OPC communication 9 Communication and Visual Basic programs CHAPTER 9 Communication and Visual Basic programs 9 1 Summary At the moment all the components of the project are connected and the elements which take part 1n the project are done Now it s time to make the final Visual Basic program which will command everything It s not easy to do at simultaneous because each part has to be tested in order to check the errors in an easiest way For this reason the current chapter will explain the different programs made in this project The first is to control the conveyor and the next is to create the communication between the computer and the robot After this a flowchart will be necessary to make with the process to follow in order to integrate these programs and to add the required code to finish it 9 2 Program that controls the belt over PROFIBUS This program consists in a simple window which shows the images acquired by the camera in each moment as well as two buttons for start stop the belt by the user It even allows adjusting the velocity of the motor displaying the speed i
3. Gut Copy Cite Paste Delete Del SIMATIC 400 Station SIMATIC 300 Station AStation SIMATIC PC Station SIMATIC HMI Station Other station SIMATIC S5 PG PC SIMATIC OP Insert New Object Object Properties Alt Return MPI PROFIBUS Industrial Ethernet 5 Program Program Inserts SIMATIC 300 Station at the cursor position distat gt Gs Configurati 2 Scout SIMATIC M Document Config Picture 8 7 Seventh step fi HW Config SIMATIC 300 1 Configuration Miguelopc _ laxi 1 CSS e SHS os ly Station Edit Insert PLC View Options Window Help 18 x 2281 8 8 2 ED 28 PS 307 24 n 0 UR Slot 9 Module Order number Firmware MPI 0 Comment 1 Ps 307 24 57 307 1 00 0440 3 4 5 5 M 8 D Press F1 to get Help Profile Standard X ioi BM CPU 314 _ 1 Bg CPU 314 1FM _ 8 28 CPU 314 2 DP Bg CPU 3140 2 CPU 315 pg 315 20 59 CPU 315 2 PN DP H CPU 315F 2 DP Bg CPU 315F 2 PN DP H E CPU 316 Bg CPU 316 2 DP _ i Bg CPU 317 2 Bg CPU 317 2 PN DP Bg CPU 317F 2 BM CPU 317F 2 PN DP Bg CPU 318 2 Bg CPU 319 3 PN DP BM CPU 614 CPU pg FM 300 BR Gateway pg IM 30
4. Manager Project M Documenti Microsoft W Config SIMATIC Picture 5 9 Ninth picture in PROFIBUS network configuration 46 5 Motor PLC connection via PFOFIBUS 9 In the object properties window click on properties oh HW Config SIMATIC 300 1 Configuration Project 8 x sl Station Edit Insert PLC View Options Window Help laj x S 828 En 48 0 UR Profile Standard 7 24 28 CPU 315 2 DP 28 CPU 315 2 PN DP Properties 22222 p wee g SIMATIC 300 General Addresses perating Mode Configuration a H CP 300 Short Description DP Egg CPU 300 pg CPU 312 CPU 312 IFM g CPU 312 z 8 1 CPU 313 Order No a CPU 313C H E CPU 313 2 DP Name DP 9 28 CPU 313C 2 Interface 2 H E CPU 314 FM 4 0 un Type PROFIBUS CPU 314C 2 DP Module Odem Addes 5 Networked Properties bu i gt 314 208 86573 Eten 5 el Comment T V2 0 22 2222026 H E CPU 314C2 PiP 21 sau _ Bg CPU 315 B Press F1 to get Help w d Manager Project 87 Microsoft W Config SIMATIC integrated ork memory
5. Config SIMATIC qd oS SENS 20 54 Picture 5 4 Fourth picture in PROFIBUS network configuration 4 Then is necessary to look for the exact PLC in the list on the right side 57 CPU 314 6CG03 0ABO 22 ixi 18 mm Config SIMATIC 300 1 Configuration Project Station Edit Insert PLC View Options Window Help 2212 8 5 ED 5 92 ARE PROFINET 10 E SIMATIC 300 Bg c peg 300 Egg CPU 300 CPU 312 28 CPU 312 IFM g CPU 3126 CPU 313 CPU 313C 29 CPU 313C 2 DP 28 CPU 313C 2 PIP CPU 314 28 CPU 314 IFM 28 CPU 314C 2 DP 0 UR _ 1 GES 314 6CF00 0AB0 Slot 9 Module Order number Firmware MPI address address 0 address Comment AD 5 57 314 6CFD1 DABO 57 314 6CF02 04B0 f Ju 314 5 603 0 0 Pb aes 221 mg CPU 31462 _ B CPU 315 H E CPU 315 2 CPU 315 2 PN DP A CPU 315F 2 H E CPU 315F 2 PN DP 8 28 CPU 316 CPU 316 2 DP 5 63 CPU 317 2 A E CPU 317 2 PN DP H E CPU 317F 2 mama mm m amm 314 6CG03 0480 ork memory SBKB 0 1ms 1000 instructions 0124 0016 415 402 integrated 4 pulse outputs 2 5kHz 4 x Press F1 to get Help Chg Astart gt Manager Project M Documenti Microsoft W
6. i FMS Eg 57 57 connection_1 57 57 connection_1 57 57 cc 57 57 _1 5767 57 57 connection 1 57 57 EY objects H E blocks H a scan H k aliases SSR El Define New Item X el E GN EM M Picture 8 18 Define new item afa 8 OPC communication 2727 File View Server Group Item z S le 4 Servers andgroups st Items incl status information Item Names 5 5 connection 1 M w30 57 15 connection 1 125 Format Type Access Quality Time Stamp UTC Original uint15 Bw good 08 21 2003 23 53 26 108 Original bool Bw good 08 21 2003 23 53 26 108 Server s 5 Local Server s EE HartServer HartOpc y OPC SimaticHMI HmiR Tm y OPC SimaticHMI PTPro A OPC SimaticNET Test gt New group OPC SimaticNET DP PhoenixContact AX Server 21 ProfiDrive ProfilServer ET Remote Servers Add Remote Servers s 5716 _1 125 0 2 2 hh Picture 8 19 Items state 8 3 New 57 program for the conveyor with OPC The last S7 program was controlled by switches To integrate everything in one application with Visual Basic all the inputs and outputs which were commanded by switches are stored in a memory variable M The program has been modified to not
7. i BM Bf xf PROFIBUS DP T a WAGO IO SYSTEM Standard w Additional Field Devices G General KUKA CP5614 Slave 0 1 0 9 28 Valves E Gateway 89 PLC 28 Compatible PROFIBUS DP Sle CiR Object Closed Loop Controller Configured Stations DP VO slaves DP AS i DP PA Link ENCODER ET 200B ET 200C ET 200eco ET 20015 ET 200iSP ET 200L ET 200M ET 200pro ET 200R ET 2005 ET 2000 ET 200 wf B B tz i Bl H E 45 3 wacoore iga Slot 9 O Order Number 7 Designation l ddress 0 Address Comment i 1 f 0 000 000 0 88 y e 2 awe E o mg 84 bg 4 awumw ET s ajwumup EE 6 7 im 5 LAMP 1 he A BMO Td Bg s mg m eG Hj wiser Bg Insertion possible 0 5 SIMATIC Manager Project f 1 Microsoft W Config SIMATIC 49 Chg qm oSAESSS uo Picture 5 14 Fourteenth picture in PROFIBUS network configuration 5 Motor PLC connection via PFOFIBUS 15 The main program has the next appearance J SIMATIC Manager Project File Edit Insert PLC View Options Window Help ola tle x 55 wal 9a I Project C Program Files Siemens Step s fproj Project 51 9 Pr
8. Standard Y CPU 312 28 CPU 312 IFM 28 CPU 313C E CPU 313C 2 DP CPU 313 2 zy CPU 314 IFM 57 314 6CF00 04B0 5 314 1 57 314 6CF02 04B0 57 314 6 603 0 g vao CPU 314C2 PIP 28 CPU 315 CPU 315 2 DP 3 CPU 3152 PN DP E CPU 315F 2 DP g CPU 315F 2 PN DP 28 CPU 316 g CPU 316 2 DP 28 CPU 3172 E CPU 317 2 PN DP M OSEE S 221 20 5 Jie Picture 5 6 Sixth picture in PROFIBUS network configuration motor which has to be installed 6 Afterwards the program has to recognize the motor so it needs a gsd file of the HW Config SIMATIC 300 1 Configuration Project ll Station Edit Insert PLC View Options Window Help Diaz 18 8 181 Customize Ctri Alt E Specify Modules Configure Network Symbol Table Ckri Alt T CPU 314C 2 DP Report System Error Edit Catalog Profile Update Catalog Install HW Updates Install GSD file Find in Service amp Support 0 UR T oo o Module e number uo address address 0 address Comment ey p Qe OE HEEEEEN uw 111 EMEN T Lese 21 zape 27 0 o S ERR 4 Aese 2 Installs new GSD files the system and updates the contents of the catalog
9. 187 5 500 1 5 3M 2 MaxTsdr 9 6 60 _19 2 60 93 75 60 MaxTsdr 187 5 60 MaxTsdr 500 100 _1 5 150 MaxTsdr 3 250 MaxTsdr 6 450 _12 800 Implementation Bitmap Device DPLINK_ Slave Specification Freeze Mode supp 0 Sync Mode supp 0 Auto Baud Min Slave Intervall Max Diag Data Len 8 Modul Offset 0 Slave_Family 0 OrderNumber MACO0O0 FPx JVL Industri Elektronik A S User Manual Integrated Servo Motors MACO50 800 4 5 Expansion Module 2 FP4 UserPrmData Length and Preset PrmText Text 0 Active low Text 1 Active high EndPrmText PrmText 2 Text 0 Velocity 0 1 Passive mode EndPrmText PrmText 3 Text 0 Disabled Text 1 Enabled EndPrmText ExtUserPrmData INI Input level Bit 0 0 1 Prm_Text_Ref EndExtUserPrmData ExtUserPrmData 2 IN2 Input level Bit 1 0 1 Prm_Text_Ref EndExtUserPrmData ExtUserPrmData 3 Input level Bit 2 0 1 Prm Text Ref EndExtUserPrmData ExtUserPrmData 4 IN4 Input level Bit 3 0 1 Prm Text Ref EndExtUserPrmData ExtUserPrmData 5 NL Input level Bit 4 0 1 Prm Text Ref EndExtUserPrmData ExtUserPrmData 6 PL Input level 5 O Prm_Text_Ref EndExtUserPrmData
10. 8 05 group RS232 interface transmit output Brown 1 Important DIP1 must be turned ON If addressing is used it must be turned ON at minimum one of the connected motors X RS232 interface receive input 3 GND RS232 Ground also used with analogue input 4 DIP 4 OFF IN1 input 1 I O terminal B DIP 4 ON O1 25 output 1 ground to be used with IN1 NL PL O1 O2 DIP 6 OFF NL negative limit input I O terminal D DIP 6 ON O output supply DIP 2 ON and DIP3 OFF AIN Analogue input OA terminal DIP2 OFF and DIP 3 0N 5 O2 output 2 PNP 25mA is the analogue input Remember to use the GND terminal with AIN Cable Screen Some standard cables with M12 connector offer a screen around the cable This screen on some cables is fitted to the outer metal at the M12 connector When fitted to the MACOO FP4 module this means that the screen will have contact with the complete motor housing and thereby also the power ground main ground Isolation groups The MACOO FP4 offers optical isolation at the digital inputs and outputs IN1 NL PL and O1 2 The table shows a number for each pin This number refers to the isolation group to which the pin is connected Isolation group 1 means that the terminal refers to the main ground P GND and the motor housing Isolation group 2 means that the terminal refers to the Profibus DP interface ground DGND Is
11. wees 5 orearen _ OOOO Write data For 6 bit registers the data must be placed in Write data 0 and Write data For 32 bit registers the data must be placed in Write data 0 3 Write register selector The number of the register to write to should be placed here The register must be in the range 1 255 Read register selector The number of the register to read from should be placed here The register must be in the range 255 Direct register This register can used to execute a FlexMac command When writing to this Register the command will be executed immediately The bit 0 6 is the command and bit 7 is not used If the same command is to be executed twice bit 7 can be toggled The command is accepted when the Last direct register in the output data has the same value as this register 106 JVL Industri Elektronik A S User Manual Integrated Servo Motors MACO50 800 4 5 Expansion Module MACOO FP2 FP4 Command mn n Write Read Write Read Auto Auto Ragone Toggle Toggle 32 bit 32 bit write read Bit 7 Write toggle is used for writing data to the selected register Write register se lector When this bit is toggled writing is executed The write command is ac cepted when Bit 7 in the command status output data byte 7 is equal to this bit Bit 6 Read toggle is used for reading data from the selected register R
12. 0 8 ed gt simatic Manager Test RELAD STL FBD 0B1 8 Documenti Microsoft aS OASIS 1216 Picture 6 6 One function block and one function graph a 6 Step 7 program for the conveyor 4 The initial input data has to be made in a specific function of Step 7 this function is the 57 Graph in the way of the pictures below It consists in a grafcet that allows to introduce the written value in each register 88157 Graph FB2 DB2 Sequencer 1 TestMotor SIMATIC 3001 CPU 314 2 DP i File Edit Insert PLC Debug View Options Window Help oele S gt c clau 6 gt 100 8 af E eer al xl 1s dn gi ss DEIN m d T T 17 ot Input_value 600 INT ES write _register B 16 7 BYTE IN E written 17 7 BOOL IN To write OUT il 5 E Input value 10 INT write register B 16 6 BYTE IN written 217 7 BOOL IN gt To write 07 7 BOOL OUT ER d Press F1 for help 0 ies ay eu simatic Manager T LAD STLIFED 081 7 Documenti Microsoft xt sz Graph FB2 DB E e 5k 9k 0 SES 1217 Picture 6 7 Graph of the data values 3157 Graph FB2 DB2 Sequencer 1 TestMotor SIMATIC 300 1 CPU 314C 2 DP i File Edit Insert PLC Debug View Options Window Help Input value 10
13. IB TCP IP gt Realtek 81 Set Pt Picture 8 1 3 Thirteenth step m To download Simatic 300 select options set PG PC interface and select CP5611 Profibus CPU 3140 2 DP 9 9 57 Programit shuttle Set PG PC Interface 5 11 I CP5611 PROFIBUS DP Slave 150 Ind Ethemet gt Intel R PRO Picture 8 14 Fourteenth st 75 8 OPC communication Select network and configure a 57 connection in shuttle clicking on OPC server window in the picture 8 16 appears gie NetPro opc Network C Program Files Step7 s7proj opc PROFIBUS 1 PROFIBUS ASP PROFIBUS PA H S PROFINET 10 H E Stations Subnets SIMATIC 300 1 CPU 314 2 DP CM Fifth step Picture 8 15 ASE PROFIBUS PA Local aint H PROFINET 10 7 Fit iqured H E Stations QQ Subnets Send operating mode BW con e 8 16 Sixtee nth step EP 8 2 2 Check OPC connection 8 OPC communication OPC scout is a tool of Simatic which allows the user to know in each moment the value format and state of the variables that has been included Next pictures show the way for making this Bd Remote Add Remote Servers s Picture 8 17 OPC Scout E Connections H k
14. to HALCON programming The following program looks for a transistor between any electronic devices it makes a distinction between these and it marks only the transistor It can be seen in the picture below Picture 1 2 Looking for a transistor dev_close_window close all framegrabbers dev open window 0 0 640 480 black WindowHandle open_framegrabber DirectShow 1 1 0 0 0 0 default 8 1 false default default 0 1 AcqHandle grab_image_start AcqHandle 1 dev update window off while true count seconds T1 grab image async Image AcqHandle 1 count seconds T2 Result 1 T2 T1 rgb1 to gray Image Graylmage decomposes Image b threshold Region 0 25 connection Region ConnectedRegions select shape ConnectedRegions SelectedRegions area compactness 3000 1 4000 2 shape trans SelectedRegions RegionTrans rectangle2 boundary RegionTrans RegionBorder inner dev set color red dev set line width 2 dev set draw margin dev display Image dev display RegionBorder endwhile close framegrabber AcqHandle Picture 1 2 Looking for the transistor s 2 1 to HALCON programming In the following program HALCON detects if the position of the reluctance circular device is correct While the reluctance is on top it marks with a green square
15. 1 Rating plate 2 Start key The start key 1s used to start a program uc 2 KUKA robot Overwiew programming over Picture 2 7 Rear of KCP 3 Enabling switch buttons 3 4 5 The enabling switches have 3 positions Not pressed Center position Panic position The enabling switch must be held in the center position in operating modes T1 and 2 in order to be able to jog the robot In the operating modes Automatic and Automatic External the enabling switch has no function 2 3 2 Operating modes The operating mode 15 selected using the mode selector switch on the The switch is activated by means of a key which can be removed If the key 1s removed the switch 1s locked and the operating mode can no longer be changed Picture 2 8 Modes in KCP 1 Test 2 T2 2 Automatic AUT For robot system without higher level controllers Only possible with a connected safety circuit 208 2 KUKA robot Overwiew programming over 3 Automatic External AUT EXT For robot system with higher level controller e g PLC Only possible with a connected safety circuit 4 Test I 2 3 3 Changing user group Different functions are available in the KSS depending on the user group The following user groups are available User User group for the operator Expert User group for the programmer In this user group it is possible to switch to
16. 5 1 DP master system 1 PROFIBUS DP B Additional Field Devices PO E 4 General NN xj E I CP5614 Slave General Parameters i a MACDD FP C3 vo Address Gateway PLC gg Compatible PROFIBUS DP 51 CiR Object Closed Loop Controller Configured Stations DP VO slaves DP AS i DP PA Link ENCODER ET 200B Transmission rate 1 5 Mbps Subnet not network ed New Properties Delete 0 UR 8 Module 2 CPU 314C 2 DP 57 314 Order numl Slot 1 BF 2214 24g 28 eso Ee E Ee Ee Ee Ee Ee Ee Ee Ee Ee Ee Ee Ed eh Ee 3 4 aE MACOO FPx ET 200C ET 200eco 20015 ET 200iSP 200L 200 200pro ET 200R 2005 2000 200 Pa Insertion possible PAstart 4 A A gt SIMATIC Manager Project Bi Microsoft w Config SIMATIC 14 Finally the connection is made see the picture below Config SIMATIC 300 1 Configuration Project Station Edit Insert PLC view Options Window Help Diese 8 8 E col 22 Chg OS 9E Picture 5 13 Thirteenth picture in PROFIBUS network configuration Isixi 81 xl Find Profile
17. All the registers of the MAC motor can be read and written The modules include 6 inputs 2 of which are end limit inputs These can be read from the Profibus DP The end limit inputs can automatically halt the motor The other inputs can be used to activate different movements The MAC motor is controlled by writing to the input data 9 bytes The expansion modules MACOO FP2 and FP4 can be mounted on standard MAC motors 50 MAC95 MACI40 MACI41 MAC400 and 800 Both modules offer the same functions but with the following hardware differences Type Protection Connectors class I O and interface Power supply Cable glands Cable glands Cable glands x 2 00 2 IP67 Mini crimp con Screw terminals Screw terminals nectors internally internally internally Both modules are delivered without any cables as standard Optionally the MACOO FP2 module can be delivered with cable in selected lengths Also cables for the MACOO FP4 with M12 connectors are available The first part of this section deals with the common features of both modules Please see the latter pages for specific information about each module such as example connection diagrams list of the typically used registers can be found in Serial Quick Guide MacTalk proto col page 167 The FlexMac commands are described in FlexMac commands page 111 LD0077 01GB 104 JVL Industri Elektronik A S User Manual Integrated Servo Motors MACO
18. ExtUserPrmData 7 Endlimit action Bit 0 0 0 1 Prm Text Ref 2 EndExtUserPrmData ExtUserPrmData 8 Input Action UnSigned8 0 0 255 EndExtUserPrmData JVL Industri Elektronik A S User Manual Integrated Servo Motors MACO50 800 4 5 122 Expansion Module M ACOO FP2 FP4 ExtUserPrmData 9 Input 2 Action UnSigned8 0 0 255 EndExtUserPrmData ExtUserPrmData 10 Input 3 Action UnSigned8 0 0 255 EndExtUserPrmData ExtUserPrmData Input 4 Action UnSigned8 0 0 255 EndExtUserPrmData ExtUserPrmData 12 Input debounce Bit 1 00 1 Prm_Text_Ref 3 EndExtUserPrmData ExtUserPrmData 13 Input noise filter Bit 2 0 0 1 Prm_Text_Ref 3 EndExtUserPrmData Max User Prm Data Len 15 User Prm Data Len 15 User Prm Data 0x0 0x3F 0x0 0 0 0 0 0 0 0 0 0 0 0 0 Ext User Prm Data Const 0 0x0 0x3F 0x0 0 0 0 0 0 0 0 0 0 0 0 0 Ext User Prm Data Ref l Ext User Prm Data Ref l 2 Ext User Prm Data Ref l 3 Ext User Prm Data Ref 1 4 Ext User Prm Data Ref l 5 Ext User Prm Data 1 6 Ext User Prm Data Ref 2 7 Ext User Prm Data Ref 2 12 Ext User Prm Data 2 13 Ext User Prm Data Ref 3 8 Ext User Prm Data Ref 4 8 Ext User Prm Data Ref 5 8 Ext User Prm Data Ref 6 9 Ext User Prm Data Ref 7 9 Ext User Prm Data Ref 8 9 Ext User Prm Data Ref 9 10 Ext User Prm Data Ref 10 10 Ext User Prm Data 1 1 10 Ext User Prm Data 12 11 Ext User Prm Data 13 11 Ext User Prm Da
19. Picture 4 5 Properties window The Project Window displays a list of all forms and modules making up your application You can also obtain a view of the Form or Code windows window containing the actual Basic coding from the Project window Picture 4 6 Project window 4 3 Learning to program in Visual Basic In order to make a program that contains the process followed by the robot over the camera the first step is to start programming some simple programs and then with the knowledge acquired make the last application program for the project In this way the programs made during the period of learning to program in Visual Basic are attached in the Appendix the window program and the code of each one 40 5 Motor PLC connection via PFOFIBUS CHAPTER 5 Motor PLC connection via PROFIBUS 5 1 Components and connection cables The goal of the project includes a conveyor which moves one object on the table The conveyor needs a step motor to run The power to move the conveyor is supplied by a motor of the MAC s family specifically the motor MAC95 FP4 datasheet in the Appendix 4 The motor has a PROFIBUS connection and it requires a PLC to be commanded The PLC is from Siemens specifically from the family 57 300 57 CPU 314 6CG03 0ABO The motor has two connections one 1 the power input and the other 15 the PROFIBUS connector The power is provided by a power supply which supplies the necessary vol
20. Xcenter Ycenter image points to world plane CamParam1 PoseNewOrigin1 Row Column m Xball Yball distance pp Xcenter Ycenter Xball Yball DistanceBall disp cross WindowHandle Row Column 6 0 else When ball is not inside the robot reach it shows a message dev display Ellipse dev set draw margin set tposition WindowHandle 640 640 set font WindowHandle Arial 14 1 dev set color yellow write string WindowHandle out of the robot reach endif Looking for the box gen rectangle2 Rectangle2 110 480 0 05 500 70 reduce domain red Rectangle2 ImageReduced threshold ImageReduced Region1 45 255 connection 1 ConnectedRegions1 select shape ConnectedRegions1 SelectedRegions2 area 9000 12000 fill up SelectedRegions2 RegionFillUp1 Box RegionFillUp1 if Box 1 area center RegionFillUp1 Area1 Row1 Column1 image points to world plane CamParam1 PoseNewOrigin1 350 540 Xcenter Ycenter image points to world plane CamParam1 PoseNewOrigin1 Row1 Column1 m Xbox Ybox disp cross WindowHandle Xcenter Ycenter 6 O disp cross WindowHandle Row1 Column1 6 0 distance pp Xcenter Ycenter Xbox Ybox DistanceBox if Column1 gt 370 When box is in the column selected a message appears set tposition WindowHandle 640 640 set font WindowHandle Arial 14 1 dev set color
21. offline 465 lt 5 2 1 insert 0 ing 1 Manager Test FC2 Documenti Microsoft w E OASIS 1213 Picture 6 2 Outputs CI 6 Step 7 program for the conveyor Move each data to the correct input output of the motor WSLAD STL FBD FC2 TestMotor SIMATIC 300 1 CPU 314 2 DP ick File Edit Insert PLC Debug View Options Window Help 81 ec En Hosen amp a Interface New network 4 Enter data in each register c n Bit logic Input value write register Enter the selected register ae m write register written Writting completed NOT 9 written OO T ues E To write Pe R 0 5 E TEMP Rs 9 10 RETURN FE SR iex N eX 5 NEG Title io Converter H E Counter 8 DB cal Title 9 05 Jumps Integer functi Move t dat 9 28 Floating point 9 04 Move 9 29 Program contr H E Shift Rotate H a Status bits H Timers 9 08 4 b Input value Press F1 to get Help offline las 52 insert 0 start eg gt simatic Manager Test 5 2 8 Microsoft W EE OASIS 1244 Picture 6 3 Move data WSLAD STL FBD FC2 TestMotor SIMATIC 300 1 CPU 314 2 DP i File
22. 4 3 gt SIMATIC Manager Project Microsoft w Config 51 hen A arn BE orm ies eg Bl Se E SIMATIC 300 a g m 300 EM CPU 300 29 CPU 312 CPU 312 IFM E CPU 3126 28 CPU 313 zy CPU 313C 28 CPU 313C 2 DP 28 CPU 313 2 CPU 314 29 CPU 314 IFM 29 CPU 314C 2 DP B 57 314 6CF00 04B0 f 57 314 6 01 0 0 B 57 314 6CF02 04B0 Eg 5 314 6CG03 04B0 V2 0 28 CPU 314 2 28 CPU 315 29 CPU 315 2 DP 29 CPU 315 2 PN DP E CPU 315F 2 DP CPU 315F 2 PN DP CPU 316 CPU 316 2 DP 28 CPU 317 2 29 CPU 317 2 PN DP 2 CPU 317F 2 x Cm a mm S m amm qme o 2m E 2057 Chg Picture 5 7 Seventh picture in PROFIBUS network configuration 45 5 Motor PLC connection via PFOFIBUS 7 The gsd file can be downloaded from internet in the website The name of this is JVLIO6BC gsd Config SIMATIC 300 1 Configuration Project iej x mig Station Edit Insert PLC View Options Window Help la x 8 S sin ia 87 cx 22 CPU 3140 2 DP Profle Em S Instali asp piles 17 SIMATIC 300 Install GSD Files fromthe ditectoy AN
23. Dim Precios As Integer Select Case ListaObjetos Listindex Case 0 Precios Case 1 Precios Case 2 Precios Case 3 Precios Case 4 Precios End Select sinlVAa Value Precio Caption Else 1 2 Precio Caption End End 506 True Then Precios Precios 0 16 Precios 113 Al Visual Basic learning programs 1 Visual Basic learning programs Eigth program Lista Option Explicit Private Sub ListaBorrarElem Click If ListaNombres ListIndex 1 Then MsgBox Debes seleccionar alg n elemento Else ListaNombres Removeltem ListaNombres ListIndex End If End Sub Private Sub ListaNombres MouseUp Button As Integer Shift As Integer X Single Y Single If Button 2 Then PopupMenu Lista End 5ub Private 5ub NombreAnadir Click ListaNombres AddItem txtNombre Text Lista Enabled True End Sub Private Sub NombreBorrar Click txtNombre Text End Sub Private Sub ListaBorrar Click Dim Respuesta Integer Respuesta MsgBox Estas sequro 36 Pregunta If Respuesta vbYes Then ListaNombres Clear Lista Enabled False End If End Sub Private Sub ListaProteger Click ListaNombres Enabled Not ListaNombres Enabled ListaProteger Checked Not ListaProteqer Checked NombreAnadir Enabled Not NombreAnadir Enabled ListaBorrar Enabled Not ListaBorrar Enabled ListaBorrarElem Enabled Not ListaBorrarElem Enabled
24. True Else cmdSend Enabled False End lf End Sub Private Sub Winsock1 DataArrival ByVal bytesTotal As Long get data and write in the text box kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk Winsock1 GetData strData txtReceive Text txtReceive Text strData End Sub 125 A2 Visual Basic communication programs A3 Visual Basic final programs APPENDIX 3 Visual Basic final programs A3 1 Code of the main progam variables CE E GE GE SE GE GE GE GE GE KK KK Public ConnectOPCServer As OPCServer Public ConnectOPCGroup As OPCGroup Public ConnectOPCGroups As OPCGroups Public ConnectOPCltems As OPCItems Public bit start As OPCItem Public bit stop As OPCItem Public velocity As OPCItem Public initial data As OPCItem Public suction As OPCItem Public vacuum As OPCItem halcon variables O38 KOK K K KK KKK CE CE KK KKK Dim hv WindowHandle As Variant 1 As Variant Dim hv Pose1 As Variant hv_PoseNewoOrigin1 As Variant Dim AcgqHandle As Variant Ball As Variant Dim Area As Variant hv Row As Variant Dim Column As Variant Xcenter As Variant Dim Ycenter As Variant hv Xball As Variant Dim Yball As Variant DistanceBall As Variant Dim Box As Variant 1 As Variant Dim Row1 As Variant hv Column1 As Variant Dim Xbox As Variant hv Ybox As Variant Dim ho Image As HUntypedObjectX ho red As HUntyp
25. yellow write string WindowHandle Box in correct position endif else set tposition WindowHandle 640 640 set font WindowHandle Arial 14 1 dev set color yellow write string WindowHandle Box out of conveyor 66 7 Camera location lighting and calibration endif endwhile At the beginning of the program there are two new commands read_cam_par and read_pose these are utilized to read the files created during the calibration The central point of the image 15 selected by the user in this case Row 350 Column 540 to adjust it in the program with set_origin_pose the initial point Posel defined as the central dot in the first image acquired with the caltab can be changed as follows set_origin_pose Posel 0 077595 0 03263 0 PoseNewOriginl Those values were taken with the program to prevent errors The following code has two parts clearly defined in the first one it 1s trying to detect 1f ball 15 inside or outside of the robot reach With the command gen ellipse and after with reduce domain the work area available by the robot 1s defined the program only works in this specific area After this with the select shape command it recognizes the ball and then it takes the area center An important function is image points to world plane because this function transforms points in the image to real coordinates in the world The second part is similar only changes the region a rectangle and it i
26. Standard Y Profile Gales ARE PROFINET ID cf SIMATIC 300 Replace Object BH Add Master System m CP 300 Disconnect Master System a cPu 300 Insert PROFINET System aE CPU 312 Disconnect PROFINET 10 System a CPU 312 1FM PROFINET Manage Sync Boma C3 CPU 312 PROFINET TO Topology a ee 2 a Isachrone Mode T A 4 1 CPU 313C 2DP Specity Module Ez 28 CPU 313 2 E HE CPU 314 2 29 CPU 34C2 DP Siot Fiter Assigned Modules MPI address address Q address Comment 1 2 2 Leo _ EC 57 314 6 503 04 0 o Edit Symbols HE ne 22 Ji 2224 Object Properties Alt Return 26 8 5 2 CPU 214C 2 E E AA CPU 315 Product Support Informat Ctrl F2 mem 242 se LUE CPU 3152 DP FAQs Ctr F7 g CPU 315 2 PN DP a Find Manual Ctr F 1 CPU 315F 2 DP I H E CPU 315F 2 PN DP mm H E CPU 316 ELS mee a CPU 3182 DP 2 C O A Gg CPU 3172 IUNIO CPU 317 2 PN DP TE 3 9 CPU 317F 2 ees gems Displays properties of the selected object for editing ics 5 eu gt
27. When it is bottom or sideway it shows up a message Wrong position of the reluctance Detecting the position of the reluctance dev_close_window close all framegrabbers dev open window 0 0 640 480 black WindowHandle open framegrabber DirectShow 1 1 0 0 0 O default 8 rgb 1 false default default 0 1 AcqHandle grab_image_start AcqHandle 1 dev update window while true count seconds T1 grab image async Image AcqHandle 1 count seconds T2 Result 1 T2 T1 dev set color green dev set draw margin dev set line width 2 rgb1 to gray Image Graylmage decomposes Image b threshold 0 Region 0 53 connection Region ConnectedRegions select shape ConnectedRegions SelectedRegions area roundness7 and 3000 0 65 4250 0 75 shape trans SelectedRegions RegionTrans rectangle2 boundary RegionTrans RegionBorder inner area center RegionTrans Area Row Column dev display Image if gt 0 dev display RegionBorder else set tposition WindowHandle 30 100 set font WindowHandle Arial 18 1 dev set color yellow write string WindowHandle Wrong position of the resistance endif stop endwhile close framegrabber AcqHandle eds 1 to HALCON programming Picture 1 3 Position of the reluctance The thi
28. camera calibration X Y 2 NRows NCols StartCampar NStartpose CamParam NFinalPose Errors write cam par CamParam campar dat tuple select range NFinalPose 0 6 Pose write pose Pose campose dat After the calibration the program necessary for the project can be made and with it takes measures from a central point defined in the program and another object situated on the Work area 63 7 Camera location lighting and calibration To show this in the next picture there is a meter to measure the distance between the center considered by the camera red point and the center of the black ball The program shows the distance between this center and the ball on the bottom Can be checked than the coordinates are exact because the center of the ball is just in a distance of 40 mm and the program returns this value A Graphics Window x Clear Active H 0 346123270141 0 104956194756 Picture 7 7 First real coordinates 7 5 HALCON program for the real process of the project The process to implement consists in a black ball placed everywhere on the table the ball has to be picked up by the robot and put down inside the white box situated on the conveyor For this are going to be defined two regions in order to recognize easily each object on each surface In Chapter 3 the color of the table white was chosen to help and simplify the images later collected For this reason black ball an
29. 96KB 0 1ms 1000 instructions 0124 0016 AI5 A02 CPU 315F 2 DP CPU 315F 2 PN DP E CPU 316 CPU 316 2 DP E CPU 317 2 CPU 317 2 PN DP 28 CPU 317F 2 4 pulse outputs 2 5kHz 4 ss cose Picture 5 9 Ninth picture PROFIBUS network configuration 10 Afterwards select in the menu bar Parameters the address is just the number which identify the network realize that this address is not the same as the MPI address Revise if it s correct and click on New Config SIMATIC 300 1 Configuration Project la x ly Station Edit Insert PLC View Options Window Help 81 x 83 amp 21 E 82 B xl 0 UR Properties DP R0 52 1 PROFINET ID E bf SIMATIC 300 General Addresses Operating Mode Configuration a cram 5 300 General Parameters B CPU 312 9 08 CPU 3121 Address pg CPU 3126 B CPU 313 9 88 CPU 313C Egg CPU 313C 2 DP Bg CPU 313C 2 PIP Subnet 4 9 CPU 314 9 08 CPU 314 IFM 0 UR CPU 314C 2 DP Slot 4 Module Order ni a 2 CPU 314C 2 DP 6ES7 3 24 2510 Press F1 to get Help Properties Delete 4 dj e ud gt SIMATIC Manager Project 8 Microsoft BRRHW Config 5 Picture 5 10 Tenth picture in PROFIBUS network con
30. Browse CPU 300 H E CPU 312 28 CPU 3121 CPU 312 gg CPU 313 gg CPU 313C CPU 313 2 DP g CPU 313 2 CPU 314 CPU 314 IFM zy CPU 314C 2 DP 57 314 6 00 0 0 Slot 4 Module Orde Bl BES 314 6CFO1 0B0 ur ana ee _ S GES 314 8CF 02 0480 2 CPU 314 20 5 cal Co MACOO FPs ne 228 ADAE 8 vao CPU 34C2 PIP 22 aem 28 CPU 315 24 Gert 771 Defau 3 Default 0 UR off Ee Ee E E E 28 CPU 315F 2 DP CPU 315F 2 PN DP gg CPU 316 gg CPU 316 2 DP gg CPU 317 2 g CPU 317 2 PN DP g CPU 317F 2 0 1 co integrated 4 pulse outputs 2 5kHz 4 xl Press F1 to get Help Chg start ma SIMATIC Manager Project M Documenti Microsoft W Config SIMATIC 4 mee cS SIN E 91 20 57 Picture 5 8 Eighth picture in PROFIBUS network configuration 9 Open the object properties clicking with the right button on DP HW Config SIMATIC 300 1 Configuration Project Station Edit Insert PLC View Options Window Help la x S 72 48 2 0 UR
31. CE CE CE CE CE CE K CE CE CE CK GE GE K Dim vacuum on As String vacuum Read 1 IblVacuum Caption vacuum If robot ball pos 1 Then suction Write 1 OPC item End If 137 A3 Visual Basic final programs A3 Visual Basic final programs vacuum sensor is the process follows KK CK K K GE CE CE CK KKK KKK CK CE CE CE CE CE CE CE CE K CE CE K CE CE CE CK CE GE CK If IbiIVacuum Caption True Then vacuum on VACUUM 1 Winsock1 SendData vacuum on ball aspirated True Else If error robot 1 Then suction Write O Step check ball1 End If End If End Function Public Function ball in box As Boolean to leave the ball in the box CK K K K K GE CE GE CK K GE CK CE CE CE CE CK CE CE CE K CE GE If robot box 1 Then suction Write O vacuum Read 1 IblVacuum Caption vacuum ball in box True End If End Function Public Function check ball in box As Boolean check if the ball is inside the box and then start the belt CK K K K K GE CK GE CE CK CE CE CK CE CE CE CK CK GE CE CK K CE CE CE CE CE CE K CE CE CK CE CE CE CK CE CE K CE CE GE K CE GE If robot process done 1 Then bit stop Write O cmdStart Enabled True cmdStop Enabled True Startbelt Enabled True Stopbelt Enabled True Call Op DispObj ho_Image _ hv_ExpDefaultWinHandle Call Op Decompose3 ho Image ho red ho green ho blue Call Op Rgb3ToGray ho red ho green ho blue
32. Edit Insert PLC Debug View Options Window Help 8 x olsa e leel of Se gt ee Homa Nel Network 26 Title network a a Bit logic 4 4 le oof NOTI 0 CR Pe lt 5 RS E SR N write register i P Dex 5 Hetwork 3 Title s E NEG 5 m 2g Comparator 52 Converter a Counter amp pB DB M20 0 Jumps Hwritten H Integer functi Floating point 5 Move Program contr shift Rotate Ga Status bits Timers ig Wordlogic v b Enable the writting to the input data and the register To write 1 fwritten jR SFO OOO Press F1 to get Help 9 offline lt 5 2 2 Insert 0 Astarte SIMATIC Manager Test FC2 fH Documenti Microsoft w DIRAL OPIT 1215 Picture 6 4 Move data 54 6 Step 7 program for the conveyor Introduce Function Blocks with the inputs and outputs made Include also their equivalent switches which enable each one Write the correct values in each data it means with the switch 125 0 in low in register 5 the value 50 is introduced value of speed and after it 1s sent over the PLC to the motor WSLAD STL FBD OB1 TestMotor SIMATIC 300 1 CPU 314 2 DP File Edit Insert PLC Debug View Options Window Help 18 xj olele al Sel
33. H E SIMATIC PC Based Control 300 400 SIMATIC PC Station 9 08 Controller 4 CP Industrial Ethernet gg CP PROFIBUS vo gt Bg 5411 gt o TE 89 08 5412 2 Index ir Module Order nu 2 MEERN Beg cP 5511 Bg 5512 SW V6 0 SP4 Properties PROFIBUS interface CP 5611 R0 S2 Gens Parameters Transmission rate 1 5 Mbps 8 4 Fourth step 70 8 OPC communication In object properties include the new network done like it was explained in chapter 5 The program has the following appearance Picture 8 6 HW Config shuttle1 Configuration Miguelopc station Edit Insert PLC View Options Window Help 221 8 8 2 825 42 Km 2 CP oe Copy Ctrl C Paste GtrEEV Replace Object Add Master System Disconnect Master system Insert PROFINET 10 System Disconnect PROFINET IO System PROFINET Manage sync Domain PROFINET Topology Isachrane Mod 3 4 5 8 9 Specify Modules Delete Del To Filter4ssigned Modules Monitor Modiry Edit Symbals Object Properties Alt Return 01 PC produet Support Information Chrl4F2 3 M FAQs Ctr F7 Manual Ctrl F CP 5611 6GK1 561 1 5 0 Displays properties of the selected object for editing taa Gs Co
34. HRI Comparator 8 29 Converter Network 10 Title 9 8 Counter Move the input data to the Write Data 1 and 0 32 bits 58 DB call 89 081 Jumps Integer functi 89 088 Floating point 9 0 Move HG7 Program contr H E Shift Rotate 9 00 Status bits 88 095 Timers H Word logic b Hetwork 2 Title the written register to the Read Register Selector 4 Address info Press F1 to get Help offline 45 lt 5 2 1 Insert 15 eu 51 Manager Test ERSLAD STL FBD 2 BW Documenti Microsoft W Picture 6 1 Inputs ea LAD STL FBD FC2 TestMotorSIMATIC 300 1 CPU 314C 2 DP TG File Edit Insert PLC Debug View Options Window Help la x El a Interface CX IN Hb Input value n write register s DEB written 2920 To write i0 R OX IN OUT iex 6 TEMP Rs X RETURN SR P pane SAVE FCZ Title Bit logic a PES Comment i f Pos 9 8 Comparator 9 29 Converter Network 1 Title H E Counter i Move the input data to the Write Data 1 and 32 bits DB call Jumps 9 0 Integer functi Floating point 9 05 Move 9 9 Program contr HE Shift Rotate Hga Status bits 9 05 Timers 9 28 Wordlogic b Hetwork 2 Title the written register to the Read Register Selector Press F1 to get Help
35. Image _ hv ExpDefaultWinHandle Call Op Decompose3 ho Image ho red ho green ho blue Call Op Rgb3ToGray ho red ho green ho blue ho ImageGray Call Op DispCross hv ExpDefaultWinHandle 350 540 6 0 Call Op ReduceDomain ho ImageGray ho Ellipse ho ImageReduced1 Call Op Threshold ho ImageReduced1 ho Region 0 18 Call Op Connection ho Region ho ConnectedRegions Call Op SelectShape ho ConnectedRegions ho SelectedRegions area and 1200 5000 Call Op SelectShape ho SelectedRegions ho SelectedRegions1 roundness and 0 5 1 Call Op FillUp ho SelectedRegions1 ho RegionFillUp Call Op CountObj ho RegionFillUp hv Ball If Tuple TupleEqual hv Ball 1 Then txtBallOut Text Call Op AreaCenter ho RegionFillUp Area Row hv Column Call Op ImagePointsToWorldPlane hv CamParam1 hv PoseNewOrigin1 350 540 Xcenter Ycenter Call Op ImagePointsToWorldPlane hv CamParam1 hv PoseNewOrigin1 hv Row Column mm Xball hv Yball Call Op DispCross hv ExpDefaultWinHandle hv Row hv Column 6 0 BallX2 Format Round hv Xball 000 BallY2 Format Round hv Yball 000 Else Call Op SetDraw hv_ExpDefaultWinHandle margin Call Op DispObj ho Ellipse _ hv ExpDefaultWinHandle Call Op SetColor hv ExpDefaultWinHandle yellow txtBallOut Text Ball out of the robot reach MsgBox Put the ball within the range of the robot to follow End If Check if the coordinates i
36. all the steps to implement but before it is necessary to explain the process in general The project consists of a conveyor and robot application controlled by a camera The user can put a box wherever he wants on the conveyor the robot picks up a ball situated somewhere on the surface of work and put the ball down inside the box After this the camera checks if everything is perfect therefore the conveyor will start When a new box appears on the conveyor the process will start again On the following is the whole flowchart with the process It 1s the structure of the main program The most difficult part is how to make the communication between the main program the server in the robot and the robot program itself The data sent 1n the process will be explained in the next paragraph in order to understand it in an easiest way 90 Start transport belt Box in position Ball in robot reach Ball in robot reach Coordinates are the same Server connected Picture 11 1 Flowchart 91 11 Flowchart and final programs Robot in ball position Vacuum sensor ON Robot in box position Is the ball inside the box New box at the beginning of the belt 11 Flowchart and final programs 11 2 Final programs 11 2 1 General aspects in the communication Firstly the data needed in the communication should be declared in the robot These data have to be declared as global because t
37. data when variable has been read E SE SE K SE GE SE GE GE OK OK KOK CK K CE CE CE CE CE CE GE CE SE CE GE GE CE GE GE CE GE GE GE GE GE KK KKK Strdata Empty coordinates in the robot 03K 2K OK OK OK OK OK OK OK OK OK OK OK OK OK GE GE OK KOK CE KK Dim str_Xball As String Dim str_Yball As String 145 A3 Visual Basic final programs Dim str_Xbox As String Dim str_Ybox As String Label1 Caption CrossCcommands ShowVar X_BALL str_Xball Label1 Caption str_Xball Label2 Caption CrossCcommands ShowVar Y_BALL str_Yball Label2 Caption str_Yball Label3 Caption CrossCcommands ShowVar X_BOX str Xbox Label3 Caption str_Xbox Label4 Caption 5 str Ybox Label4 Caption str_Ybox End Sub Private Sub connectiontest Do connection test and fire message OK KKK KKK KKK KKK KKK KKK CE CE GE SE CE CE GE KKK KKK KKK Select Case TcpClient State Case sckClosed txtconnectstat Text Socket closed ConStateServer Visible True ConStateServer FillColor vbRed Case sckListening txtconnectstat Text Listening ConStateServer Visible True ConStateServer FillColor vbYellow cmdConnect Enabled False IblCoord Caption IbIBallPos Caption IbIBoxPos Caption Ib Vacuum Caption IblDone Caption Case sckConnectionPending txtconnectstat Text Connection pending ConStateServer Visible True ConStateServer FillColo
38. getVar CrossCommands CrossComm getVarValue varName End Function To make communication with the kuka cross Public Function ConnectToCross ByVal sConnectName As String Optional nC Mode As Integer As Boolean End Function To read a variable in the Kuka KRC1 Public Function ShowVar ByVal sVariableName As String ByRef sResult As String Optional vTimeOut As Boolean End Function To set a variable in the Kuka KRC1 Public Function SetVar ByVal sVariableName As String ByVal sNewValue As String Optional vTimeOut As Boolean End Function Deconnect from Kuka cross KRC1 Public Sub ServerOff End Sub Check Connection with Kuka Cross KRC1 Public Property Get CrosslsConnected As Boolean End Property 151 A3 Visual Basic final programs Public Function SetValueEx ByVal hKey As Long sValueName As String As Long vValue As Variant As Long Declare Variables Dim As Long Dim sValue As String Select Case Case REG_SZ sValue vValue amp Chr 0 SetValueEx RegSetValueExString hKey sValueName 0 sValue Len sValue Case REG_DWORD IValue vValue SetValueEx RegSetValueExLong hKey sValueName 0 4 End Select End Function Function QueryValueEx ByVal IhKey As Long ByVal szValueName As String vValue As Variant As Long Declare Variables Dim cch As Long Dim Irc As Long Dim IType As Long Dim As Long Dim sValue As St
39. hv Box Call Op ImagePointsToWorldPlane hv CamParam1 PoseNewOrigini 350 540 microns hv Xcenter Ycenter Call Op ImagePointsToWorldPlane hv CamParam1 hv PoseNewOrigin1 hv Row1 hv Column1 microns Xbox Ybox Call Op DispCross hv ExpDefaultWinHandle hv Row1 hv Column1 6 0 findbox1 True End Function Public Function findball1 As Boolean reset data from the robot CE E SE K SE GE GE GE GE GE CE CE CE CK CE CE CE GE CE CE GE KKK robot ball 0 robot box pos 0 robot process done 0 error robot 0 cmdConnect Enabled True cmdStart Enabled False cmdStop Enabled False 132 A3 Visual Basic final programs Stopbelt Enabled False Startbelt Enabled False hsbBoxPos Enabled False look for the ball and detect if is inside or outside of the robot range LK K K K K K K CE CK CK CE CK CE CE CE CK K CE CE CE CE CE CE CE CE CE CE CK KKK KKK KKK KKK KKK K K K K XK XK K K K K K Call Op DispObj ho Image _ hv ExpDefaultWinHandle Call Op Decompose3 ho Image ho red ho green ho blue Call Op Rgb3ToGray ho red ho green ho blue ho ImageGray Call Op DispCross hv ExpDefaultWinHandle 350 540 6 0 Call Op GenEllipse ho Ellipse O 510 0 07 480 410 Call Op ReduceDomain ho ImageGray ho Ellipse ho ImageReduced1 Call Op Threshold ho ImageReduced1 ho Region 0 18 Call Op Connection ho Region ho ConnectedRegions Call Op SelectShape ho Con
40. ject Rur Ston Pause Explorer Lavout Prapertie 5 window Picture 4 1 Title bar menu bar and toolbar The Form Window 1s central to developing Visual Basic applications It is where you draw your application _ 38 p Farmi 4 Visual Basic programming Picture 4 2 Form window The Toolbox is the selection menu for controls used in your application El General Pointer he Label A atl Frame O Check Combe Horizontal Scroll 25 Timer e I Directory List Box 2 Shapes Image Box Object Linking Picture Box Text Box Command Button Option Button List Box Vertical Scroll Bar Drive List File List Bax Lines Data Tool Picture 4 3 Toolbox The Form Layout Window shows where upon program execution your form will be displayed relative to your monitor s screen i m Form Layout Mi Picture 4 4 Form layout window The Properties Window is used to establish initial property values for objects The drop down box at the top of the window lists all objects in the current form Two views available Alphabetic and Categorized Under this box are the available properties for the currently selected object 20 4 Visual Basic programming Properties EF Form Farm Alphebsbe Categorized Fonni 1 20 He Grable
41. lt gt mim Hola Network 16 Title lt lt New network The switch 125 0 enables the velocity of the transport belt when in low Sy Bit logic R Comparator H 3 Converter H E Counter call 9 05 Jumps H E Integer function Floating point Fet Ez Move 8 13 Program control H E Shift Rotate a ga Status bits H Timers H E Word logic H FB blocks H FC blocks g SFB blocks H E SFC blocks Hetwork 2 Title 0 Multiple instances TIAS M20 2 1 B 16 2 register written Press 1 to get Help offline labs lt 5 2 Nw 1 Insert w eg simaric Manager Test 0B1 i Documenti Microsoft Picture 6 5 Two function blocks it LAD STL FBD OB1 TestMotor SIMATIC 300 1 CPU 314C 2 DP j ick File Edit Insert PLC Debug View Options Window Help New network 9 30 Bit logic H Comparator 8 9 Converter a Counter 1125 0 M20 3 58 DB call 9 51 Jumps P H E Integer function ER Floating point Fet 9 05 Move 1 9 28 Program control H E Shift Rotate K ga Status bits B 16 2 H Timers 28 Word logic Ig 5 H FB blocks H FC blocks SFB blocks H E SFC blocks Hetwork 4 Title 0 Multiple instances Libraries The switch 125 7 introduces the initial parameters in the motor Press F1 to get Help offline labs lt 5 2 1
42. point The system automatically generates a name The name can be overwritten 3 CONT end point 1s approximated blank the motion stops exactly at the end point 4 Velocity 0 001 2 m s 5 Name for the motion data set The system automatically generates a name The name can be overwritten If 1s chosen a CIRC motion additionally appears another auxiliary point what defines the coordinates of the auxiliary point to describe de circle 28 2 KUKA robot Overwiew programming over Option window Frames Picture 2 14 Frames 1 Tool selection Range of values 1 16 2 Base selection Range of values 1 32 3 External TCP False Tool on mounting flange True Fixed tool Option window Motion parameter in motions Picture 2 15 Motion parameter 1 Acceleration Refers to the maximum value specified in the machine data 1 100946 2 Furthest distance before the end point at which approximate positioning can being This box is only displayed if CONT has been selected in the inline form 0 100496 In CIRC and LIN motions the orientation of a tool can be different at the start point and end point of a motion It can be selected by a new option called Orientated Control Selection There are several different types of transition from the start orientation to the end orientation Three options are available Standard Wrist PTP and Constant 29 2 KUKA robot Overwiew and progra
43. set caption of connect button LXK K K K K K K K CK K GE CK CE CE CE CE CK CE CE CE CE CE CE CE CE CE KKK If Winsock1 State 0 Then cmdConnect Caption Connect Else cmdConnect Caption Disconnect End If End Sub Public Function findbox As Boolean cmdConnect Enabled True hsbBoxPos Enabled True follow central point of the box KK K K K K GE GE CK K GE CK CE CE CE CK CE CE CE CK CE CE CE CE CE GE K Call Op Decompose3 ho Image ho red ho green ho blue Call Op Rgb3ToGray ho red ho green ho blue ho ImageGray Call Op SetColor hv ExpDefaultWinHandle yellow Call Op DispCross hv ExpDefaultWinHandle 350 540 6 0 Call Op GenRectangle2 ho Rectangle2 100 480 0 05 500 70 Call Op ReduceDomain ho red ho Rectangle2 ho ImageReduced Call Op Threshold ho ImageReduced ho Region1 45 255 Call Op Connection ho Regioni ho ConnectedRegions1 A3 Visual Basic final programs Call Op SelectShape ho ConnectedRegions1 ho SelectedRegions2 area and 9000 12000 Call Op FillUp ho SelectedRegions2 ho RegionFillUp1 Call Op CountObj ho RegionFillUp1 hv Box detect if the box is in the transport belt and stop this in a specific region LK K K K K K K K K K K CK CK CE CE CE CE CE CE CE CK CE CE CK K CE CE CK CE CE CE CE CE CE CK CE CE K CK CE CE CK K CE CE CK CK GE CE CE CE CE GE CK K K K If Tuple TupleEqual hv Box 1 Then txtBoxOut Text Call Op AreaCenter ho
44. show a correct sending and reception Client Settings for robot ACRO_F1 xj Main Settings B State Server B State Robot Remote settings Remote 0101 Locale settings Ip Addr 135 123 165 4 Connection state Corrected ta host Server Connections Robot Connections zannest Connect Disconnect Send Receive Send Picture 9 3 Server program in the robot 82 9 Communication and Visual Basic programs 9 3 3 Program in the main PC The current section like section 9 2 displays a small program which will take part in the final program The aim of the program is completely different This application is just to demonstrate that communication can be possible and to check that data sent and received are correct without mistakes ELLEN C8 x Send Helo Disconnect Connected Ip address 1 36 129 165 4 Remote Port iom Received Good Clear Picture 9 4 Program to communicate with the robot The programming code of both program used for the communication is in Appendix 2 at the end of the current report section A2 2 and A2 3 These programs are not explained in the current chapter because it will be added in the final program and it will be explained in one of the last chapters of the project report 83 10 Robot settings suction system and calibration CHAPTER 10 Robot settings suction system and calibration 10 1 Robot suction system The ne
45. takes pictures with the caltab in different positions around the table ____ Picture 7 5 Caltab 7 Camera location lighting and calibration The next program takes pictures and it records one image in the map images2 with a three number from 000 Then the program could be executed once the caltab is situated in another position and execute again following this process The pictures would be a tiff file Logging images for calibration close all framegrabbers dev close window open framegrabber uEye 2 2 0 0 0 0 default 8 rgb 1 false Ul146xLE C 1 0 1 AcqHandle dev open window 0 0 512 380 black WindowHandle set framegrabber param AcqHandle contrast 256 set framegrabber param AcqHandle exposure 10 3157 set framegrabber param AcqHandle frame rate 27 542 set framegrabber param AcqHandle gain master 30 set framegrabber param AcqHandle white balance auto Counter 0 while true grab image start AcqHandle 1 grab image async Image AcqHandle 1 write image Image 0 images2 Counter 03 tiff Counter Counter 1 stop endwhile Subsequently one of the images taken during the calibration are seen as well as the caltab s contour and dots that the program HALCON has drawn Picture 7 6 Calibration picture 62 7 Camera location lighting and calibration The following program op
46. the Windows interface Administrator The range of functions is the same as that for the user group Expert It is additionally possible in this user group to integrate plug ins into the robot controller When the system is booted the user group User is selected by default The user groups Expert and Administrator are password protected 2 2 4 Coordinate system The following Cartesian coordinate systems are defined in the robot system WORLD The World coordinate system is a permanently defined Cartesian coordinate system It is the root coordinate system for the Robroot and Base coordinate systems By default the World coordinate system 15 located at the robot base ROBROOT The Robroot coordinate system is a Cartesian coordinate system which is always located at the robot base It defines the position of the robot relative to the World coordinate system By default the Robroot coordinate system is identical to the World coordinate system Robroot allows the definition of an offset of the robot relative to the World coordinate system BASE The Base coordinate system 15 a Cartesian coordinate system that defines the position of the workpiece It 1s relative to the World coordinate system By default the Base coordinate system 1s identical to the World coordinate system It is offset to the workpiece by the user 24 2 KUKA robot Overwiew programming over 2 2 5 Tool calibration During
47. the lower end of the main window HDevelop provides a status bar This displays useful information in many cases Especially during the execution when the program stops to visualize results or waits for a user interaction corresponding instructions are given 2 Many programs will automatically display relevant data in the graphics window Manual visualization can easily be achieved by double clicking on the icons in the variable watch window 3 Depending on the selected installation type not all images used in an example program might be available In this case we recommended to insert the HALCON CD or to install the needed images 4 Some programs use frame grabbers for image acquisition If the corresponding frame grabber type is not available an error message will be raised In this case we recommend to either use another example or to modify the parameters to fit to the available hardware Furthermore if HDevelop Demo is used no frame grabber interfaces can be used including the File frame grabber which reads images from files If you want to use these programs please use HDevelop 10 1 to HALCON programming 1 4 Using HALCON within Programming languages HALCON offers three so called language interfaces They are libraries that enable you to call the operators and to use the data types of the HALCON library in an easy way Two language interfaces are designed for specific languages These are the
48. the shape based matching For efficiency and data security reasons not the entire structure but only the handle 1s passed to the programmer All processing of data is controlled with a unique integer value These integers are magic numbers that must not be changed and can differ from execution to execution and version to version Examples where handles are used are graphics windows files sockets image acquisition devices OCR OCV measuring matching and so on 1 2 2 Image acquisition Currently HALCON provides interfaces about 40 frame grabbers in the form of dynamically loadable libraries Windows DLLs UNIX shared libraries These libraries are installed together with the HALCON libraries Library names start with the prefix HFG the libraries starting with parHFG are used by Parallel HALCON The HALCON frame grabber interface libraries form the bridge between software provided by the frame grabber s manufacturer and HALCON They form a common generic interface that requires a small set of operators only If you successfully installed your frame grabber all you need to do to access it from HALCON is to call the operator open framegrabber specifying the name of the frame grabber and some additional information e g regarding the connected camera Then images can be grabbed by calling the operator grab image or grab image async 1 3 HDevelop HDevelop is a powerful environment for both prototyping and metho
49. to declare the global variables For this go to C KRC ROBOTER KRC RI System and access to config dat The variables that have been declared are the next DECL REAL X_BALL DECL REAL Y_BALL DECL REAL X_BOX DECL REAL Y_BOX DECL INT ROBOT_COORD DECL INT ROBOT_BALL_POS DECL INT ROBOT_BOX_POS DECL INT VACUUM DECL INT ERROR_CODE When these variables have been typed on the bottom of the file and after saving the computer should be restarted in the program It means shut down the computer to configure the changes Now in the program can be declared another variables and positions The variables utilized to give the position to the robot should be integer The coordinates are given in microns and the robot works in millimeters Each variable must be divided by 1000 Realize that the entire program is a loop and the robot is always waiting ROBOT_COORD to start working When the robot receives this data from the main program the first step to go to the selected point P6 it 1s like the home position After this point it needs another if not it shows an error this is the reason because there is another P4 Realize that every point has the reference of the tool and the base fixed Set all the axis of the point P4 on 0 15 the best way to give after the exact value of the coordinates because the coordinates have the reference of the camera So the position al be set the coordinates X and Y of the ball and th
50. tool calibration the user assigns a Cartesian coordinate system TOOL coordinate system to the tool mounted on the mounting flange The TOOL coordinate system has its origin at a user defined point This is called the TCP Tool Center Point The TCP is generally situated at the working point of the tool Advantages of the tool calibration The tool can be moved in a straight line the tool direction The tool can be rotated about the TCP without changing the position of the TCP In program mode The programmed velocity is maintained at the TCP along the path A maximum of 16 TOOL coordinate systems can be saved Variable TOOL_DATA 1 16 The following data are saved e X Y Z Origin of the TOOL coordinate system relative to the FLANGE coordinate system e Orientation of the TOOL coordinate system relative to the FLANGE coordinate system Tool calibration consists of 2 steps 1 Definition of the origin of the Tool coordinate system The following methods are available TCP calibration XYZ 4 Point method The TCP of the tool to be calibrated is moved to a reference point from 4 different directions The reference point can be freely selected The robot controller calculates the TCP from the different flange positions TCP calibration XYZ Reference method In the case of the XYZ Reference method a new tool 1s calibrated with a tool that has already been calibrated The robot controller compares the flang
51. transparent use of automatic parallelization which allows an easy way of speeding up the program when using large images on a multi CPU computer 1 2 1 2 Parameters and Data Structures Images HALCON has two basic types of parameters iconic data images etc and control data integers handles etc parameters for each operator are arranged in a standardized order input iconic output iconic input control and output control Not all of the groups might be needed for a given operator However the order remains the same Each operator has a self describing interface This desription contains besides the standard documentation information about parameters like types or value lists which can be accessed online Input parameters of operators are never modified which results in a very clear and simple sementics There are only three operators that do not follow this principle to ensure maximum performance namely set grayval overpaint gray and overpaint region The open architecture allows to access internal data and to integrate external data necessary data structures for 2D image processing like multichannel images region contours tuples a kind of array etc are directly supported using an extremely efficient implementation Images belong to the iconic data 1 to HALCON programming The major part of an image are the channels 1 matrices containing the gray values of va
52. variables declared in the robot and the value of them in real time As was mentioned in other paragraph the coordinates are in microns These will be converted to millimeters in the robot program On the left side in the bottom of the window are the variables that show the state of the robot while it is running in real time The programming code of the current program can be seen in Appendix 3 section A3 2 Client Settings for robot ACRO R1 Settings Con State Habot Remote settings Remote Port 0101 Con State Server ACRO Q Uraa Dino dele Locale settings Ip Addr i 35 123 155 4 Connection state Connected to hos Robot Connections Coordinates in rabat Server Connections Robot Status ROBOT_COOFD 1 BALL 144104 0 as ee ROBOT BALL POS 1 BALL 129088 0 aom ACUUM 1 BOX 203910 0 irum BU PLIS 1 Ao 2909196 0 PROCESS _DONET Picture 11 4 Server program in the robot computer 99 11 Flowchart and final programs 11 2 4 Robot program The program of the robot is a short program To understand it is better to look back to Picture 11 2 and to see the direction of each variable in the communication process while the robot is running In this program there are some steps Firstly before than start making the program is necessary
53. with the robot on a moveable conveyor The available robot is a KUKA KR 3 The robot has 6 degrees of freedom an own operating system a PROFIBUS Interface and an Ethernet Interface to communicate with the objective world 0 and Objectives The vision system will consist of an USB camera Basler Scout or IDS Ueye with lens and finally lightning The software which analyses the images will use HALCON and the computer application will be written in Visual Basic or The communication between the robot and the vision system PC will occur over Ethernet or PROFIBUS and the communication between the computer and the conveyor over PROFIBUS via OPC All these goals show an open field in which the project is developed Because of this all the decisions made during the project are managed by the student in order to create a final application inside of the defined objectives 1 to HALCON programming CHAPTER 1 Introduction to HALCON programming 1 1 Introduction Vision development environment HALCON defines the state of the art machine vision software It provides an extensive vision library HALCON solves your task so fast and with highest accuracy Solving image processing tasks is just one part of a complete solution which comprises other software components like process control or database access and hardware components from illumination to image acquisition devices
54. 0 Eg M7 EXTENSION pg 5 300 5 307 10 PoP rf i 3 HB PS 307 5 5 28 RACK 300 5 300 i SIMATIC 400 57 307 1BA00 0440 Load supply voltage 120 230 VAC 24 VDC aj 2 start 4 8 gt Configurati y Scout SIMATIC B conti Picture 8 8 Eighth step TE a7 SHS i 2 8 OPC communication Include the CPU for the PLC and create a new network in this case with address 7 This network will connect the motor Config SIMATIC 300 1 Configuration Miquelopc xl ll Station Edit Insert PLC View Options Window Help 81 x a 98 xl m C LEN 314 2 DP Profile Standard Paste ABE PROFIBUS PA Replace Object i PROFINET ID Add Master System SIMATIC 300 Disconnect Master System H C7 inser PROFINET TO System j B 8 CP 300 Disconnect PROFINET IO System a CPU 300 PROFINET Manage Syne 8 amp CPU 312 PROFINET 10 Topology CPU 312 IFM 5 28 CPU 312 Isachrone Mode J E CPU 313 Specify Module i sim 3 z 2DP Delete 22 mE CPU 3130 2 PIP mg CPU 314 Go To J E CPU 314 IFM Filter Assianed Modules a CPU 314C 2 DP Monitor Modify MN BES7 314 6CFOT 0aB0 Edit Symbole a 5 314 6CFO2 0AB0 O
55. 2004 MV Tec Software GmbH M nchen Germany e Operating and Programming Instructions for end users for KUKA system software 5 2 5 3 5 4 version 1 1 21 07 2006 KUKA Roboter GmbH Augsburg Germany e Safety Robot System EU version 0 2 2 06 2006 KUKA Roboter GmbH Augsburg Germany e Working with an agent from the KUKA Company from 20 11 2007 to 22 11 2007 slides and documentation e Programaci n en Visual Basic NET Luis Miguel Blanco 2002 Grupo EIDOS Consultar a y Documentaci n Inform tica S L 2002 e Integrated Servo Motors Technical Manual JVL Industri Elektronik A S Denmark e Using Visual Basic VB to communicate with the 05100 100 version 2 0a Tibbo Technology Inc 2001 2002 Web bibliography www opcfundation org www profibus com www catalog myosram com www jvl dk www kuka com WWW usa siemens com WWW microsoft com www msdn2 microsoft com www mvtec com halcon www ueye com www festo com 106 13 Bibliography 107 1 Visual Basic learning programs APPENDIX 1 Visual Basic learning programs First program Conversor de Temperaturas Celsius Fahrenheit Option Explicit Private Sub gff Click Private Sub cmdExit Click End End Sub Private Sub mnuFileExit Click End Private Sub vsbTemp Change txtCelsius Text vsbTemp Value txtFahr Text vsbTemp Value 1 8 32 End
56. 2M5VC1 Internal screw terminals Loose Profibus DP female M12 connector B coded WI1028 M12F5VC1 Internal screw terminals Profibus DP male M12 termination resistor B coded WI1028 M12M4STR3 Protection caps Optional if connector is not used to protect from dust liquids X X IP67 protection cap for M12 WI1000 M12FCAP1 female connector X X IP67 protection cap for M12 WI1000 M12MCAP1 male connector Important Please note that the cables are a standard type They are not recommended for use in ca ble chains or where the cable is repeatedly bent If this is required use a special robot cable 2D or 3D cable See also Accessories page 74 where additional M12 connectors are shown JVL Industri Elektronik A S User Manual Integrated Servo Motors MACO50 800 19 4 5 4 5 16 120 Expansion Module MACOO FP2 FP4 GSD file for the MACOO FP2 and FP4 The GSD file must be used to configure the PLC or master controller used for the Profi bus communication The file is shown here but is also available on disc Please contact your nearest JVL representative GSD file COM PROFIBUS V 3 3 GSD Xport Time Stamp 01 31 00 12 36 39 Profibus DP lt Unit Definition List gt GSD_Revision Vendor IND EL Model Name MACOO FP Revision 0 0 Ident Number 0x06BC Protocol Ident 0 Station Type 0 Hardware Release l l Software Release 1 2 9 6 supp 19 2 supp 93 75
57. 3140 2 DP Hardware CPU DP 57 Program 1 21 88 shuttlet i B8 OPC Server Press F1 to get Help ICP5611 PROFIBUS Astart 4 aj eu s Configurati amp Scout sivi me Document Bw Config NES AMSTA 10 Picture 8 11 Eleventh step To download in the PLC is necessary to make some changes To download the PC Station shuttle1 select options set PG PC interface and select PC internal local J SIMATIC Manager opc C Program Files amp Siemens Step7 s7projopc B le xi Bp File Edit Insert PLC view Options Window Help la x Diae bal Customize Ctri Alt E Y anl x 2 Text Libraries b c Display Language CPU 314 2 DP Manage Multilingual Texts 57 Program 1 21 88 shuttlet OPC Server Run Time Praperties Gompare Blacks Reference Data Define Global Data Configure Network Simulate Modules Configure Process Diagnostics Edit safety program Processes interfaces and parameter assignments For devices and assigns them to each other PAstart 4 l Configurati iy Scout sima ric 2 Document Config m m AMSTA 106 Picture 8 12 Twelfth step dA 8 OPC communication CPU 314C 2 DP Hardware CPU 314C 2 DP i 57 Programit 5 48 shuttle d OPC Server Set PG PC Interface Properties TCP IP gt Intel PRO 100 VE
58. 50 800 4 5 Expansion Module MACOO FP2 FP4 4 5 2 MACOO FP2 and FP4 Address and Termination setup Each unit connected to the Profibus must be set up with a unique address The illustration below shows how the address and termination can be set on the internal dip switch The dip switch is located on the internal circuit board 00 2 and FP4 Dip switch settings Rear side of the MACOO FP2 or FP4 Mini dip switch expansion module Dip 1 7 Address setting address range 0 127 Dip 8 Address set by software Dip 9 10 Line termination Both set to ON Term enabled Both set to OFF Term disabled 0000000000 Notes SWI default setting All switches set to except 9 10 which are OFF which corresponds to Address is set by software Termination disabled Address set by software DIP8 means that the profibus address will automatically be set to the same value as the motor address Dip switch location on the MAC00 FP2 Expansion module Cable glands Basic MAC motor housing nternal circuit boards Profibus and I O Dip Switch placed on the rear side of the TT0946GB module connectors JVL Industri Elektronik A S User Manual Integrated Servo Motors MACO50 800 105 4 5 Expansion Module M ACOO FP2 FP4 4 5 3 Output data M aster gt Slave The MACOO FP2 FP4 module contains 9 bytes of output data Wr name EUNKIIINNENLITII NNNM Ce we
59. Acknowledgments Acknowledgments There are an enormous number of people who I would like to express my gratitude to Firstly I would like to pay special tribute to the research group for their invaluable assistance in preparing my project It is a pleasure to express my thank to them Eric Claesen my project coordinator Wim Beckers Roel Conings Kevin Donn Sven Boedrij Veronique Theunis Ann Claes Stijn Delen Geert Leen and Nico Bartholomevis I want to thank all of them for their kind assistance during the developing of this project I owe an immense debt of gratitude to them for having given me the love for and curiosity about robotic automation and visual servoing applications I am indebted to several people for giving me encouragement to develop this project Firstly I would like to express my profound gratitude to Raquel my girlfriend for provided me courage enough for keep on working when I needed it the most I am also very gratefully with Yves for his kindness and for keeping me company the whole time I thank my family and my Spanish friend for their loving support from Spain Greet Raymaekers my Erasmus coordinator and Erasmus students who are studying with me in Hasselt and those who left Index 0 Background and objectives 1 Introduction to HALCON programming 1 1 Introduction Vision development environment 1 2 Develop applications with HALCON 1 2 1 Architecture and data structures 1 2 1 1 HALCON
60. BallX1 Format Round hv Xball 000 BallY1 Format Round hv Yball 000 BallX2 Format Round hv Xball 000 BallY2 Format Round hv Yball 000 If BallY1 BallY2 Then If BallX1 BallX2 Then findball2 2 True Else Step ball moving End If Else Step ball moving End If After this the coordinates are changed to microns because in the communication can t be sent variables with a comma and in this way the exactitude 1s higher 94 11 Flowchart and final programs As was explained in the previous section the communication uses strings data In these strings the name of the variable and the value are included The value of the coordinates have to be without comma otherwise the robot software shows error messages And even the communication gave another problem the variables in the robot were declared as and from Halcon are declared as variant These kinds of data are incompatible but for example an integer is not a good variable because it rounds the values and the coordinates would be incorrect After some test the kind of data chosen was long For this see the following code longXball CLng hv Xball CoordXball X BALL CStr longXball Winsock1 SendData CoordXball The protocol of communication when the coordinates are being sent 1s the next the first coordinate is the X axis of the ball when the server program receives it will send Xball to the main computer as t
61. Config SIMATIC Picture 5 5 Fifth picture PROFIBUS network configuration o eo m en co ro G4 Ee 1 1 EJ 44 5 program shows a window with properties 5 Motor PLC connection via PFOFIBUS MPI address in this case 1 the number 2 at HW Config SIMATIC 300 1 Configuration Project filly Station Edit Insert PLC View Options Window Help Dla 8 S ED 25 98 0 UR Si 9 Module gt CPU 314 2 DP 6ES7 314 6CG03 0AB0 Order number Firmware MPI address laddress 0 address Comment OF E 2 0 12 a 24 de d I Ex gt P 23 ii 20 7 Insertion possible 4 3 00 gt SIMATIC Manager Project Documenti Microsoft Hw Config SIMATIC in which is necessary to indicate the ale x 18 x Find Profile ES E E E EE EC EC ER EE PROFINET 10 SIMATIC 300 Bg m 300 Eg CPU 300 CPU 312C CPU 313 28 CPU 314 g CPU 314C 2 DP mg CPU 317F 2 gt OR AR ma mm o om im m GES 314 6CG03 0480 integrated 4 pulse outputs 2 5kHz 4 gt
62. ER amp H80000001 Public Const HKEY LOCAL MACHINE amp H80000002 Public Const HKEY USERS amp H80000003 Public Const ERROR NONE 0 Public Const ERROR BADDB 1 Public Const ERROR BADKEY 2 Public Const ERROR CANTOPEN 3 Public Const ERROR CANTREAD 4 Public Const ERROR CANTWRITE 5 Public Const ERROR OUTOFMEMORY 6 Public Const ERROR ARENA TRASHED 7 Public Const ERROR ACCESS DENIED 8 Public Const ERROR INVALID PARAMETERS 87 Public Const ERROR NO MORE ITEMS 259 Public Const KEY QUERY VALUE amp H1 Public Const KEY SET VALUE amp H2 Public Const KEY ALL ACCESS amp H3F Public Const REG OPTION NON VOLATILE 0 Public vValue As Variant Declare Function RegCloseKey Lib advapi32 dll ByVal hKey As Long As Long Declare Function RegCreateKeyEx Lib advapi32 dll Alias RegCreateKeyExA ByVal hKey As Long ByVal IpSubKey As String ByVal Reserved As Long ByVal IpClass As String ByVal dwOptions As Long ByVal samDesired As Long ByVal lpSecurityAttributes As Long phkResult As Long lodwDisposition As Long As Long Declare Function RegOpenKeyEx Lib advapi32 dll Alias RegOpenKeyExA ByVal hKey As Long ByVal loSubKey As String ByVal ulOptions As Long ByVal samDesired As Long phkResult As Long As Long Declare Function RegQueryValueExString Lib advapi32 dll Alias RegQueryValueExA ByVal hKey As Long ByVal lpValueName As String ByVal loReserved As Long As Long ByVal IpDa
63. End End Sub Private Sub TcpClient_ConnectionRequest ByVal requestID As Long Accept connection kkkkkkkkkkkkkkkkkkkkkkkkkk TcpClient Close TcpClient Accept requestlD End Sub 121 Private Sub TcpClient_SendComplete Clear sended message kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk txtSendData Text End Sub Private Sub Timer1_Timer Do connection test and show message in taskbar kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk connectiontest End Sub Private Sub tcpClient DataArrival ByVal bytesTotal As Long Declare Variables Dim n As Integer Check for arriving data kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk TcpClient GetData Strdata txtOutput Text Strdata Only empty data when variable has been read kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkxk Strdata Empty End Sub Private Sub connectiontest a connection test and fire message ck ck ke ccce koc kk ke ke kk e e ck e e e ke e e e e e ce e e e e ke e ke e e ke e kA A X Select Case TcpClient State Case sckClosed txtconnectstat Text Socket closed ConStateServer Visible True ConStateServer FillColor 2 vbRed Case sckListening txtconnectstat Text Listening ConStateServer Visible True ConStateServer FillColor 2 vbYellow Case sckConnectionPending txtconnectstat Text Connection pending ConStateServer Visible 2 True ConStateServer FillColor vbRed Case sckResolvingHost txtco
64. INT write register B 16 6 BYTE written 17 7 BOOL write 97 7 BOOL IN IN IN OUT ls LEES spe Input value 440 INT IN write register B 16 D BYTE IN written 17 7 BOOL IN JF write 97 7 BOOL OUT 3t 11 Ly Input_value 0 INT IN write register B 16 5 BYTE IN written I17 7 BOOL To write 097 7 BOOL OUT i Press F1 for help lffine 00 4 a eu gt SIMATIC Manager T fRELAD STLFED 081 Microsoft 31 s7 Graph FB2 DB 1217 Picture 6 8 Graph of the data values 56 6 Step 7 program for the conveyor RJ SIMATIC Manager TestMotor C Program Files Siemens Step s7proj TestMoto File Edit Insert PLC View Options Window Help 181 x 08 gae lt s 5 217 8 TestMotor SIMATIC 300 1 1m im z i cM CPU 3140 2 DP BT FB2 FC2 FC72 DB2 Motor SFCB4 E E 57 Program 1 B Sources gg Blocks Press F1 to get Help 1 raja eu 2 4 SIMATIC Manager Documenti Microsoft W mu Picture 6 9 Main program aspect 57 7 Camera location lighting and calibration CHAPTER 7 Camera location lighting and calibration 7 1 Camera Properties and location The camera which is chosen is a camera of the IDS company Imaging Development Systems specifically
65. K OK OK OK KOK OK OK OK OK KOK OK OK KOK OK OK OK OK KOK KOK If Winsock1 State 0 Then Winsock1 Connect Else Winsock1 Close End If End Sub Private Sub cmdStart_Click bit_start Write 1 bit_stop Write 0 initial data Write 0 End Sub 127 A3 Visual Basic final programs A3 Visual Basic final programs Private Sub cmdStop Click bit stop Write 1 bit start Write O End Sub Private Sub Exit Click bit stop Write 1 bit start Write O velocity Write O End End Sub Private Sub Form Load window declaration UE 3K OOK OOK OK OK GE OK OK OK OK OK OK GE OK OK CE OK KK Set Window1 HWindowxXCtrl1 HalconWindow hv ExpDefaultWinHandle Window1 HalconID opc connection O38 K K K K K K K CK CE CE K CE KKK Set ConnectOPCServer New OPCServer ConnectOPCServer Connect OPC SimaticNet Set ConnectOPCGroups ConnectOPCServer OPCGroups Set ConnectOPCGroup ConnectOPCGroups Add connectie ConnectOPCGroup UpdateRate 250 Set ConnectOPCltems ConnectOPCGroup OPCltems ConnectOPCltems DefaultlsActive True Set bit start ConnectOPCItems Addltem S7 S7 connection 1 MX125 0 1 Set bit stop ConnectOPCItems Addltem S7 S7 connection 1 MX125 1 1 Set velocity ConnectOPCltems Addltem S7 S7 connection 1 MW30 1 Set initial data ConnectOPCltems Addltem S7 S7 connection 1 MX125 2 1 Set suction ConnectOPCItems Addltem S7 S7 connection 1 QX125 0 1 Set vacuum ConnectOPCIt
66. ListaTamano Enabled ListaTamano Enabled End Sub 114 Private Sub ListaTamanol Click ListaTamano8 Checked False ListaTamanol2 Checked True ListaTamanol1s Checked False ListaNombres FontSize 12 End Sub Private Sub ListaTamanoi s Click ListaTamano Checked False ListaTamanol Checked False ListaTamanol8 Checked True ListaNombres FontSize 18 End Sub Private Sub ListaTamano8 Click ListaTamano8 Checked True ListaTamanol Checked False ListaTamanol Checked False ListaNombres FontSize 8 End Sub Private Sub txtNombre Change If Len txtNombre Text lt gt 0 Then Nombre Enabled True Else Nombre Enabled False End If End Sub 115 1 Visual Basic learning programs Ninth program 2 3 IB B 8 Ordenar Peet ee eee ee eee eee eee Const Elementos 8 Dim Contador As Integer Dim Tabla 1 To Elementos As Integer Option Explicit Private Sub Form Load Randomize Crear Llamamos a la rutina Private Sub Crear End 5ub Private Sub Nueva Click Lista Clear For Contador 1 To Elementos Tabla Contador Int 9 End 1 Lista AddItem Tabla Contador Next Contador End Sub Private Sub Ordenar 11 Dim I As Integer Dim J As Integer Dim Cambio As Integer I 1 Do For J 1 To Elementos I Tabla J gt Tabla J 1
67. OPC server via PROFIBUS connection 9 2 1 Create an OPC connection 8 2 2 Check OPC connection 8 3 New Step7 program for the conveyor with OPC 9 Communication and Visual Basic programs 9 1 Summary 9 2 Program that controls the belt over PROFIBUS 9 3 Robot PC Ethernet communication and Visual Basic programs 9 3 1 General aspects 9 3 2 First version of the server program in the robot 9 3 3 Program in the main PC 10 Robot setting suction system and calibration 10 1 Robot suction system 10 1 1 Compressor Panther Werther International 10 1 2 Solenoid valve 2 5 4573 10 1 3 PE converter PEN M5 8625 10 1 4 Vacuum generator 5 19293 10 1 5 Suction cup tool 10 2 Robot calibration 10 2 1 Tool calibration 10 2 2 Base calibration 11 Flowchart and final programs 11 1 Flowchart 11 2 Final programs 11 2 1 General aspects in the communication 11 2 2 Main program 11 2 3 Client server program in the robot 11 2 4 Robot program 11 3 Picture of the final process 12 Conclusions improvements and future applications 12 1 Conclusions siie Index Index 12 2 Improvements and future applications 104 13 Bibliography 106 APPENDIX Al Visual Basic learning programs 108 A2 Visual Basic communication programs 117 A2 1 Code of program to control the belt 117 A2 2 Code of server program in the robot 120 A2 3 Code of Ethernet communication in the main PC 124 Visual Basic
68. Picture 11 3 Main program 11 2 3 Client sever program in the robot This program 15 used to get and send data between computers and to send and receive data from the robot The way that the coordinates arrive is the same as in the main program but here these data are sent at the same time to the robot It can be done by the command CrossCommands SetVar Next to this there is a small piece of code If n 2 1 Then Select Case Strdata2 0 Case X BALL bool1 CrossCommands SetVar X BALL Strdata2 1 TcpClient SendData Xball To display in the program some variables from the robot the command to use 1s CrossCommands ShowVar like in the next piece of code Label1 Caption CrossCommands ShowVar X BALL str Xball Labelt Caption str Xball 97 11 Flowchart and final programs Ethernet connection in this program 15 the same as in the main program which means the code to include in the form load 1 just the same as in the previous paragraph To connect the program with the robot there is a piece of code specific for that as follows Public Sub ConnectRob Create object for the robot oet CrossCommands CreateObject CrossCommEXE CrossCommana CrossCommands Init Me CrossCommands ConnectToCross vValue Connected True StrBofVer GetBOFVer End Sub These commands used to connect the server program with the robot are declared in another file added in the Visual Basic project which is called Modul
69. RegionFillUp1 hv 1 hv Row1 hv Column1 Call Op DispCross hv ExpDefaultWinHandle 350 540 6 0 Call Op DispCross hv ExpDefaultWinHandle Row1 Column1 6 0 If hv Column1 gt 300 Then hsbBoxPos Enabled False prevent robot blockade End If If Tuple TupleGreaterEqual hv Column1 box position Then bit stop Write 1 bit start Write O txtAgain Text disable some options cmdStart Enabled False cmdStop Enabled False Stopbelt Enabled False 131 Startbelt Enabled False txtBoxInPos Text Box in correct position Sleep 50 findbox True Else txtBoxInPos Text End If Else txtBoxOut Text Box out of transport belt End If End Function Public Function findbox1 As Boolean take the coordinates after belt stopped O36 SE SE GE SE GE SE GE GE GE GE SK K OK OK CE OK OK CE PE CE GE GE CE CE GE CE CE GE GE CE GE GE K K Call Op Decompose3 ho Image ho red ho green ho blue Call Op Rgb3ToGray ho red ho green ho blue ho ImageGray Call Op DispCross hv ExpDefaultWinHandle 350 540 6 0 Call Op ReduceDomain ho red ho Rectangle2 ho ImageReduced Call Op Threshold ho ImageReduced ho Region1 40 255 Call Op Connection ho Regioni ho ConnectedRegions1 A3 Visual Basic final programs Call Op SelectShape ho ConnectedRegions1 ho SelectedRegions2 area and 8000 12000 Call Op FillUp ho SelectedRegions2 ho RegionFillUp1 Call Op CountObj ho RegionFillUp1
70. Sub 108 1 Visual Basic learning programs Second program Colours Blue Red C Yellow C Green Position Private Sub Optionl Click Sub Option Explicit Private Sub Form Load txtBox Top 0 End Sub Private Sub optBottom Click txtBox Top frmColours S5ScaleHeight txtBox Height End Sub Private Sub optYellow Click txtBox BackColor ybYellow End Sub Private Sub optTop Click txtBox Top 0 End Sub Private Sub optBlue Click txtBox BackColor vbBlue End Sub Private Sub optRed Click txtBox BackColor vbRed End Sub Private Sub optGreen Click txtBox BackColor vbGreen End 5ub 109 1 Visual Basic learning programs Third program Const Yes 6 Const No 7 Option Explicit Private Sub cmdInsert Click Dim Answer As Integer Answer MsqBox Are you sure adding text to the 11802 291 Question If Answer Yes Then List AddiItem txtText Text End If Answer Then MsgBox The text isn t added to the list 0 Message End Sub Fourth program 110 1 Visual Basic learning programs Option Explicit Private Sub NumTiradas 11 As Integer EKeyAscii lt 48 Or KeyAscii gt 57 Then If KeyAscii lt gt 8 Then KeyAscii 0 End End 5ub Private Sub Tirada Click Dim Contador s Integer Dado Clear For Contado
71. Then Cambio Tabla J Tabla J Tabla J 1 Tabla J 1 Cambio End If Next J I I 1 Loop Until I gt Elementos 1 Lista Clear For Contador 1 To Elementos Lista AddItem Tabla Contador Next Contador End Sub Private Sub Crear For Contador 1 To Elementos Tabla Contador Int 9 Rnd 1 Lista AddItem Tabla Contador Next Contador End Sub 116 Al Visual Basic learning programs A2 Visual Basic communication programs APPENDIX 2 Visual Basic communication programs A2 1 Code of program to control the belt opc variables Public ConnectOPCServer As OPCServer Public ConnectOPCGroup As OPCGroup Public ConnectOPCGroups As OPCGroups Public ConnectOPCltems As OPCltems Public bit start As OPCltem Public bit_stop As OPCltem Public velocity As OPCltem Public initial data As OPCltem same for all programs Dim Op As New HOperatorSetX Dim Tuple As New HTuplex Dim hv_ExpDefaultWinHandle As Variant Dim Window1 As HWindowX Dim WindowHandle1 As Variant more variables for bigger programs Dim hv_AcqHandle As Variant Dim ho_Image As HUntypedObjectX ho_ Region As HUntypedObjectX Private Sub Command1 Click bit start Write 1 bit stop Write 0 initial data Write O End Sub 117 A2 Visual Basic communication programs Private Sub Command3 Click bit_stop Write 1 bit_start Write 0 End Sub Private Sub Exit_Click bit_stop Write 1 End End Sub Private S
72. U 314 IFM gt un Eg CPU 314 2 DP ff 57 314 6 00 0 A fone o 57 314 6CF01 04B0 57 314 6CF02 0AB0 LEGS 57 314 6CG03 0480 gt vao 22 2 22 4 00016 H E CPU 314 2 PIP a CPU 315 eal cov poa ir zum z User Defined H E CPU 315 2 DP A PM I Cancel Help CPU 316 9 28 CPU 3172 CPU 317 2 PN DP EM CPU 317F 2 nip epe em B CUM nn 2 iugum 57 314 5 603 0 0 a ork memory SBKB 0 1ms 1000 instructions DI24 D016 2 integrated 4 pulse outputs 2 5 4 gt Press F1 to get Help cha of SIMATIC Manager Project M Documenti Microsoft W Config SIMATIC qo S S 205 Picture 5 11 Eleventh picture in PROFIBUS network configuration 12 The network is already configured like in the picture below Find on the right side the motor file MACOO FP and select it iS HW Config SIMATIC 300 1 Configuration Project Station Edit Insert PLC View Options Window Help lel x 28 8 amp e di ED co 92 0 UR Profile Standard PROFIBUS DP H E Additional Field Devices EM General 429 wAGO O SYSTEM 8 KUKA CP5614 Slave MACOD FP 5 1 DP master system 1
73. Xbox X BOX CStr longXbox checking ethernet connection If Winsock1 State 7 Then If strData Yball Then Winsock1 SendData CoordXbox txtXbox Text Format hv Xbox 1000 000 000 XboxSent True End If Else Nothing End If End Function 136 A3 Visual Basic final programs Public Function YboxSent As Boolean sending Y coordinate of the box CE SE SE SE SE SE OK GE GE GE CE OK CE OK OK K K CE GE GE CE GE GE CE CE GE GE KKK Dim CoordYbox As String Dim longYbox As Long longYbox CLng hv Ybox CoordYbox Y CStr longYbox checking ethernet connection CE SE SE K SE GE SE GE GE OK GE KOK OK CK CE OK OK CE CE CE GE CE SE CE GE If Winsock1 State 7 Then If strData Xbox Then Winsock1 SendData CoordYbox txtYbox Text Format hv Ybox 1000 000 000 txtDone Text Ybox YboxSent True End Else Nothing End End Function Public Function ball pos As Boolean ROBOT COORD allows starting the robot when is in 1 CK KK OK OK GE K PE K OK K SK K K K K K K K K CE CE K K K K K K K K K K K K K K K K K K K K K K K Dim robot_coord As String Call Op GrablmageAsync ho_ Image hv_AcqHandle 1 robot coord ROBOT COORD 1 Winsock1 SendData robot coord ball pos True End Function Public Function ball aspirated As Boolean start aspirating when robot is in position KK CK K K GE CE CE CE CK K CE CK CK CE CE CE CK CE CE CE CE CE
74. YballSent True Then Step coord Xbox Case coord Xbox If XboxSent True Then Step coord Ybox Case coord Ybox If YboxSent True Then Step reach ball Case reach ball If ball pos True Then Step aspirate Case aspirate If ball aspirated True Then Step reach box Case reach box If ball in box True Then Step ball inside box Case ball inside box If check ball in box True Then Step process ended 140 Case process ended If process again True Then Step check box End Select Timer4 Enabled True End Sub Private Sub vsbVelocity Change change the velocity of the trasnport belt CE SE SE K GE SE SE GE GE GE CE OK K K OK CE CE CE CE PE CE GE CE SE PE GE CE CE GE GE CE GE GE KK velocity Write vsbVelocity Value End Sub Private Sub Winsock1 DataArrival ByVal bytesTotal As Long Dim Strdata2 As String Dim n As Integer data from the robot CE SE SE PE SE GE SE GE GE GE GE OK OK OK OK CE OK OK CE CE Winsock1 GetData strData Strdata2 Split strData n UBound Strdata2 If n 0 Then txtDone Text strData End If during the robot movement LXK K K K K K K K K K K K K K K K K K K K K K k If n 1 Then Select Case Strdata2 0 Case ROBOT_BALL_POS robot_ball_pos Strdata2 1 Case ROBOT BOX POS robot box pos Strdata2 1 Case PROCESS DONE robot process done Strdata2 1 Cas
75. al and 15 connected to the PLC to be commanded by OPC and to be supplied The address in the PLC for this device is the output Q125 0 and as can be seen in the picture the normal position is closed 12 1 Picture 10 2 Valve 10 1 3 PE converter PEN M5 8625 This device is connected after the valve and it detects when there 1s vacuum or not The device uses 3 cables all of them connected to the PLC when vacuum 1 created the device sends an electrical signal to the PLC to the input address I124 7 the others two are the power and the ground Picture 10 3 Vacuum sensor 85 10 Robot settings suction system and calibration 10 1 4 Vacuum generator VAD M5 19293 As was mentioned in one of the previous sections the vacuum generator creates the suction necessary for the application by the Venturi Effect It is the drop in fluid pressure that results when an incompressible fluid flows through a constricted section of pipe The fluid velocity must increase through the constriction while the pressure decreases due to conservation of energy The gain in kinetic energy is supplied by a drop in pressure or a pressure gradient force In the picture below the component and the schematic drawing are presented the pneumatic connection 1 1 joined with the vacuum sensor and connection 2 is joined with the tool creating the needed vacuum for the suction Picture 10 4 Vacuum generator 10 1 5 Suction cup tool Th
76. al line Red 5VDC 5VDC output to be used for external termination optional A Negative profibus signal line Green B Re Sem JVL Industri Elektronik A S User Manual Integrated Servo Motors MACO50 800 113 4 5 4 5 10 114 Expansion Module MACOO FP2 FP4 MACOO FP2 option with cables optional MACOO FP2 type number only covers the basic module i e without any cables If a number is added after the basic type number for example MACOO B2 10 this suffix indicates that the module is fitted with 10 m of cable in the I O The I O cable covers all the signal lines i e 5232 Digital input 1 4 Limit inputs NL and PL and the Digital out puts 4 Please note the WG0420 table below is not valid for cables delivered before 1 10 2002 See WG0420 old versions delivered before 1 10 2002 page 176 Digital Inputs Internal connector J2 Signal name IN 1 Digital input 1 IN2 Digital input 2 A ed black reen black iolet Digital input 4 iolet white Negative limit input If not used do not connect IN3 Digital input 3 N Positive limit input If not used do not connect rey black U inkIblack lack white Light green hite Digital Outputs Internal connector J4 Signal name 1 EM for outputs Must be connected to an ext Red white Digital output 1 PNP output Max 25mA Green white Digital output 2 PNP output Max 25mA Yellow black Res
77. am AcqHandle frame rate 27 542 set framegrabber param AcqHandle contrast 256 set framegrabber param AcqHandle exposure 10 3157 set framegrabber param AcqHandle gain master 35 grab image start AcqHandle 1 dev update window while 1 88 10 Robot settings suction system and calibration dev set color red gen region line RegionLines 432 300 432 800 dev display RegionLines grab image async Image AcqHandle 1 set origin pose 0 0 0 PoseNewOrigin1 dev display Image disp cross WindowHandle 432 540 6 0 endwhile In the next picture are displayed the real axis and the central point used in the base calibration HDevelop Measures dev Graphics Window E iaj xl ne File Edit Execute Visualization Procedures Operators Suggestions Window Help la x csal 5 81 2 lt m us tn Clear Active AcqHandle contains one integer 277049988 Line 20 start AA Miguel Measures M Documenti Microsoft W 61888 0 o Picture 10 7 Axis in the camera for the base calibration 89 11 Flowchart and final programs CHAPTER 11 Flowchart and final programs 11 1 Flowchart This chapter describes the final process exactly like it has been programmed as well as the code used to make it The first part is a flowchart of the process It describes
78. an uEye UI 146xLE model SXGA 2048x1536 The uEye LE 146x models are equipped with a light sensitive 1 2 Sensor with rolling shutter which acquires 11 frames per second fullframe mode Characteristics max 11 fps 220 fps in AOI mode with 320x240 pixels 1 2 CMOS sensor rolling shutter progressive scan Exposure 57 us 1 75 s freerun mode Binning horizontal and vertical Subsampling horizontal and vertical AOI horizontal and vertical Picture 7 1 Camera uEye This camera is perfect for the process because it reduces size and it has a high resolution as well as a progressive scan grabbing images Taking into account the maximum reach of the robot as well as the tool length and the camera lens length The support of the camera was made in order to not to damage it The camera is situated on the top of the workspace just in the middle of the table and at an altitude of 1160 mm The camera is joined with the support by a screw with two nuts one to fix in the support and another to fix the camera and not let movements in the camera 29 7 Camera location lighting and calibration 7 2 Choosing the correct lens The lens is as important as the illumination of the process It defines the vision field of the camera which will be the robot eye To calculate the correct lens a program in Visual Basic is used which includes the equation with the relations between the focus and the dimensions on the surface of work The
79. and many other mechanical components The image processing system 15 easy to use HALCON takes cares of all the important aspects e The software development is supported by the interactive tool HDevelop which enables a quick development of image processing tasks combined with an easy integration into standard development environments like Microsoft Visual C via the automatic code export e The problem oriented documentation covers all levels from a quick access to important information up to a detailed discussion of advanced topics e These descriptions are combined with hundreds of examples for an intuitive understanding of the solutions which can serve as templates to shorten the development time e ast but not least HALCON provides open interfaces for efficient data exchange to integrate own operators or to access specialized hardware round off the system 1 2 Develop applications with HALCON HALCON offers many ways for the application development But to make full use of the architecture the mode depicted in figure 1 1 1s recommended 1 to HALCON programming Q 3 3 HDevelop Visual Studio Application gt lt SS ma ae o EE d j lines em ELI o a i _ dmm M s 9 Prototyping User Interface HALCON Library Method Development Further Tools Picture 1 1 Three step approach for the app
80. and the C interfaces In contrast the COM interface 1s independent of a given language It can be used e g with Visual Basic C or Delphi Independent of which programming language you choose a suitable interface library HALCONc HALCONcpp HALCONx together with the HALCON library HALCON must be linked to the application In addition to this for C and C the corresponding include files must be included For each language interface the names of types classes the naming conventions of operators etc may differ to be compliant with the typical rules that apply for the selected language 1 5 Examples and applications In order to explain the knowledge about the HALCON programming during the first three weeks subsequently there are series of shorts programs as a prelude to the final program used in the robot implementation First of these it 1 necessary to acquire images through the camera by the following program Image Acquisition dev close window close all framegrabbers dev open window 0 0 640 480 black WindowHandle open framegrabber DirectShow 1 1 0 0 0 0 default 8 rgb 1 false default default 0 1 AcaHandle grab image start AcqHandle 1 while true count seconds T1 grab image async Image AcqHandle 1 Do something count seconds T2 Result 1 T2 T1 endwhile close_framegrabber AcqHandle siis 1
81. ands CreateObject CrossCommEXE CrossCommand CrossCommands Init Me CrossCommands ConnectToCross vValue Connected True StrBofVer GetBOFVer End Sub 147 A3 Visual Basic final programs A3 Visual Basic final programs Private Sub Timer2 Timer making the steps while the robot is running CE E SE PE E GE OK GE GE OK OK OK CE K OK PE CE CE GE CE CE GE CE CE CE GE CE CE GE CE GE CK GE GE KK KKK If boolBall True Then Dim str RobotBallPos As String Dim dataRobot1 As String Dim sendBallPos As String IblBallPos Caption CrossCommands ShowVar ROBOT BALL POS str RobotBallPos dataRobot1 Split str RobotBallPos IblBallPos Caption dataRobot1 0 dataRobot1 2 sendBallPos ROBOT BALL POS 1 If dataRobot1 2 1 Then TcpClient SendData sendBallPos boolError True boolBall False End End If If boolError True Then Dim str_Error As String Dim dataRobot2 As String Dim sendError As String lbIDone Caption CrossCommands ShowVar ERROR_CODE str Error dataRobot2 Split str Error IblDone Caption dataRobot2 0 dataRobot2 2 sendError ERROR CODE 1 If dataRobot2 2 1 Then TcpClient SendData sendError IblCoord Caption IblBallPos Caption IblBoxPos Caption IblVacuum Caption boolError False End If If IblVacuum Caption VACUUM 1 Then boolBox True boolError False End If End If 148 A3 Visual Basic
82. bject Properties Alt Return 22221 ERO 57 314 5 003 0 0 POP d v2o 0 UR Product Support InFormation Ctrl F2 B mJ 4C 2 FAQs 8 89 CPU 315 5 Module cre MPI a 1 Comment Mi CPU SISZDP 1 53072 g CPU 315 2 PN DP 2 314520 fe 6 57 314 6503 0 0 a CPU 315F 2 DP ado 2 2 IE OF EE psi 9 CPU 315F 2 PN DP 2214 nocens E B CPU 316 23 0 213 aaa _ B CPU 3182DP 24 3 1 31 31 EMEN CPU 3172 M eee eee _ m GES 314 6CG03 0480 ork memory SBKB 0 1ms 1000 instructions 0124 0016 415 402 integrated 4 pulse outputs 2 5 4 x AE GG A RI Displays properties of the selected object for editing A A A gt Gaconfigurati 2 Scout sare m 8 fiw confi Picture 8 9 Ninth step Config SIMATIC 300 1 Configuration Miquelopc 181 x aly Station Edit Insert PLC View Options Window Help S gt e 85 05 3 0 UR PS 307 24 n CPU 314C 2 DP DP Profle Standard rl Properties DP 80 52 1 EN PROFIBUS DP E PROFIBUS PA General Addresses Operating Made Configuration PROFINET 10 ees Ts af i smenc a 28 General Paramet
83. connect the motor slave and the PLC master by the program of Siemens Simatic Step 7 Each step 1s detailed below laix File PLC View Options Window Dle 839 Yo New Project User projects Libraries Multiprojects amp burkert C Program Files Siemens Step s7 burkert C Program Files Siemens Step7 7 Bey Cel3davidsteven C Program Files Siemens Step 4S7 B Configuratie CP314C 2DP C Program Files Siemens Step s Configuratie CP5613 C Program Files Siemens Step s CP5613 slave C Program Files Siemens Step s slawa Filas Sine Sin alil gt Addite current multiproject Name Type Project F Libra Storage location Files Siemens Step s proj Browse Press F1 to get Help ta gt Manager Mt SMSF 20 52 Picture 5 1 First picture in PROFIBUS network configuration 42 5 Motor PLC connection via PFOFIBUS 1 Open the program Simatic Step 7 and create a new project The following window will appear Picture 5 2 File Edit Insert PLC View Options Window Help 1 Press F1 to get Help t 8 gt Manager Pr A Picture 5 2 Second picture in PROFIBUS network 2 Insert a new object in this case the PLC 15 fr
84. d a dark conveyor are used So it is easier to recognize the white box on the conveyor Picture 7 7 The edges of the conveyor have a soft gray color and it s a problem to recognize just the box To solve this problem these edges are covered with black isolate tape 64 7 Camera location lighting and calibration After that HALCON program can confuse itself when it is detecting the ball and this is quite near to the conveyor The best way to answer the problem is leaving a small strip without isolate tape in the side of the table with this strip there isn t problems with none object For the last application will be necessary to get the coordinates of the central point of the ball and the box As each one has its own surface to be placed two regions are going to be defined The box region is defined like a rectangle which contains the conveyor and the ball region like an ellipse which contains the area of the maximum reach of the robot in correct position to pick up objects Additionally the program needs to be able to store the point where the user wants to stop the conveyor So there are three steps first to know if ball and box are inside the area permitted second to know when box is in position defined by the user and third to get the real coordinates X axis and Y axis The HALCON program for all of these steps is Final HALCON program regions positions and coordinates dev open window 0 0 512 512 black Win
85. d development To use HDevelop you need to know just a few things To load an example select the menu File Open This will open a file section dialog that shows the main directories of the 9 1 to HALCON programming HDevelop examples underWindows For beginners it is recommended to select an example from the directory Applications As an alternative the menu File gt Open Example Program can be used Here a dialog that allows you to select examples based on different categories instead of the actual location is opened After loading the file the corresponding program code is displayed in the program window The used variables so far not instantiated can be seen in the variable watch window The program is now ready for execution Steps to run a program 1 Press the Run button to execute the program To continue at a stop statement press Run again 2 Besides the Run button HDevelop provides a Step button which executes only a single line and displays the results immediately afterwards If the program contains procedures it might be of interest to use the buttons Step Into and Step Out 3 To rerun the complete program the Reset button can be used To rerun parts only simply click with the mouse to the left of the desired program line This will reposition the program counter When executing the program anew it will then start at the newly selected position Useful hints for HDevelop 1 At
86. d from register register y O O Read Data For 16 bit registers the read value will be placed in Read data 0 and Read data For 32 bit registers the read value will be placed in Read data 0 3 M otor status Bit 6 Decelerating this bit is when the motor is decelerating Bit 5 Accelerating this bit is when the motor is accelerating Bit 4 In position this bit is when the motor has reached its commanded position Bit O Error this bit is when a motor error has occurred Input status Bit 5 PL Positive limit input Bit 4 NL Negative limit input Bit 3 0 INx user inputs Last direct register See Direct register page 106 for details JVL Industri Elektronik A S User Manual Integrated Servo Motors MACO50 800 4 5 Expansion Module MACOO FP2 FP4 Command status Bit7 Write Toggle this bit indicates when writing is completed See Command page 107 for details Bit6 Read Toggle this bit indicates when reading is completed See Command page 107 for details Bit 3 0 Status These bits indicate the status of the MACOO FP2 FP4 The following sta tus codes are possible Connecting to MAC motor 4 5 5 Input modes The 4 user inputs can be used to execute different move commands The following input modes can be selected Mode Description 0 Pase 0 Absolute Relati
87. dowHandle read cam par campar01 dat 1 read pose camposeO01 dat Pose1 set origin pose Posel 0 0 0 PoseNewOrigin1 close all framegrabbers open framegrabber uEye 2 2 0 0 0 0 default 8 rgb 1 false Ul146xLE C 1 0 1 AcqHandle set framegrabber param AcqHandle frame rate 27 542 set framegrabber param AcqHandle contrast 256 set framegrabber param AcqHandle exposure 10 3157 set framegrabber param AcqHandle gain master 35 grab image start AcqHandle 1 dev update window while 1 Looking for the ball grab image async Image AcqHandle 1 set origin pose 1 0 077595 0 03263 0 PoseNewOQOrigin1 dev display Image decomposes Image red green blue rgb3 to gray red green blue ImageGray disp cross WindowHandle 350 540 6 0 gen ellipse Ellipse 0 510 0 07 480 410 reduce domain ImageGray Ellipse ImageReduced1 threshold ImageReduced1 Region 0 15 connection Region ConnectedRegions select shape ConnectedRegions SelectedRegions area 1200 5000 select shape SelectedRegions SelectedRegions1 roundness and 0 5 1 653 5 7 Camera location lighting and calibration fill up SelectedRegions1 RegionFillUp Ball RegionFillUp if Ball 21 area center RegionFillUp Area Row Column image points to world plane CamParam1 PoseNewOrigin1 350 540
88. e The code of this program can be seen also in Appendix 3 section A3 3 When the robot is running it is necessary to create a kind of protocol in the communication in order to have a good synchronization between the three programs The problem is that in this server it is impossible to make a main program with steps because it is an application that 1s receiving and sending data and it can t implement any process defined to follow For this reason there 15 a part which checks the variables when the robot 1s running to know the state of the robot at each moment Here 15 the code where the steps are defined with Boolean variables When one step has finished it allows the execution of the next It can be seen as follows Private Sub Timer2 If boolBall 2 True Then Dim str RobotBallPos As String Dim dataRobot1 As String Dim sendBallPos As String IbIBallPos Caption CrossCommands ShowVar ROBOT_ BALL str RobotBallPos dataRobot1 Split str RobotBallPos IbIBallPos Caption dataRobot1 0 dataRobot1 2 sendBallPos ROBOT BALL 1 _ 98 11 Flowchart and final programs If dataRobot1 2 1 Then TcpClient SendData sendBallPos boolError True boolBall False End If End If The picture below displays the window of this program On the top there are two circular lights that show the state of the connection with the main computer and the robot On the bottom are all the
89. e ERROR CODE error robot Strdata2 1 txtBoxInPos Text 141 A3 Visual Basic final programs A3 Visual Basic final programs txtXball Text txtYball Text txtXbox Text txtYbox Text txtDone Text Case Else MsgBox Error sending data End Select End If End Sub A3 2 Code of server program in the robot Option Explicit Dim boolBall As Boolean Dim boolError As Boolean Dim boolBox As Boolean Dim boolDone As Boolean Private Sub CmdConRob Click ConnectRob End Sub Private Sub Form Load Setup Form CE E SE PE SE GE GE GE GE GE GE KE OK TxtGate Enabled False TxtPoort Enabled False txtconnectstat Enabled False TxtPoort Text 10101 TxtGate Text TcpClient LocallP ConStateRobot Visible False ConStateServer Visible False Read out robot name and set as form title OK OK OK OK OK OK OK OK OK OK OK CE OK GE OK OK KOK CE OK GE CE OK CE GE CE CE GE KK KKK QueryValue HKEY LOCAL MACHINE System CurrentControlSet Control ComputerName ComputerName ComputerName frmClient Caption Client Settings for robot amp amp vValue End Sub 149 A3 Visual Basic final programs Private Sub cmdConnect_Click Declare Variables Dim Answer As String TxtGate Enabled False TxtPoort Enabled False Answer MsgBox Are these settings correct voQuestion vbYesNo Connect If Answer vbYes Then Copy Port number data If Tc
90. e positions and calculates the TCP of the new tool 2 Definition of the orientation of the Tool coordinate system The following methods are available 25 2 KUKA robot Overwiew programming over Defining the orientation ABC World method The axes of the TOOL coordinate system are aligned parallel to the axes of the WORLD coordinate system This communicates the orientation of the TOOL coordinate system to the robot controller Defining the orientation ABC 2 Point method The axes of the TOOL coordinate system are communicated to the robot controller by moving to a point on the X axis and a point in the XY plane This method is used if it is necessary to define the axis directions with particular precision The tool data can be entered manually Possible sources of data CAD Externally calibrated tool Tool manufacturer specifications 2 2 6 Structure of a KRL program KUKA Robot Language The picture below shows the structure of a KUKA Robot Language program 1 DEF my program t IHI 4 HOME Wel 100 DEFA E LIH point 5 CONT Vel 2 m s CF 14 point 1 CONT Val 20 HOHE Wel 100 DEFAUL 21 22 END Picture 2 9 KRL program 1 Def line The Def line indicates the name of the program If the program is a function the Def line begins with Deffct and contains additional information 2 Ini line The Ini line contains initializations for internal variables and
91. e Z axis is given manually because it is the same for the whole process The movement is commanded with lin al 100 11 Flowchart and final programs ROBOT_BALL_POS 15 set on 1 before the movement because in this way the suction system is faster and the process doesn t have to wait When the robot is in the ball position there is a wait time because the main program has to send if the vacuum sensor 1s ON or not If the robot doesn t receive this data after this half a second the robot sends ERROR_CODE 1 and goes to the initial position So when the main program detects this code it takes again the coordinates and sends again If the sensor 15 set in ON the main program sends VACUUM and the robot goes to reach the box coordinates When it is on the top of the box the data ROBOT_BOX_POS 1 is sent and the main program disconnects the suction system For this the robot waits for 2 seconds to be sure that the ball has been released inside the box After this the robot goes to its initial position out of the vision range and sends PROCESS_DONE 1 With this the main program knows that the robot has finished and then the camera process start again checking if the ball is really in the box The robot program is executed in Automatic Mode To execute this mode it needs to push the start button to run and even the first motion until the point P6 has to be executed manually by the user each time when the program has been stopp
92. e end limit is activated the velocity will be set to 0 and the motor will decelerate and stop If the motor should run again the user must manually set a new velocity Passive mode When the end limit is activated the actual mode will be changed to passive In passive mode the motor is short circuited and can be ro tated In firmware version 1 4 or higher the end limit action is also active if the Profibus is going off line but it needs to be online before it goes off line before the feature is enabled Input debounce Using this parameter an input filter can be activated Possible values Disabled No filtering will be done on the inputs Enabled The inputs are filtered resulting in better noise immunity but slower response When the filter is enabled there will be a delay at the input of about 5ms Input x action Using these parameters up to 3 actions can be assigned to each input These actions are used when the custom input mode is selected See Input modes on page 109 The action is defined by a command See FlexMac commands on page 111 Possible values are 0 127 where 0 represents no action JVL Industri Elektronik A S User Manual Integrated Servo Motors MACO50 800 4 5 4 5 1 Expansion Module MACOO FP2 FP4 FlexM ac commands Using the FlexMac commands it is possible to activate a set of registers and set the mode of the motor using a single command The command is composed of two par
93. e suction cup is the last component in the suction system and it has the shape showed in the next picture Picture 10 5 Suction cup 86 10 Robot settings suction system and calibration 10 2 Robot calibration 10 2 1 Tool calibration The method used for the tool calibration is TCP calibration XYZ 4 Point method The TCP of the tool to be calibrated 15 moved to a reference point from 4 different directions The reference point can be freely selected The robot controller calculates the TCP from the different flange positions The tool to be calibrated is mounted on the mounting flange The operating mode has to be T1 or T2 1 Select the menu Setup gt Measure gt Tool gt XYZ 4 Point 2 Assign a number and a name for the tool to be calibrated Confirm with OK 3 Move the TCP to a reference point Confirm with OK 4 Move the TCP to the reference point from a different direction Confirm with OK 5 Repeat step 4 twice 6 Press Save The name of the tool is aspirate tool and it has the number 1 Picture 10 6 Tool calibration 87 10 Robot settings suction system and calibration 10 2 2 Base calibration The method used for the base calibration 15 3 point method The robot moves to the origin and 2 further points of the new base These 3 points define the new base A previously calibrated tool is mounted on the mounting flange Operating mode or T2 1 Select the menu Setup g
94. e switch is locked and the operating mode can no longer be changed 2 Drives On Switches the robot drives on 3 Drives Off Switches the robot drives off 21 10 11 12 19 14 15 16 17 2 KUKA robot Overwiew programming over Emergency Stop button Space Mouse Jogs the robot Right hand status keys The status keys are used primarily for controlling the robot and setting values Enter key The enter key is used to close an active window or inline form Changes are saved Arrow keys The arrow keys are used to jump from element to element in the user interface Keypad Numeric keypad Softkeys The icons change dynamically and always refer to the active window Start backwards key The start backwards key is used to start a program backwards The program is executed step by step Start key The start key is used to start a program Stop key The stop key is used to stop a program that is running Window selection key The window selection key is used to toggle between the main option and message windows The selected window is indicated by a blue background Esc key The esc key is used to abort an action on the user interface Left hand status key The status keys are used for controlling the program execution and the robot movements 18 Menu keys The menu keys are used to open the menus The rear of KCP presents the disposition shown in Picture 2 7 next page
95. ea When the lighting and the lens are correct and connected the next step consists in adjust the data of the camera in the program HALCON modifying some parameters to get the best quality during the recording Adjusting new parameters in uEye camera kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkxk close_all_framegrabbers open framegrabber uEye 2 2 0 0 0 0 default 8 gray 1 false Ul146xLE C 1 O 1 AcqHandle set_framegrabber_param AcqHandle contrast 256 set_framegrabber_param AcqHandle exposure 10 3157 set_framegrabber_param AcqHandle frame_rate 27 542 set_framegrabber_param AcqHandle gain_master 35 grab_image_start AcqHandle 1 while true grab_image_async Image AcqHandle 1 Do something endwhile close_framegrabber AcqHandle The function set_framegrabber_param modify some parameters in this case the parameters changed are contrast exposure frame rate and gain master On the other hand in the function open_framegrabber the camera has been selected to record only half the pixels All this changes allows a faster image acquisition with an optimal image quality Once parameters are adjusted the calibration can start The calibration is done by a tool like a calibration plate called caltab see it in the picture below it s tool designed HALCON Company for calibrating surfaces in real coordinates Therefore a program is made which
96. ead register se lector When this bit is toggled reading is executed The read command is accept ed when Bit 6 in the command status output data byte 7 is equal to this bit Bit 5 Write 32 bit Set this to if writing to a 32 bit register and 0 if writing to a 16 bit register Bit 4 Read 32 bit Set this to if reading from 32 bit register 0 if reading from a 6 bit register Bit 3 Auto write When this bit is the data written in write data 0 3 is transferred to the MAC motor immediately regardless of the write toggle bit Bit 2 Auto read When this bit is the data in read data 0 3 is updated all the time re gardless of the read toggle bit Bit land Bit 0 should be 0 Input setup e S5 4 Function f Reset end limit PL Enable NL Enable Input mode Bit 6 Reset end limit When this bit is the end limit condition is reset if no end limits are activated Bit 5 PL Enable When this bit is the positive end limit is enabled Bit 4 NL Enable When this bit is the negative end limit is enabled Bit 3 0 Input mode these bits select the current input mode See section Input modes page 109 for details JVL Industri Elektronik A S User Manual Integrated Servo Motors MACO50 800 107 4 5 4 5 4 108 Expansion Module MACOO FP2 FP4 Input data Slave gt M aster MACOO FP2 4 contains 8 bytes of input data Read data 3 MSB Data rea
97. ected in the PLC The data that has to be included the first time in the motor to control the velocity acceleration The software of the motor has some registers that can be selected in order to choose one of them depending on the application see Appendix 2 The used registers are Register 2 with value 1 to start the motor Register 5 to select the velocity Register 6 to select the acceleration Register 7 to select the torque Register 13 to select the inertia 6 2 Step 7 program Subsequently is explained the program in Step 7 which is used in the application for moving the conveyor EUR 6 Step 7 program for the conveyor 1 Open the OBI and write the required inputs and outputs WSLAD STL FBD FC2 TestMotor SIMATIC 300 1 CPU 314C 2 DP i File Edit Insert PLC Debug View Options Window Help la x amp amp ole e Sle lt gt 22 Contents Of Environment Interface Interface ame pata New network 4 a 18 value Enter data each register Ea Bit logic input value write register Enter the selected register bI Bb write register written Writting completed NOT 8 written 23 C XR OUT To write i R IN OUT Dex 5 TEMP ET Rs RETURN SR as L4 SAVE ECA Title E ET NEG Comment i XT POS
98. ed False TxtPoort Text 10101 TxtGate Text TcpClient LocallP ConStateRobot Visible False ConStateServer Visible False Read out robot name and set as form title QueryValue HKEY LOCAL MACHINE System CurrentControlSet Control ComputerName ComputerName ComputerName frmClient Caption Client Settings for robot amp amp vValue End Sub 120 A2 Visual Basic communication programs Private Sub cmdConnect_Click Connect with the main computer kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkxkkkk Declare Variables Dim Answer As String TxtGate Enabled False TxtPoort Enabled False Answer MsgBox Are these settings correct voQuestion voYesNo Connect If Answer vbYes Then Port number data If TcpClient State sckClosed Then TcpClient LocalPort TxtPoort Text Else MsgBox The connection state is closed End If server data If TcpClient State lt gt sckError Then If TcpClient State sckConnected Then MsgBox Not possible while connected to server Else Nothing End lf Else MsgBox Not possible while error on port End lf Invoke the Connect method to initiate a connection kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkxk If TcpClient State lt gt sckError Then TcpClient Listen Else MsgBox Connecting not possible while error on socket End If End If End Sub Private Sub Form_Unload Cancel As Integer
99. ed For this reason the user is always sure that when the application is started the robot is never going to crash with the table or another object because it has to be moved by the user manually and he takes visual contact with this Note Realize that before putting a new value to a variable there is a function wait it is because the robot follows executing the program until the next function while it is executing a movement Realize also that this waits are for a little time DEF Test3 decl int Xball decl int Yball decl int Xbox decl int Ybox pos al position of the ball pos a2 position of the box LOOP change coordinates to mm Xball X BALL 1000 Yball Y BALL 1000 Xbox X BOX 1000 Ybox Y BOX 1000 101 11 Flowchart and final programs IF ROBOT COORD 1 THEN PROCESS _ DONE 0 ERROR CODE 0 P6 Vel 100 PDAT6 Tool 1 Aspirate tool Base 1 Project give coordinates to the next point robot needs initial point xp4 x xp6 x xp4 y xp6 y 4 2 2 P4 Vel 100 PDAT4 Tool 1 Aspirate tool Base 1 Project to situate center of tool in central point of the base 4 0 xp4 y 0 xp4 z 0 take coordinates of the ball z axis is given by the user 1 4 1 2 1 2 10 1 1 Xball 1 1 Yball WAIT SEC 1 100 add values robot needs wait function ROBOT BALL POS 1 ROBOT COORD 0 lin a1 WAIT SEC 1 5 Short t
100. edObjectX Dim ho green As HUntypedObjectX ho blue As HUntypedObjectX Dim ho ImageGray As HUntypedObjectX ho Circle As HUntypedObjectX Dim ho ImageReduced1 As HUntypedObjectX ho Region As HUntypedObjectX Dim ho ConnectedRegions As HUntypedObjectX ho SelectedRegions As HUntypedObjectX Dim ho SelectedRegions1 As HUntypedObjectX ho RegionFillUp As HUntypedObjectX Dim ho Rectangle2 As HUntypedObjectX ho ImageReduced As HUntypedObjectX Dim ho Regioni As HUntypedObjectX ho ConnectedRegions1 As HUntypedObjectX Dim ho SelectedRegions2 As HUntypedObjectX ho RegionFillUp1 As HUntypedObjectX 126 Dim ho Ellipse As HUntypedObjectX for all programs KK SK K K GE CK CE GE CK K GE K CE CE CE CE Dim Op As New HOperatorSetX Dim Tuple As New HTupleX Dim ExpDefaultWinHandle As Variant Dim Window1 As HWindowX Dim WindowHandle1 As Variant brogram variables LXK K K K K GE GE CE GE CK CK GE CE CK CE CE CK CK Dim Answer As Integer Dim n As Integer Dim strData As String Dim Step As String Dim BallX1 As Long Dim BallY1 As Long Dim BallX2 As Long Dim BallY2 As Long Dim robot ball pos As Integer Dim robot box pos As Integer Dim robot process done As Integer Dim error robot As Integer Dim box position As Integer Private Declare Sub Sleep Lib Kernel32 ByVal dwMilliseconds As Long Private Sub cmdConnect Click connect disconnect ethernet connection 03K KE OK OK OK OK OK OK OK SE OK O
101. ems Addltem S7 S7 connection 1 IX124 7 1 framegrabber CK KOK OK K K GE CK CE CE CK CE CE CK CK Call Op ReadCamPar campar dat hv CamParam1 Call Op ReadPose campose dat hv Pose1 Call Op SetOriginPose hv Pose1 0 0326 0 0776 0 PoseNewOrigin1 Call Op CloseAllFramegrabbers Call Op OpenFramegrabber uEye 2 2 0 O O O default 8 rgb 1 false UI146xLE C 1 O 1 hv AcqHandle Call Op SetFramegrabberParam hv AcqHandle frame rate 27 542 Call Op SetFramegrabberParam hv_AcqHandle contrast 256 128 Call Op SetFramegrabberParam hv_AcqHandle exposure 10 3157 Call Op SetFramegrabberParam hv_AcqHandle gain master 35 Call Op GrablmageStart hv AcqHandle 1 start grabbing images and go to the steps menu CE E SE K SE GE GE GE GE OK CE OK K K OK PE CE CE GE CE CE GE CE GE CE K GE CE GE CE GE XK OK KK KKK KKK Timer4 Enabled True connection with PC from robot GE GE KKK Winsock1 Close Winsock1 RemoteHost 136 129 165 4 Winsock1 RemotePort 10101 Winsock1 Connect IbIIP Caption Winsock1 LocallP Step check box box_position 200 End Sub Private Sub Form_Unload Cancel As Integer Call Op CloseAllFramegrabbers bit_stop Write 1 bit_start Write 0 velocity Write 0 suction Write O End Sub Private Sub hsbBoxPos_Change If hsbBoxPos Value gt 300 And hsbBo
102. ens each picture and recognizes the caltab in each position on the table Important data in the program which could change for detecting the caltab are the data the functions find_caltab and find_marks_and_pose The function camera_calibration is a powerful tool in HALCON and it computes the final calibration and usually it takes several seconds to be executed In the last part of this there are two functions which create two files with the calculated parameters Calibrating the surface of work read image Image images2 000 tiff get image pointer1 Image Pointer Type Width Height dev close window dev open window 0 0 Width 0 60 Height 0 60 black WindowHandle dev update window StartCampar 0 006 0 0 0000032 0 0000032 512 384 1024 768 Calibration Counter 0 NRows NCols NStartpose caltab points caltab descr X Y Z for i to 26 by 1 read image Image images2 i 03 tiff dev set draw margin dev set line width 3 find caltab Image Caltab caltab descr 3 90 3 find marks and pose Image Caltab caltab descr StartCampar 100 10 18 0 5 15 100 RCoord CCoord StartPose dev set color red disp cross WindowHandle RCoord CCoord 6 0 tuple concat NRows RCoord NRows tuple concat NCols CCoord NCols tuple concat NStartpose StartPose NStartpose endfor stop dev open window 0 0 512 512 black WindowHandle
103. ers 300 E id CPU 300 Address If a subnet is selected a CPU 312 the next available address is suggested CPU 312 IFM Highest address 125 5 2 CPU 312 Transmission rate 1 5 Mbps g gm E CPU 313 H E CPU 313 Subnet 23 CPU 313 2 DP not networked 8 28 CPU 313C 2 H E CPU 314 H E CPU 314 IFM CPU 314 2 DP 57 314 6CFO0 04B0 57 314 6CF01 0AB0 6ES7 314 6CF02 04B0 6ES7 314 6CG03 0480 v2o 2 CPU 314C 2 9 CPU 315 oe C CPU 315 2 DP 1 Ps 307 24 5730 B 2 CPU 31420 6es73 Cancel _ Hep CPU SIS 2 PNAP H E CPU 315F 2 DP H E CPU 315F 2 PN DP Delete jd DF DO Si 229 ocencue Gg CPU 316 saser 213 H E CPU 318 2 DP 4H Gov 3 2 CPU 3172 10 Arte Press F1 to get Help taa C Configurati y OPC Scout Document conti Picture 8 10 Tenth step yee 8 OPC communication OPC server via Profibus is already made The final configuration is shown in the next picture RJ SIMATIC Manager opc C Program Files Siemens Step s proj opc iej xl File Edit Insert PLC view Options Window Help e x 05 Btls eee e 2 2 selma 21 E opc guam oh 8 BRE CPU
104. erved lue white Reserved range white Reserved rown white Reserved ink I O ground This ground is shared with the input ground Oz o Z r e a lt NO 2 w O W lt w 0 D 3 2 Q Z O 00 2 Signal name Pin _ oo 3 wo f wo fe Interface including analogue input Internal connector 1 Signal name TXPD Transmit pull down Connect to TX if addr not used RS232 Transmit Connect to TXPD if addr not used Green RS232 Receive connect to GND if not used ellow Ground for RS232 lue Analogue input 10V or Zero sensor input GND Ground for AIN rown Z U gt S D o 5 cable screen is internally connected to motor housing Externally it must be connected to earth Orange Black is not used internally It must be left unconnected The VC terminals are only available on modules with serial number gt 25000 The light green wire CV can be difficult to distinguish from the green wire on some cables Important Please note that the cables are a standard type They are not recommend ed for use in cable chains or where the cable is repeatedly bent If this is required use a special robot cable 2D or 3D cable JVL Industri Elektronik A S User Manual Integrated Servo Motors MACO50 800 4 5 4 5 11 Expansion Module M ACOO FP2 FP4 Assembly
105. ery simple with the scroll bar It changes the speed easily but it causes a problem with the position of the box When the user leaves the box near to the robot in the movement to reach the box the robot stops due to a blockade This can be solved by not allowing that the box can be stopped this area Private Sub hsbBoxPos_Change If hsbBoxPos Value gt 300 And hsbBoxPos Value lt 670 Then MsgBox Value is not valid because of a possible blockade of robot please select in the permitted area hsbBoxPos Value box position Else box position hsbBoxPos Value End lf End Sub Private Sub vsbVelocity Change velocity Write vsbVelocity Value End Sub The full programming code can be seen in the Appendix 3 section A3 1 The window created for this application is displayed in the picture below while the program has been running 96 11 Flowchart and final programs Robot Visual servoing la x Fie Actions r Main Settings Process Status Vacuum sensor state True m 3all out of the box Local connection 4 Disconnect Connection State Connected Ip Address f 36 129 165 5 Motor Settings start False False rev seg motor 3 306 Coordinates Ball axis Ball Y axis Box X axis Bos Y axis w A 4 Assembly 5 Projecti Microsoft visual 5 Robot Visual servoing KOEN 6 9 5 03
106. figuration 47 Find Profile Eg qe OSSNSS 205 Standard Y SM 5 314 5CFOD 0ABO S GES 314 6CF01 04B0 S BES 314 6CF02 04B0 EC 5 314 6CG03 04B0 oF Im 20 de 4 DEDE 29 CPU 314C 2 22 vege 29 CPU 315 CPU 315 2 DP CPU 315 2 PN DP E CPU 315F 2 DP CPU 315F 2 PN DP 28 CPU 316 g CPU 316 2 DP CPU 317 2 28 CPU 317 2 PN DP CPU 317F 2 5 Motor PLC connection via PFOFIBUS 11 Select Transmission Rate 1 5Mbps and Profile Universal DP MFS and click Ok the new network appears in the last window Config SIMATIC 300 1 Configuration Project laj xj il Station Edit Insert PLC View Options Window Help 81 x el En 5 3 el 0 UR Bi xi Profile Standard Properties DP R0 52 1 PROFINET 0 SIMATIC 300 General Addresses Operating Made Configuration 88 C7 Properties PROFIBUS interface DP R0 52 1 ENDO xj CP 300 CPU 300 Properties New General Network Settings 88 08 CPU 312 IFM CPU 3126 eG CPU 313 Highest PROFIBUS 89 28 CPU 313 Address EHE CPU 313 2 eg CPU 313 2 Bg CPU 314 e peg CP
107. final programs If boolBox True Then Dim str_RobotBoxPos As String Dim dataRobot3 As String Dim sendBoxPos As String IblBoxPos Caption Crosscommands ShowVar ROBOT BOX str RobotBoxPos dataRobot3 Split str RobotBoxPos IblBoxPos Caption dataRobot3 0 dataRobot3 2 sendBoxPos ROBOT BOX 5 1 If dataRobot3 2 1 Then TcpClient SendData sendBoxPos boolDone True boolBox False End If End If If boolDone True Then Dim str_RobotDone As String Dim dataRobot4 As String Dim sendDone As String lbIDone Caption CrossCcommands ShowVar PROCESS DONE str RobotDone dataRobot4 Split str_RobotDone IblDone Caption dataRobot4 0 dataRobot4 2 sendDone PROCESS DONE 1 If dataRobot4 2 1 Then TcpClient SendData sendDone boolDone False End If End If End Sub 149 A3 Visual Basic final programs A3 3 Code of Module added in server program Declare variables to connect with the robot Public CrossCommands As Object Public KRC1 As Boolean Public KRC2 As Boolean Public Connected As Boolean Public Strresult As String Public strtest As String Public Strdata As String Public StrBofVer As String Public Loglnfo As String Public Fs Declare variables to read out robot name Public Const REG_SZ As Long 1 Public Const REG DWORD As Long 4 Public Const HKEY_CLASSES ROOT amp H80000000 Public Const HKEY CURRENT US
108. final programs 126 A3 1 Code of the main program 126 A3 2 Code of server program in the robot 142 A3 3 of Module added in server program 150 A4 Datasheet of the motor 154 Index iv 0 and Objectives CHAPTER 0 Background and Objectives The current Project is developed in ACRO Automatisering Centrum Research en Opleiding but these acronyms are more than only words ACRO is a Research and project Group in the field of automation and 16 a certified PROFIBUS COMPETENCE CENTER This group gives PROFIBUS training in a practically oriented industrial environment and can offer you a complete PROFIBUS service Profibus is only one element of automation ACRO offers a complete package of trainings and services in automation The topics of the research group ACRO are Industrial real time networks fieldbus Real time vision applications Sensor based robotics Real time camera hardware Real time operating systems This project consists in implementation of a Visual servoing application The application will use a robot a conveyor and an image analyse system Visual servoing means that a robot 15 controlled real time by analyses of images In this way data which are obtained from the image are used to implement some applications like To track an object with the robot as farer as the field of action permit it To track an unknown outline with the robot To pick up a piece
109. g longXball CLng hv_Xball CoordXball X BALL CStr longXball checking ethernet connection LK K K K K K GE GE CK CE K CK CE CE K CK K K CE CK CE CE K CK CE K K If Winsock1 State 7 Then If txtDone Text Then Winsock1 SendData CoordXball txtXball Text Format hv_Xball 1000 000 000 XballSent True End If Else Answer MsgBox Server not connected do you want to connect it 36 Question If Answer vbYes Then MsgBox Please restart the robot server and then click ok Winsock1 Close Winsock1 Connect Step check box Else MsgBox Please restart the robot server and click yes to follow Step check box End If End If End Function 135 Public Function YballSent As Boolean sending Y coordinate of the ball KK CK KK KKK CE CK KKK KKK KKK KKK CE CE CE KKK KK Dim CoordYball As String Dim longYball As Long cmdConnect Enabled False longYball CLng hv_Yball CoordYball Y BALL CStr longYball checking ethernet connection If Winsock1 State 7 Then If strData Xball Then Winsock1 SendData CoordYball txtYball Text Format hv_Yball 1000 000 000 YballSent True End If Else Nothing End If End Function Public Function XboxSent As Boolean sending X coordinate of the box CK K K K K CK GE GE CK CE CE CK CE CE CE CK K CE CE CK CE CE CE CK CE GE Dim CoordXbox As String Dim longXbox As Long longXbox CLng hv_ Xbox Coord
110. he communication was successfully After this the main program start sending the next coordinate and the server answers again This process is followed until the server sends done In this way both programs are coordinated An important function in the program 15 DataArrival This function is called when data is coming in Ethernet communication In the programming code can be made a distinction between the received data The first part when n 0 1s for the coordinates and the second part is utilized during the robot running Private Sub Winsock1 DataArrival ByVal bytesTotal As Long Dim Strdata2 As String Dim n As Integer get data from the robot Winsock1 GetData strData Strdata2 Split strData UBound Strdata2 n 0 Then txtDone Text strData End If data during the robot movement 1 Then Select Case Strdata2 0 Case ROBOT BALL POS robot ball pos Strdata2 1 Case ROBOT BOX POS robot box pos Strdata2 1 95 11 Flowchart and final programs Case PROCESS DONE robot process done Strdata2 1 Case ERROR CODE error robot Strdata2 1 txtBoxInPos Text txtXball Text txtYball Text txtXbox Text txtYbox Text txtDone Text Case Else MsgBox Error sending data End Select End If End Sub In the main program the velocity of the belt and the position where the box has to stop in real time can be modified To change the velocity is v
111. hey should be changed by the main program but even by the robot In the communication the data sent are strings With this kind of data there aren t problems during the communication because in an Ethernet connection you select each one by the name see the picture below followed by the state 1 if true or if false So is very easy to detect data arrival The process is the next when coordinates has been sent the main program send also ROBOT 1 When the robot detects it starts running With ROBOT BALL POS I the main program enables the suction system if after some seconds the vacuum sensor is the program sends VACUUM 1 if not the robot sends to the main computer ERROR CODE 1 the process starts again and the value of the strings changes to 0 If the process follows normally when the robot is in the box position it sends ROBOT BOX POS 1 and when it is in his initial position sends PROCESS DONE 1 The scheme of this process 1s shown in the following picture ROBOT COORD 1 COMPUTER VACUUM 1 EN NE ROBOT BOX POS I mE PROCESS_DONE 1 M 1 Picture 11 2 Data exchange in communication 92 11 Flowchart and final programs 11 2 2 Main program The current section will try to explain some parts of the programming code in order to make it easier The form load is one of the most important parts here is code from OPC server code to
112. ho ImageGray Call Op ReduceDomain ho red ho Rectangle2 ho ImageReduced Call Op Threshold ho ImageReduced ho Region1 45 255 Call Op Connection ho Regioni ConnectedRegions1 Call Op SelectShape ho ConnectedRegions1 ho SelectedRegions2 area and 4000 9000 Call Op FillUp ho SelectedRegions2 ho RegionFillUp1 Call Op CountObj ho RegionFillUp1 hv Box 138 A3 Visual Basic final programs If Tuple TupleEqual hv Box 1 Then txtBoxinPos Text txtBalllnBox Text Ball inside the box bit start Write 1 hv Column1 0 check ball in box True Else if ball is not in box take the coordinates again txtBoxInPos Text txtBalllnBox Text Ball out of the box txtXball Text txtYball Text txtXbox Text txtYbox Text txtDone Text Step check ball1 End If End If End Function Public Function process again As Boolean txtDone Text hsbBoxPos Enabled True when another box is detected in the first part of the belt process start KKK KKK CK K CE CE K CE K CK K GE CE CK CE CE CK CE CE CE CE CE CE CE K CE CE CK CK CE CE CE K CE CK K CE CE CK K CE CE CK CE CE CE CK CE GE CE CK CE CE CE K CE GE GE K E If Tuple TupleGreaterEqual hv Column1 55 Then txtBalllnBox Text txtAgain Text New process process again True Else Call Op DispObj ho_Image _ hv_ExpDefaultWinHandle Call Op Decompose3 ho Image ho red ho green ho blue Call Op Rgb3ToGray
113. ho red ho green ho blue ho ImageGray Call Op SetColor hv ExpDefaultWinHandle yellow Call Op DispCross hv ExpDefaultWinHandle 350 540 6 0 Call Op GenRectangle2 ho Rectangle2 100 0 0 05 200 70 Call Op ReduceDomain ho red ho Rectangle2 ho ImageReduced Call Op Threshold ho ImageReduced ho Region1 40 255 Call Op Connection ho Regioni ConnectedRegions1 Call Op SelectShape ho ConnectedRegions1 ho SelectedRegions2 area and 9000 12000 Call Op FillUp ho SelectedRegions2 ho RegionFillUp1 Call Op CountObj ho RegionFillUp1 hv Box Call Op AreaCenter ho RegionFillUp1 hv 1 hv Row1 hv Column1 End If End Function 139 A3 Visual Basic final programs Private Sub Timer4 Timer main program wich calls each step in the process LK K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K K XK K K K Call Op GrablmageAsync ho Image hv_AcqHandle 1 Call Op DispObj ho Image _ hv ExpDefaultWinHandle Timer4 Enabled False Select Case Step Case check_box If findbox True Then Step check_box1 Case check_box1 If findbox1 True Then Step check ball1 Case check ball1 If findball1 True Then Step check ball2 Case check ball2 If findball2 True Then Step coord Xball Case ball moving If moving True Then Step check ball1 Case coord Xball If XballSent True Then Step coord Yball Case coord Yball If
114. ime to wait vacuum data IF VACUUM 1 THEN 1 2 1 2 120 z axis position for the box lin a1 a2 xp4 xp4 x 0 4 0 4 2 0 2 2 120 point with box reference 2 a2 x Xbox 20 a2 y a2 y Yoox 20 lin a2 WAIT SEC 1 1000 ROBOT BALL POS 0 ROBOT BOX 5 1 WAIT SEC 2 wait suction off and go to first position 102 11 Flowchart and final programs P11 Vel 100 PDAT11 Tool 1 Aspirate tool Base 1 Project WAIT SEC 1 1000 VACUUM 0 PROCESS DONE 1 ELSE when vacuum is off then go to first position and send error P10 Vel 100 PDAT10 Tool 1 Aspirate tool Base 1 Project WAIT SEC 1 1000 ERROR_CODE 1 ROBOT COORD 0 ROBOT BALL POS 0 ENDIF ENDIF ENDLOOP END 11 3 Picture of the final process 16 T i Wa S MN J EM Picture 11 5 Final process 103 12 Conclusions improvements and future applications CHAPTER 12 Conclusions improvements and future applications 12 1 Conclusions At the beginning the project was a very big challenge because my knowledge in the field of robotics and artificial vision were reduced When I accepted the project it was a risk but at the end it 1s finished The current project 1s considered as the first step in Visual servoing applications It implements a small but important application in the field of real time vision and aut
115. include the initial data at the same time as the velocity is being changed At first the initial data are introduced Network 5 therefore the motor will start Network 4 and 2 The program changes from the start register to the velocity register In the Visual Basic program speed has to be changed any time Network 1 The belt can be stopped at any time Network 3 New S7 program is displayed in the pictures below iEMLAD STL FBD opc SIMATIC 300 1 CPU 314C 2 DP laj x File Edit Insert PLC Debug View Options Window x zzi Network 1 Title Comment Bl H Jumps H E Integer Function H E Floating point fet Move 30 H a Program control HE Shift Rotate E Status bits 16 5 register 17 7 written Network 2 Title Comment 125 0 5 20 6 EL 5 Q 85 100 8 BE BCD Press F1 to get Help offline 465 lt 5 2 5 Insert Chg Astart taa e gt lt 1 Manager opc 1 5 1 1 mec m m mass i Picture 8 20 New 57 program 1 73 iS4LAD STL FBD OB1 opc SIMATIC 300 1 CPU 314C 2 DP File Edit Insert PLC Debug View Options Window Help 16 plela e ole p OMS 2 vel Network 3 Title BS New network Comment GJ Bit logic 54 Comparator 29 C
116. ing digital inputs Control voltage 18 V to 30 V Voltage drop in ON state 100 mA lt 2 Hated load 100 Coincidence factor 100 Load factor 100 Leakage current in OFF state lt 10 Switching of inductive loads is permissible with the use of free wheeling diodes or other voltage limiting components VCH Qutput protection through electronic and thermal orotection in case of short circuits outputs re verse voltage proof up to 30 V 270 129 2 3 Critical dimensions KR 3 mm 19 2 KUKA robot Overwiew programming over jim 335 0357 in 205 2 4 Working envelope for mm 2 3 Quick description of the robot system A KUKA robot system is made up of the following components and is depicted in the picture 2 5 Robot 1 Robot controller 3 KCP teach pendant 4 Connecting cables 2 Software Accessories 20 2 KUKA robot Overwiew programming over Picture 2 5 KUKA robot system 2 3 1 teach pendant The KUKA Control Panel is the teach pendant for the robot system The KCP has all the functions required for operating and programming the robot system 7 18 Picture 2 6 1 Mode selector switch operating mode is selected using mode selector switch on the KCP The switch is activated by means of a key which can be removed If the key is removed th
117. initialize the camera and to communicate with the robot Code corresponding to OPC connection Opc connection Set ConnectOPCServer New OPCServer ConnectOPCServer Connect OPC SimaticNet Set ConnectOPCGroups ConnectOPCServer OPCGroups Set ConnectOPCGroup ConnectOPCGroups Add connectie ConnectOPCGroup UpdateRate 250 Set ConnectOPCltems ConnectOPCGroup OPCltems ConnectOPCltems DefaultlsActive True oet bit start ConnectOPCltems Addltem S7 S7 connection 1 MX125 0 1 Code corresponding to the camera settings open framegrabber Call Op ReadCamPar campar dat hv 1 Call Op ReadPose campose dat hv 1 Call Op SetOriginPose hv_Pose1 0 0326 0 0776 0 hv PoseNewOrigin1 Call Op CloseAllFramegrabbers Call Op OpenFramegrabber uEye 2 2 0 0 0 0 default 8 rgb 1 false Ul146xLE C 1 0 1 AcaHandle Call Op SetFramegrabberParam hv_AcqHandle frame rate 27 542 Call Op SetFramegrabberParam hv AcqHandle contrast 256 Call Op SetFramegrabberParam hv_AcqHandle exposure 10 3157 Call Op SetFramegrabberParam hv AcqHandle gain master 35 Call Op GrablmageStart hv_AcqHandle 1 start grabbing images and go to the steps menu Timer4 Enabled True Code that makes the connection possible connection with PC from robot Winsock1 Close Winsock1 RemoteHost 136 129 165 4 Winsock1 RemotePort 10101 Winsock1 Connect _ 93 11 F
118. instructions for profi cables Remove the insulation from the cable as shown in the ac companying picture Fit the plastic part of the gland on the cable and fold the screen around it Remember to first feed the cable through the nut Feed the cables through the cable glands in the rear plate of the module and tighten the nuts Screw the wires into the module The red wire must go into the terminal and the green must go into the A terminal The input and output terminals can be swapped if re quired The is no difference between input and output on the board which means that it is purely hard wired Attach the circuit board to the rear plate with the two screws REMEMBER to use the spring washers included The table below shows the difference between Siemens naming conventions and the naming on the MACOO FPx MACOO FPx Siemens Standard name name wire colour 8 Re All values in millimetres IMPORTANT use spring washer JVL Industri Elektronik A S User Manual Integrated Servo Motors MACO50 800 15 4 5 Expansion Module MACOO FP2 FP4 4 5 12 MACOO FP2 How to connect the RS232 interface The illustration below shows how to connect the MACOO FP2 directly to a PC COM port The drawing is based on standard cables from JVL type WG0402 WG0410 or WG0420 See also Accessories page 174 for a complete list of cables and connectors If the MAC motor is connected to the same RS232 line as o
119. ions in the general code only if the parameters have been changed or new procedures have been introduced This closes the development cycle in a natural manner 1 to HALCON programming Because the vision part is separated from the general code it can easily be executed in a standalone manner Furthermore it can be given to others without the need to pass the whole project Especially in the case of support questions the HDevelop program with one or more images can quickly be sent to the distributor 1 2 1 Architecture and data Structures HALCON s architecture data structures and internal mechanisms were developed according to the philosophy that they should be 1 Efficient Efficient means that the execution time of each HALCON operator should 2 be as short as possible Furthermore the operator design has been made such that combinations that are standard sequences or more complex tasks must still remain efficient Open The open architecture is important in two respects First 1 must be possible to make use of HALCON from many different languages Here passing of external data to HALCON and accessing internal data of HALCON must also be supported Finally there must be transparent interfaces to integrate user defined operators and non standard image acquisition devices This open architecture allows e g a simple update to a new version of a frame grabber interface without changing the insta
120. ir main areas of application are Machine loading and parts handling Laboratory automation Product testing Assembly Adhesive application Training Arc welding Machining task such as grinding polishing and deburring Designed for a nominal 3 Kg payload the KR 3 provides a powerful combination of high speed flexible automation reliability and ease of use The robot can be mounted upright or inverted and is sealed to IP54 allowing for a wide range of possible uses The brushless servomotors and high stiffness harmonic drives used in the KR3 design make it one of the fastest and most durable robots in its class Absolute encoders built into each joint allow the KR 3 to retain positional information making it possible to turn on the robot and be ready to go in mere seconds Arm position parameters can be maintained in memory for up to 2 months even when the robot and controller are disconnected A fully integrated servo control network located within the robot makes the KR 3 virtually immune to interference from external electromagnetic radiation This internal design also allows for a smaller controller and reduces the complexity of umbilical cable management 16 s 2 KUKA robot Overwiew programming over Arm Schwinge Grundgestel Karussell Hand 2 1 Principal components of the robot Robot design The ISO standard mounting flange on the wrist allows a wide range of end effectors to be u
121. ke English Language Different software companies produced different version of Basic such as Microsoft QBasic QuickBasic GWBasic and so on Visual Basic 16 a visual and events driven Programming Language These are the main divergence from the old Basic In Basic programming 15 done in a text only environment and the program is executed sequentially In Visual Basic programming is done in a graphical environment Because users may click on a certain object randomly so each object has to be programmed independently to be able to response to those actions events Therefore a Visual Basic Program 15 made up of many subprograms each has its own program codes each can be executed independently and at the same time each can be linked together in one way or another You can choose to start a new project open an existing project or select a list of recently opened programs A project is a collection of files that make up your application There are various types of applications we could create however we shall concentrate on creating Standard EXE programs EXE means executable program The Visual Basic Environment consists of the e A Blank Form for you to design your application s interface e The Project window which displays the files that are created in your application The Properties window which displays the properties of various controls objects that are created in your applications 37 4 Visual Basic prog
122. l is removed the internal control circuitry can be kept alive by maintaining a supply at the VC terminal MAC motor with module Expansion module Basic MAC motor From main supply P oe To motordriver 12 48VDC Optional Power supply and control Internal supply voltages Py and communication 2 48VDC circuitry TT0976GB The VC terminal can be left open if not used 116 JVL Industri Elektronik A S User Manual Integrated Servo Motors 50 800 4 5 Expansion Module MACOO FP2 FP4 Expansion module MACOO FP4 front plate BUS1 PWR Primary Profibus DP 4 Power connector m MI2 5pin male MI2 5pin male y R AN connector including connector including I 54 P and secondary Profibus DP interface T 14 supply optional I O BUS2 MI2 8pin female Secondary Profibus DP 1 b ko p connector including connector RS232 Interface M12 5pin female i Selectable such connector including aa oh a as analogue input Ol Profibus DP interface 02 INI NL PL TT1008GB 4 5 14 Expansion MACOO FP4 hardware description 4 offers IP67 protection and MI2 connectors which make it ideal for au tomation applications where no additional protection is desired The M12 connectors of fer solid mechanical protection and are easy to unplug compared to the FP2 module which has cable glands The signals a
123. le alternatives The robot has its own support but it needs an additional surface to work where are situated the conveyor the camera etc This involves thinking about different ways to get the best solution Firstly was chosen a metal plate fixed on the base of the robot But it wasn t a good idea because the robot could produce movements on the plate it could make errors while the camera 15 grabbing images and even it would be an unstable structure Afterwards was decided that the best choice was to design a table more stable and robust than previous plate To design this at the beginning it was necessary to take measures about the maximum length that the robot can reach during the movements The work surface will be on the same level as the robot base Take into account that the working envelope measures displayed in the previous chapter Picture 2 4 the required table needs the following dimensions Length 1220 mm Width 780 mm Height 865 mm The next step is to check if there are enough materials which are necessary to make the table 1220 x 780 in the workplace 3 2 Features and reasons Looking at the robot scope it is common to think that the table 15 enough to implement the process too big but it s thought to hold another future process eye 3 Manufacturing the surface of work The color of the table is white to help and simplify the images later collected through the camera In this way Halcon progra
124. lication development Image inspection prototyping of the vision method and the final development of the vision method are done within HDevelop Here the program is structured into procedures in which each procedure represents one sub task like initialization processing and cleanup The main program is used only as a test environment to call the procedures by passing images and receiving the results This program is then exported to the language of the desired programming environment The complete application is developed in a programming environment like Microsoft Visual Studio The code from HDevelop is imported e g via an include statement The user interface and other necessary code is implemented using the normal mechanisms offered by the given language Finally the project is compiled and linked Together with the HALCON library the generated program represents the solution that can e g be loaded onto the destination machine or sent to a customer An overview on the philosophy of developing with HALCON can be seen in figure 1 1 The three step approach has several advantages Whenever needed the vision part can easily be optimized or extended because HDevelop offers much better inspection and debugging facilities for image data than the standard programming environments A newly exported HDevelop program be incorporated into the programming environment quite easily because the code is included and requires modificat
125. llation of HALCON 3 Standardized Standardized means that the signatures naming and usage of operators and data strict rules This allows a quick learning combined with few possible errors 4 Self describing HALCON provides detailed information about each operator and their parameters not only in the documentation but also online via specialized operators 1 2 1 1 HALCON operators Whenever any kind of functionality 15 used from the HALCON library it is done via an operator The current version has more than 1100 of these operators Most of them comprise multiple methods which are selected via parameters A full list of all operators can be found in the Reference Manuals or in the dialog Operators of HDevelop Important features of operators are There is no hierarchy among operators From the software architecture point of view all operators are on the same level 1 to HALCON programming Of course there are logical groups of operators This can directly be seen by the classes offered for C and COM where operators processing the same data type are used as members of the corresponding classes Operators have standardized rules for ordering input and output parameters The design of operators follows the rules of the open architecture Therefore you can create your own operators and thus extend HALCON while getting the same look and feel for your own operators Many operators can make
126. lowchart and final programs This main program is made by steps programmed as functions each step is the same as in the flowchart Picture 11 1 It also takes the images each moment that is executed Subsequently a small piece of code 1s shown look that timer4 was initialized the form load Private Sub Timer4 Timer main program wich calls each step in the process tkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk Call Op GrablmageAsync ho Image hv_AcqHandle 1 Call Op DispObj ho Image _ hv_ExpDefaultWinHandle Timer4 Enabled False Select Case Step Case check_box If findbox True Then Step check box1 Case check box1 If findbox1 True Then Step check ball1 When the application 1s looking for the box until the prefix position in the first function check box it stops the conveyor and after it takes a new 1mage and gets the coordinates check box1 So the coordinates are more correct because there are a little time until the belt is stopped It is not important due to it grabs a new image Another problem that can appear is when the ball is moving This problem is solved grabbing two images in two instants separated by Sleep 250 and after comparing the coordinates of both But coordinates are in millimeters these can be always different For that reason when the coordinates are approximately the same the program takes the condition true This comparison is made as follows
127. mming is more efficient and it reduces the mistakes The steel structure of the table is colored brown to conserve the esthetic form of the remaining tables inside the department The table legs are adjustable in height to allow a fine regulation 3 3 Camera support The camera presents a new problem The best position to place it is above the robot in the central part of the table but it has to keep a certain distance to not crash the robot while it is moving In consequence of this the camera support has an L shape to avoid a collision with the robot By tudying the robot movements and by considering the security distances the final shape of the support is obtained 3 4 Plans The following pages show the plans made in AUTOCAD in order to know how the layout of the project is going to be and to know the real measures of the elements 3 Manufacturing the surface of work 12217 General plan _ 34 3 Manufacturing the surface of work Camera Support 35 des 3 Manufacturing the surface of work 1220 22 Work table 36 4 Visual Basic programming CHAPTER 4 Visual Basic programming 4 1 A brief description of Visual Basic Visual Basic is a high level programming language evolved from the earlier DOS version called Basic Basic means Beginners All purpose Symbolic instruction Code It is a fairly easy programming language to learn The codes look a bit li
128. mming over 2 4 Initial programs The programs below show the structure of an easy program using point to point motion circular linear and some coordinates given by the user to move the robot some distances in millimeters Picture 2 17 File Prograrn Configure Monitor Setup Commands Technology Help KRCARLPROGRAMITEST SRC Ln 5 Col Source 1026354M 200 KS Drives contactor off 10 26 42 1356 ECP Shark key required 10 26 47 1356 ECP Shark key required Toe ano TESZAM Motion Last Cmd NAVIGATOR Picture 2 16 First program File Program Configure Monitor Setup Commands Technology Help KRCHARIIPROGRAMYBASE SR C Ln 1 Cold E Source e 10 25 35 200 BS Drives contactor off 10 26 42 1356 ECP Start key required To SEn pase POW 100 ACRO m 10 27AM NAVIGATOR Picture 2 17 Second program 30 2 KUKA robot Overwiew and programming over File Program Configure Monitor Setup Commands Technology Help IPROGRAMYEXAMPLE SRC 1 Col a Source e 10 26 35 200 Drives contactor off 10 26 42 1356 Start key required 10 29 47 135 Start key required ACRO_AT 10 29AM Motion Last Cmd NAVIGATEUR Picture 2 18 Third program 3T s 3 Manufacturing the surface of work CHAPTER 3 Manufacturing the surface of work 3 1 Surface work and possib
129. n rev seg This program also includes a menu bar with some options like introduce the initial data acceleration torque in the motor Subsequently in the picture 9 1 is displayed the window created in Visual Basic and later is the code used in the program for controlling the conveyor Realize that this program integrates OPC server and HALCON To include a HALCON program is necessary to save the program with bas extension and add it in the Visual Basic project like a module After this the code can be added in the main program Picture 9 1 shows the program made The programming code for this application 1s in Appendix 2 paragraph 2 1 80 9 Communication and Visual Basic programs mw Formi 81 File Actions rev seg motor True 1 158 Gtart False v Stop Picture 9 1 Program to control the conveyor 9 3 Robot PC Ethernet communication VB programs 9 3 1 General aspects Until now PROFIBUS has been used in the communication but between the robot and the main PC will be utilized an Ethernet connection for the reason that this method has been used successfully before in the department and it is even easier than PROFIBUS connection to send data instead of the coordinates This way just has the problem of a reduced speed while data are being sent The cable used 15 a crossover cable Ethernet communication needs IP address and a remote port adjusted as the user wants These da
130. n two different moments are the same 03K OK OK OOK OK OK OK GE OK GE OK GE GE CE GE CE GE CE CE GE GE CE GE K K GE OK K GE KK GE GE SE GE GE CE GE CE CE CE K CE GE CE GE GE CE GE GE GE GE GE If BallY1 BallY2 Then If BallX1 BallX2 Then findball2 True Else Step ball moving End If Else Step ball moving End If Es A3 Visual Basic final programs take the real coordinates in microns for sending to the robot OR K K K KKK KKK KKK KKK KKK CE CE CE CE CE CE KK KKK CE CE CK KKK CK CE CE CK CK CE CE K CE CE CE CK CE CE CE CK K K Call Op AreaCenter ho RegionFillUp hv Area Row hv Column Call Op ImagePointsToWorldPlane hv CamParam1 PoseNewOrigin1 350 540 microns hv Xcenter hv Ycenter Call Op ImagePointsToWorldPlane hv CamParam1 hv PoseNewOrigin1 hv Row hv Column microns Xball hv Yball Call Op DispCross hv ExpDefaultWinHandle hv Row Column 6 0 End Function Public Function moving As Boolean function called when the ball is moving for taking the coordinates LK K K K K K K CK CE GE CK CE CE CE CK K GE CE CK CE CE CE CE CE CE CE CE CE CE CK K CE CE CK CE CE CK CE CE CE K CE CE CE CK CE CE CE CK K GE CE CK CE CE K CK K moving True End Function Public Function XballSent As Boolean sending X coordinate of the ball K K K K K K K K K K K K K K K K K XK K K kK K Dim CoordXball As String Dim longXball As Lon
131. ncludes the position where the box is in the correct position 267 lt 8 OPC communication CHAPTER 8 OPC communication 8 1 OPC overview OPC is open connectivity in industrial automation and the enterprise systems that support industry Interoperability is assured through the creation and maintenance of open standards specifications There are currently seven standards specifications completed or in development Based on fundamental standards and technology of the general computing market the OPC Foundation adapts and creates specifications that fill industry specific needs OPC will continue to create new standards as needs arise and to adapt existing standards to utilize new technology OPC Server DP enables easy access to Profibus DP devices Profibus networks can automatically be configured and diagnosed This ensures extremely easy network administration and enables flexible access to individual components 8 2 OPC sever via Profibus connection Standard OPC is utilized to make communication between the motor and a CP 5611 card integrated on the PC This card is used to connect programming devices and PCs to Profibus up to 12 Mbit s and to the multipoint MPI interface of Simatic 57 OPC will connect with the PLC the computer and the motor that integration could be commanded by Visual Basic later following an OPC protocol in a Visual Basic program Next pictures show how to make the OPC connection over Pr
132. nd Sub Private Sub Initialvalues Click initial data Write 1 End Sub Private Sub Startbelt Click bit start Write 1 bit stop Write O End Sub Private Sub Stopbelt Click bit stop Write 1 bit start Write O End Sub Private Sub reading opc items from plc tkkkxkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk bit_start Read 1 Label1 Caption bit_start bit_stop Read 1 Label2 Caption bit_stop velocity Read 1 Label3 Caption Format Round 1600 60 velocity 4096 3 0 000 End Sub Private Sub Timer2_Timer grabbing images make the halcon program Call Op GrablmageAsync ho Image hv_AcqHandle 1 Call Op DispObj ho Image hv ExpDefaultWinHandle End Sub Private Sub VScroll1 Change velocity Write VScroll1 Value End Sub 119 A2 Visual Basic communication programs A2 2 Code of server program in the robot Option Explicit Private Sub CmdConRob Click Connect with robot kkkkkkkkkkkkkkkkkkkkkkkkkkxk ConnectRob End Sub Private Sub CmdDisconRob_Click Disconnect from robot kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk DisconnectRob End Sub Private Sub cmdSend_Click Send data over Ethernet kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkxk TcpClient SendData txtSendData Text End Sub Private Sub Form_Load Setup Form TxtGate Enabled False TxtPoort Enabled False txtconnectstat Enabled False txtSendData Enabled True txtOutput Enabl
133. nectedRegions ho SelectedRegions area and 1200 5000 Call Op SelectShape ho SelectedRegions ho SelectedRegions1 roundness and 0 5 1 Call Op FillUp ho SelectedRegions1 ho RegionFillUp Call Op CountObj ho RegionFillUp hv Ball take the first coordinates of the ball LK K K K K K K CK K CE CK CE CE GE CK CE CE CE CK CE CE CE CK CE CE CE CK CE KKK If Tuple TupleEqual hv Ball 1 Then txtBallOut Text Call Op AreaCenter ho RegionFillUp Area Row hv Column Call Op ImagePointsToWorldPlane hv CamParam1 PoseNewOrigin1 350 540 hv Xcenter Ycenter Call Op ImagePointsToWorldPlane hv CamParam1 hv PoseNewOrigin1 hv Row Column mm Xball hv Yball Call Op DispCross hv ExpDefaultWinHandle hv Row Column 6 0 BallX1 Format Round hv Xball 000 1 Format Round hv_Yball 000 Sleep 250 1 True Else Call Op SetDraw hv_ExpDefaultWinHandle margin Call Op DispObj ho Ellipse _ hv ExpDefaultWinHandle Call Op SetColor hv ExpDefaultWinHandle yellow txtBallOut Text Ball out of the robot reach MsgBox Put the ball within the range of the robot to follow End If End Function 133 A3 Visual Basic final programs Public Function findball2 As Boolean take the second coordinates of the ball LK K K K K CK CE GE CK CE CE GE CK K GE CE CK K CE CE CE CE CE CE CK K CE GE CK Call Op DispObj ho
134. nfiguratiesc 27 OPC Scout N sivc Mana Documenti Config Picture 8 5 Fifth step Profle 98 PROFIBUS PA PROFINET 10 SIMATIC 300 Hl SIMATIC 400 H SIMATIC HMI Station SIMATIC PC Based Control 300 400 9 1 SIMATIC PC Station PROFIBUS DP slaves for SIMATIC 57 7 and distributed rack gt 113 J SIMATIC Manager Miguelopc C Program Files SiemensStep7 s7projMiguelop 18 Bp File Edit Insert PLC View Options Window Help 81 x ole ae Miguelopc Press F1 to get Help ICPS611 PROFIBUS Astar 4 A SA amp scout Wsimaric Document tht Config Picture 8 6 Sixth step 71 TEX gt ase 8 OPC communication Until here OPC configuration is almost done Now it is time to make the network with the motor and the PLC These steps are shown in chapter 5 but there are some pictures to explain the process followed in order to know the final addresses and remember again At first add Rail and afterwards the PLC like in the picture 8 8 RJ SIMATIC Manager Miguelopc C Program Files Siemens Step s 7proj Miguelop File Edit Insert PLC View Options Window Help ple ae 80 Se s IEE 300 1 PROFIBUS 1
135. nnectstat Text Resolving host ConStateServer Visible 2 True 122 A2 Visual Basic communication programs A2 Visual Basic communication programs ConStateServer FillColor voRed Case sckHostResolved txtconnectstat Text Host resolved ConStateServer Visible True ConStateServer FillColor vbRed Case sckConnecting txtconnectstat Text Connecting host ConStateServer Visible True ConStateServer FillColor vbRed Case sckConnected txtconnectstat Text Connected to host cmdConnect Enabled False ConStateServer Visible True ConStateServer FillColor voGreen Case sckClosing txtconnectstat Text Closing socket ConStateServer Visible 2 True ConStateServer FillColor 2 vbRed TcpClient Close TcpClient Listen Case sckError txtconnectstat Text Error on socket ConStateServer Visible True ConStateServer FillColor 2 vbRed End Select Check connection with the robot If Connected False Then CmdConRob Enabled True CmdDisconRob Enabled False ConStateRobot Visible True ConStateRobot FillColor voRed Else If Connected True Then CmdConRob Enabled False CmdDisconRob Enabled True ConStateRobot Visible True ConStateRobot FillColor voGreen End lf End lf End Sub Public Sub ConnectRob oe Set CrossCommands CreateObject CrossCommEXE CrossCommand CrossCommands Init Me CrossCommands ConnectToCross vValue Connected True StrBofVer GetBOF Ver End Sub 123 A2 Vi
136. ofibus in order to get a flexible access of each device as well as integrate everything in a final program made in Visual Basic remember that HALCON programs can be used in Visual Basic 68 8 OPC communication 8 2 1 Create an OPC connection Open a new Simatic project add a new PC station and include the OPC Server indicated in Picture 8 2 MPI 1 Picture 8 1 First Step SIMATIC PC Station m Controller CP Industrial Ethernet nge PROFIBUS E HMI E User Application H E Application OPC Server Swv6 0SP4 d 6 0 5 5 d Sw V6 1 Picture 8 2 Second step 69 8 OPC communication Insert the file corresponding to the CP card integrated in the computer in this case CP5611 Set an address for the new device in this case 6 remember that the PLC has address 2 the motor address 3 Config shuttle1 Configuration Miguelopc PROFIBUS DP PROFIBUS PA PROFINET 10 mg SIMATIC 300 SIMATIC 400 9 2 SIMATIC HMI Station H E SIMATIC PC Based Control 300 400 5 8 SIMATIC PC Station w Controller E gg CP Industrial Ethernet a f CP PROFIBUS Press F1 to get Help 6 A gt Gulconfiguratiesc 2 OPC Scout N Config shuttle1 Configuration Miguelopc PROFIBUS DP S PROFIBUS PA 9 92 PROFINET 10 HH SIMATIC 300 H E SIMATIC 400 He SIMATIC HMI Station
137. oject cg SIMATIC 30011 fj CPU 314c 2 DP Press F1 to get Help 561 a Start 77 K SIMATIC Manager Pr amp Documenti Microsoft Wi 6332 354 2 0 Picture 5 15 Fifteenth picture in PROFIBUS network configuration 5 3 Testing the motor variable values To test the motor and to select the best values of the variables which provide a good working of it The program Simatic Step 7 offers a tool to monitor and modify the parameters of the motor It is possible to use this tool with the motor datasheet and the different kind of registers which the motor has programmed this information 15 attached in Appendix 4 To access in modifying monitoring variables click the toolbar PLC and then in Monitor Modify Variables The window in the picture 5 16 appears Afterwards introduce the inputs and outputs defined in the motor In this case there are 9 outputs and 8 inputs shown in the picture 5 17 After some tests it would be clear which registers and values of each parameter like velocity acceleration torque etc are used Those values will be initially introduced in the motor Decisions about every value are detailed in the following chapter Also the problems with the link between the motor and the conveyor are discussed 50 5 Motor PLC connection via PFOFIBUS Table Edit Insert PLC Variable View Options Window Help aj pisla a selel x E2
138. olation group means that the terminal refers to the I O ground IO 118 JVL Industri Elektronik A S User Manual Integrated Servo Motors MACO50 800 4 5 Expansion M odule MACOO FP2 FP4 4 5 15 Cables for the MACOO FP4 The following cables equipped with M12 connector can be supplied by JVL Rae CDS ctor Description JVL Order no BUS1 BUS2 1 0 PWR 5 pin 5 pin 8 pin 5 pin Male Female Female Male B coded B coded RS232 Interface cable Connects directly from MAC00 FP4 to PC RS232 M12 1 5 8 Length 5m 197 inch Cable 5 5mm with M12 female 5 pin 90 degree connector loose ends 0 35mm 22AWG foil screen Length 5m 197 inch o o p Dx Same as above but 20m 787 inch WI1000 M12F5A20N Cable with M12 male 8 pin 90 degree connector loose ends 0 22 24AWG and foil screen 1000 12 8 05 Length 5m 197 inch xX Same as above but 20m 787 inch WI1000 M12M8A20N Profibus DP cable with M12 male 5 X B coded loose ends WI1026 M12M5S05R Length 5m 197 inch X Same above but 15m 591 inch WI1026 M12M5S15R Profibus DP cable with M12 female 5 pin connector B coded loose W1I1026 M12F5S05R ends and screen Length 5m 197 inch Px 0 Same as above but 15m 591 inch WI1026 M12F5S15R Loose connectors and termination resistor WI1000 M12F5A05N Loose Profibus DP male M12 connector B coded WI1028 M1
139. om the family 57 300 KJ SIMATIC Manager Project Fie Edit Insert PLC View Options Window Help Dia 8848 2 85 sa o Sa norte zpw wem e m Project C Program Files Siemens TAX 5 1 Project WT Project Inserts SIMATIC 300 Station at the cursor position stat 73 2 manager m 8 23 5 Picture 5 3 Third picture in PROFIBUS network 43 5 Motor PLC connection via PFOFIBUS 3 Access into SIMATIC 300 1 on the left side the program shows the next window Picture 5 4 Choose the rail in Rack 300 and do double click i HW Config SIMATIC 300 1 Configuration Project Station Edit Insert PLC Options Window Help la x 21818 18 S 2 ED 92 wol Profile Standard 9 9 PROFIBUS DP ABE PROFIBUS PA w PROFINET c SIMATIC 300 BM Bg CP 300 CPU 300 EH FM 300 Gateway e ea 300 ea ea i B i B M7 EXTENSION 25 300 BMC RACK 300 SIMATIC 30011 Bg SM 300 SIMATIC 400 Z SIMATIC HMI Station SIMATIC PC Based Control 300 400 SIMATIC PC Station Ele EE E Be GES 390 12270 0 0 Available in various lengths Press F1 to get Help fi w ay e ll a SIMATIC Manager Project M Documenti Microsoft
140. omation processes However implement new applications on the basis of this project is an easy task Therefore 1s necessary to think about the new process and to make some changes in the code of the main program and the robot program But the project of course can be improved in some ways and it is open to possible extensions The next paragraph will try to explain some improvements that can be taken into account but these could be even more 12 2 Improvements and future applications Subsequently are mentioned some possible extensions and modifications in order to improve the current project One of the most important aspects industry 16 efficiency which means something like more work in the same time For this reason efficiency could be equivalent to the speed of the process In this way most of the possible improvements are going to follow this way The motor which moves the conveyor is connected with PROFIBUS over OPC with the PLC and both with the computer OPC as was explained in previous chapter is a standard of communication it is a powerful tool in automation But the velocity when data are sent 15 not fast Due to that a new extension could be make the connection between the computer and the PLC over Ethernet and after with the other devices like the motor over PROFIBUS 104 12 Conclusions improvements and future applications Between the robot and the main computer there is an Ethernet connection This connecti
141. on during the working of the robot is not so fast When the main program is sending the coordinates to the robot it needs almost 3 or 4 seconds One option could be send another kind of data because the protocol of communication designed by me uses string data and these data are longer than another But this kind of communication was chosen because of it didn t have mistakes by the way of creating a safe communication Another option would be to make a PROFIBUS connection between the PLC and the robot this option is the best The KUKA robot has PROFIBUS connection and it can be made but this subject takes part of another big project that can be developed in the future in ACRO Leaving aside the improvement of the communication the most important improvement is the calibration of the surface of work There are some possible motives to explain this One of this is that the calibration was made with a tool from Halcon 8 0 and the project has utilized Halcon 7 0 to make it On the other hand the problem is the quality of the lens because it has some distortions more on the side The error in the distances is higher when the object is further from the center of the table Another option could be to choose a lens with less focus distance to watch more field of work and exclude from the application the side area 105 13 Bibliography CHAPTER 13 Bibliography e quick Access to the functionality of HALCON version 7 0 1 July
142. onverter Counter M125 1 20 3 08 DB call 51 Jumps 28 Integer function 28 Floating point fct zy Move Program control Shift Rotate GA Status bits 16 2 61 Timers ig Word logic IT T FB blocks FC blocks 5 blocks SFC blocks Network 4 Title nl Multiple instances z Zu W Libraries 2 M125 0 M20 6 07 7 AA AAA A H Press F1 to get Help 8 offline labs lt 5 2 5 Insert Chg A A 82 gt manager 5 1 Microsoft w qm os 2 Picture 8 21 New 57 program 2 RALAD STL FBD 081 opc SIMATIC 300 1 CPU 314C 2 DP File Edit Insert PLC Debug View Options Window Help iex poella a x ol e Sele gt 88 zi xi Network 5 Title DBZ oof New network Gi Bit logic 1 21 Comparator 9 29 Converter Counter call amp Jumps 8 Integer function Floating point fet 24 Move aR Program control Shift Rotate G Status bits 161 Timers 29 Word logic F8 blocks H E FC blocks SFB blocks H SFC blocks 0 Multiple instances Libraries M125 0 M125 2 M20 3 5 RI REL 8I E M125 2
143. operators 1 2 1 2 Parameters and data structures 1 2 2 Image acquisition 1 3 HDevelop 1 4 Using HALCON within programming languages 1 5 Examples and applications 2 KUKA robot Overview and programming over KCP 2 1 Robot description KUKA KR3 2 2 Technical data 2 3 Quick description of the robot system 2 3 1 KCP teach pendant 2 3 2 Operating modes 2 3 3 Changing user group 2 2 4 Coordinate system 2 2 5 Tool calibration 2 2 6 Structure of a KRL program KUKA Robot Language 2 2 7 Programming motions 2 2 7 1 Inline form for motions 2 4 Initial programs 3 Manufacturing the surface of work 3 1 Surface of work and possible alternatives 3 2 Features and reasons 3 3 Camera support 3 4 Plans 4 Visual Basic programming 4 1 A brief description of Visual Basic 4 2 Drawing the user interface 4 3 Learning to program in Visual Basic 5 Motor PLC connection via PROFIBUS 5 1 Components and connection cables 5 2 PROFIBUS network configuration 5 3 Testing the motor variable values Index Page WD 99 6 Step7 program for the conveyor 6 1 Requirements 6 2 Step7 program 7 Step7 program for the conveyor 7 1 Camera Properties and location 7 2 Choosing the correct lens 7 3 Lighting the surface 7 4 Calibrating the coordinates on the work area 7 5 HALCON program for the real process of the project 8 OPC communication 9 1 OPC overview 8 2
144. pClient State sckClosed Then TcpClient LocalPort TxtPoort Text Else MsgBox The connection state is not closed End If Copy server data If TcpClient State sckError Then If TcpClient State sckConnected Then MsgBox Not possible while connected to server Else Nothing End If Else MsgBox Not possible while error on port End If Invoke the Connect method to initiate a connection If TcpClient State sckError Then TcpClient Listen Else MsgBox Connecting not possible while error on socket End If Else Nothing End If End Sub Private Sub Form Unload Cancel As Integer End program CE E SE K SE K GE GE GE GE GE KKK End End Sub meee A3 Visual Basic final programs Private Sub TcpClient ConnectionRequest ByVal requestID As Long Accept connection CE SE SE GE SE GE GE GE GE OK CE KK OK OK KK TcpClient Close TcpClient Accept requestID End Sub Private Sub Timer1 Timer Do connection test and show message in taskbar E E SE K SE GE GE GE GE GE CE CK OK K OK PE CE CE GE CE CE GE GE GE GE GE GE GE GE GE GE XK OK KK K K CE CE CE SE connectiontest End Sub Private Sub tcpClient DataArrival ByVal bytesTotal As Long Declare Variables 038 K K K OK K GE CK K GE K K CE GE Dim bool1 As Boolean Dim bool2 As Boolean Dim bool3 As Boolean Dim bool4 As Boolean Dim bool5 As Boolean Dim bool6 As Boolean Dim bool_reset1 As Boolean Dim bool_reset2 A
145. parameters This line mustn t be deleted 4 Home position The Home position is not program specific It is generally used as the first and last position in the program as it is uniquely defined and uncritical The Home position is stored by default in the robot controller 22 End line The End line 15 the last line any program If the program 15 a function the wording of the End line is Endfct 26 2 KUKA robot Overwiew and programming over 2 2 7 Programming motions PTP motion The robot guides the TCP along the fastest path to the end point The fastest path is generally not the shortest path and is thus not a straight line As the motions of the robot axes are rotational curved paths can be executed faster than straight paths The exact path of the motion cannot be predicted Picture 2 10 PTP motion LIN motion The robot guides the TCP at a defined velocity along the shortest path to the end point The shortest path is always a straight line Picture 2 11 LIN motion 207 2 KUKA robot Overwiew programming over CIRC motion The robot guides the TCP at a defined velocity along a circular path to the end point The circular path is defined by a start point auxiliary point and end point Picture 2 12 CIRC motion 2 2 1 Inline form for motions adi PAM Picture 2 13 Inline form for LIN motions 1 Type of motion PTP LIN CIRC 2 Name of the end
146. picture below shows the result of the program and the appropriate lens used in the camera 54 wil 50327 f 1224 1150 L W width of object height of object w width of format 1 2 format 6 4mm 1 3 format 4 8mm 1 4 format 3 6mm m h height of format 1 2 format 4 8mm 1 3 format 3 6mm m 1 4 format 2 7mm f focal length ee L object distance L f Example Full image of 4 5m high object TV monitor camera 1 3 format Object distance 10m A N EN NEN 4 5m 4 500 10 10 000mm f 3 6 f L 4 500 10 000 gt 8mm gt Picture 7 2 Calculating the focus The data include in the equation are Length from the table to the camera 1150 mm Width of the table 1120 mm format 6 4 mm So the focus is 6 0327 mm and then the camera requires 1s a 6 mm lens 7 3 Lighting the surface Lighting is the most important paragraph when cameras are used A good illumination enable to recognize each object in an easier way Some parameters like brightness contrast need to be controlled The first step is to choose the best for the project and to check which location is the best _ 59 7 Camera location lighting and calibration After some tests the lighting selected 1s provided by two fluorescent tubes located on the support of the camera far away from the robot reach These fluorescent tubes ha
147. r 1 To NHumTiradas Text Dado AddTtem Int 6 Rnd 1 Formula Int Valor superior Valor inferior 1 Rnd Valor inferior Resolviendo tipo integer gt Int 6 1 r1 End c1 Hext Contador End 5ub Fifth program F4 Minicalculadora Option Explicit Private Sub cmdDiv Click txtResult Text Val txtOperl Text Val txtOper2 Text lblOp Caption End sub Private Sub cmdMult Click txtResult Text Val txtOperl Text Val txtOperz Text lbloOp Caption End Sub Private Sub cmdEesta Clicki txtResult Text Val txtOperl Text Val txtOperz TIext lblOp Caption End Sub Private Sub cmdSuma Click txtResult Text Val txtOperl Text Val txtOper2 TIext lblOp Caption End Sub 111 1 Visual Basic learning programs Sixth program v Negrita MAYUSCULAS 27 Minusculas Option Explicit Private Sub cmdCopiar Click lblEtiqueta Caption txtTexto Text If chbNegrita Value 1 Then lblEtiqueta FontBold True Else lblErtiqueta FontBold False End If If chbCursiva Value 1 Then lblEtiqueta FontItalic True Else 1blEtiqueta FontItalic False End If optMayusc Value True Then lblEtiqueta Caption UCase 1b1Etiqueta Caption Else lblEtiqueta Caption LCase 1Lb1LEtiqueta Caption End If End Sub 112 Seventh program Option Explicit r Frame amp Con Sin IVA Private Sub MostrarPrecio Click
148. r vbRed Case sckResolvingHost txtconnectstat Text Resolving host ConStateServer Visible True ConStateServer FillColor vbRed Case sckHostResolved txtconnectstat Text Host resolved ConStateServer Visible True ConStateServer FillColor vbRed 146 A3 Visual Basic final programs Case sckConnecting txtconnectstat Text Connecting host ConStateServer Visible True ConStateServer FillColor vbRed Case sckConnected txtconnectstat Text Connected to host cmdConnect Enabled False ConStateServer Visible True ConStateServer FillColor vbGreen Case sckClosing txtconnectstat Text Closing socket ConStateServer Visible True ConStateServer FillColor vbRed TcpClient Close TcpClient Listen Case sckError txtconnectstat Text Error on socket ConStateServer Visible True ConStateServer FillColor 2 vbRed End Select Check connection with the robot CE E SE PE SE GE GE GE GE GE K OK CE OK OK CE PE CE GE CE CE GE GE CE CE GE GE GEEK If Connected False Then CmdConRob Enabled True CmdDisconRob Enabled False ConStateRobot Visible True ConStateRobot FillColor vbRed Else If Connected True Then CmdConRob Enabled False CmdDisconRob Enabled True ConStateRobot Visible True ConStateRobot FillColor vbGreen End End If End Sub Public Sub ConnectRob Create object for the robot CE E SE GE GE SE SE GE GE GE GE K K K CK CE CE CE PE CE CE GE SE Set CrossComm
149. ramming It also includes a Toolbox that consists of all the controls essential for developing a VB Application Controls are tools such as text box command button label combo box picture box image box timer and other objects that can be dragged and drawn on a form to perform certain tasks according to the events associated with them Additional objects can be added by clicking on the project item on the menu and click on components on the drop down list 4 2 Drawing the user interface There are three primary steps involved in building a Visual Basic application 1 Draw the user interface 2 Assign properties to controls 3 Attach code to controls Visual Basic operates in three modes Design mode used to build application Run mode used to run the application Break mode application halted and debugger 15 available Six windows appear when you start Visual Basic The Main Window consists of the title bar menu bar and toolbar The title bar indicates the project name the current Visual Basic operating mode and the current form The menu bar has dropdown menus from which you control the operation of the Visual Basic environment The toolbar has buttons that provide shortcuts to some of the menu options The main window also shows the location of the current form relative to the upper left corner of the screen and the width and length of the current form Ws peuioes corona ext dat F i
150. rd program extracts the outline of a single color object For example in the Picture 1 4 HALCON draws the outline of a passport Drawing edges dev_close_window close all framegrabbers dev open window 0 0 640 480 black WindowHandle open framegrabber DirectShow 1 1 0 0 0 0 default 8 rgb 1 false default default 0 1 AcqHandle grab image start AcqHandle 1 while true count seconds T1 grab image async Image AcqHandle 1 count seconds T2 Result 1 T2 T1 threshold Image Region 0 70 connection Region ConnectedRegions boundary ConnectedRegions RegionBorder inner dilation rectangle1 RegionBorder RegionDilation 10 10 union1 RegionDilation RegionUnion dev display Image dev set color green dev set line width 3 dev set draw margin reduce domain Image RegionUnion ImageReduced edges sub pix ImageRHeduced Edges lanser2 0 5 20 40 stop endwhile close framegrabber AcqHandle 14 1 to HALCON programming Picture 1 4 Drawing edges 15 2 KUKA robot Overwiew programming over CHAPTER 2 KUKA Robot Overview and programming over KCP 2 1 Robot Description KR3 The KR3 robot and its variants are six axis industrial robots designed for light payload applications that require articulated motion in the horizontal and vertical planes The
151. region is defined as a set of pixels which are not necessarily limited to the coordinate range of a given image The pixels of a region are not necessarily connected This means that even arbitrary collection of pixels can be handled as one region If connected components as separate regions are needed the operator connection can be called Because the coordinates of pixels inside a region are not limited to the coordinates of a given image the region can be larger than the image possibly as the result of a dilation operation Whether a region should be clipped to the XLDs 1 to HALCON programming maximum image extents can be controlled using the operator set system with the parameter value clip region The implementation of regions is based on an efficient implementation of the runlength encoding This encoding facilitates low memory consumption with efficient processing and easy use as regions of interest domains Because of the implementation based on runlength encoding it is possible to have overlapping regions e g as the result of a dilation of connected components This would not be possible with a classical implemention based on label images The number of regions for an application 15 virtually unlimited XLDs belong to the iconic data XLD is the abbreviation for eXtended Line Description and comprises all contour and polygon based data Subpixel accurate operators like edges
152. ring On Error GoTo QueryValueExError Determine the size and type of data to be read Irc RegQueryValueExNULL IhnKey szValueName 08 0 cch If Irc ERROR NONE Then Error 5 oelect Case For strings Case REG SZ sValue String cch 0 Irc RegQueryValueExString IhnKey szValueName 0 sValue cch If Irc ERROR NONE Then vValue Left sValue cch 1 Else vValue Empty End If For DWORDS Case REG DWORD Irc RegQueryValueExLong IhKey szValueName 0 IValue cch If Irc ERROR NONE Then vValue Case Else all other data types not supported Irc 1 End Select QueryValueExExit QueryValueEx Irc Exit Function QueryValueExError Resume QueryValueExExit 152 A3 Visual Basic final programs End Function Public Sub QueryValue Where As Long sKeyName As String sValueName As String Declare Variables Dim IRetVal As Long Dim hKey As Long IRetVal RegOpenKeyEx Where sKeyName 0 KEY QUERY VALUE hKey IRetVal 2 QueryValueEx hKey sValueName vValue RegCloseKey hKey End Sub 153 4 Datasheet of the motor APPENDIX 4 Datasheet of the motor 154 4 5 Expansion Module MACOO FP2 FP4 MACOO FP2 MACOO FP4 With cable glands With M12 connectors TT1010GB 4 5 1 Profibus module MACOO FP2 and FP4 Introduction The MACOO FP2 and FP4 are Profibus DP slaves They are capable of running at baud rates up to 2Mbit
153. rious pixel types For each image the so called domain specifies which part of the image is processed It thus acts as a region of interest ROI The domain is a HALCON region and can therefore be defined very flexibly from a simple rectangle to a set of unconnected pixels see below Pixel data An almost arbitrary content 1 possible from standard 8 bit gray values to floating point numbers describing derivatives For integer values one two and four byte versions with and without sign are available Besides this floating point and complex images are available Finally special data types for describing edge direction or hue values are supported Image Channels A channel corresponds to an image matrix Each image can have an arbitrary number of channels All channels of an image have the same size Typical cases are single channel gray value image color image with three channels e g RGB or a multichannel image from a multispectral sensor or as a result of texture filtering Coordinate Systems The origin of an image is the upper left corner with coordinates 0 0 The single pixels are accessed using row and column coordinates like in a matrix The coordinates range from 0 0 up to height 1 width 1 A pixel has an extent of 1 whereas the center of gravity of the first pixel of an image is 0 0 This has the effect that this pixel ranges from 0 5 0 5 to 0 5 0 5 Regions Regions belong to the iconic data A
154. s The following pages describe the different aspects of connecting the modules MACOO FP2 and FP4 4 5 9 ACOO FP2 Connectors MACOO FP2 rear plate layout The illustration below shows all the internal connectors in the module The profibus and power connectors are easy to use screw terminals If the I Os are used they require JVL cable type WG0402 2m WG0410 10m or WG0420 20m See also the appendix for cable and connector accessories Overview MACOO FP2 connectors TTO965GB Output connector See table for connection details Interface connector See table for connection details Mounting hole used to fit the connector board to the rear plate Power connection to the basic motor Zooo 4 I l 2 Fuse TIOA Mounting hole used nput connector 1 to fit the connector See table for connection Pee 3 board to the rear plate details z225 Profibus output connector signal to next node in the chain Profibus input connector P P 2 Connect power supply to these signal from last node in the chain PB0062 13 uia 2 terminals 12 48VDC Profibus In and Profibus Out Please note that these two connectors are Profibus signal definitions internally hardwired no electronics added in between Terminal description MACOO FP2 Name at modules GND Signal ground can optionally be used for the cable screen dics wire colour ELE B Positive profibus sign
155. s Boolean Dim bool_reset3 As Boolean Dim bool_reset4 As Boolean Dim Strdata2 As String Dim n As Integer Dim xball As Integer Check for arriving data TcpClient GetData Strdata Strdata2 Split Strdata n UBound Strdata2 If n 0 Then MsgBox Incorrect data End If 144 If n2 1 Then Select Case Strdata2 0 Case X BALL bool1 CrossCommands SetVar X BALL Strdata2 1 bool reset1 CrossCommands SetVar ROBOT COORD 0 TcpClient SendData Xball boolBall False boolError False boolBox False boolDone False lbIDone Caption lb Vacuum Caption IblCoord Caption IbIBallPos Caption IblBoxPos Caption bool2 CrossCommands SetVar Y_ BALL Strdata2 1 bool reset2 CrossCommands SetVar ROBOT BALL POS 0 TcpClient SendData Yball Case X BOX bool3 CrossCommands SetVar X Strdata2 1 bool reset3 CrossCommands SetVar ERROR CODE 0 TcpClient SendData Xbox Case Y BOX bool4 CrossCcommands SetVar Y Strdata2 1 bool reset4 CrossCommands SetVar ROBOT BOX POS 0 TcpClient SendData Done boolBall True Case ROBOT COORD bool5 CrossCommands SetVar ROBOT COORD Strdata2 1 IblCoord Caption Strdata2 0 Strdata2 1 Case VACUUM bool6 CrossCommands SetVar VACUUM Strdata2 1 IblVacuum Caption Strdata2 0 Strdata2 1 Case Else MsgBox Error End Select End If Only empty
156. sed with the KR 3 The possible movements of the robot axes are depicted in Figure 2 2 2 2 Rotational axes and directions of rotation The working range of the robot can be limited by means of software limit switches on all axes The working ranges of the main joints are mechanically limited by hardstops which can be pre adjusted at the factory fig 2 2 Technical data Number of axes Weight Mbunting position Nominal payload Reach Repeatability Encoder resolution Drive system Transmission Brakes Motion modes End of arm connections Energy supply Axis data Axis Hange of motion 53 kg KH SI 24 kg Upright or inverted 3 kg KH 3 SI 1 5 kg 635 mm 0 05 mm 2048 counts per turn Flectramechanical brushless motors Absolute encoders in each joint Harmonie Drive Brakes on joints 1 2 3 and 5 Teach Automatic ISOSA08 compliant tool flange Support for pneumatic tools Up to 4 electrically isolated digital inputs and outputs on axis 5 Maximum speed 2 KUKA robot Overwiew and programming over KCP 1 180 240 s 135 to 45 210 s continuous turn m 300 s 375 s 18 2 KUKA robot Overwiew programming over User inputs 4 floating digital inputs with reverse voltage protection Input voltage 16 V to 30V Input current at 24 V approx 6 mA Coincidence factor 100 Filter constant 1 2 User outputs 4 float
157. sual Basic communication programs A2 3 Code for Ethernet communication in the main PC Dim strData As String Private Sub cmdClear_Click txtReceive Text End Sub Private Sub cmdConnect_Click connect disconnect with server kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk If Winsock1 State 0 Then Winsock1 Connect Else Winsock1 Close End If End Sub Private Sub cmdSend Click Winsock1 SendData txtSend Text 5 Private Sub Form_Load Setup form ck ck e ke ke e e e e e e kA A Xx Winsock1 Close Winsock1 RemoteHost 136 129 165 4 Winsock1 RemotePort 10101 Winsock1 Connect End Sub Private Sub connection state kkkkkkkkkkkkkkkkkkkkkkkxk Select Case Winsock1 State Case 0 IblState Caption Closed Case 1 IblState Caption Open Case 2 lblState Caption Listening Case 3 IblState Caption Case 4 IblState Caption Case 5 IblState Caption Case 6 IblState Caption Connecting Case 7 lblState Caption Connected Case 8 lblState Caption Peer closing Case Else lblState Caption Error End Select Connection pending Resolving host Host resolved 124 set caption of connect button If Winsock1 State 0 Then cmdConnect Caption Connect Else cmdConnect Caption Disconnect End If enable disable send button kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkxk If Winsock1 State 7 Then cmdSend Enabled
158. sub pix return the contours as XLD data A contour 15 a sequence of 2D control points which are connected by lines Typically the distance between control points is about one pixel XLD objects contain besides the control points so called local and global attributes Typical examples for these are e g the edge amplitude of a control point or the regression parameters of a contour segment Besides the extraction of XLD objects HALCON supports further processing Examples for this are the selection of contours based on given feature ranges or segmenting of a contour into lines arcs polygons or parallels Control Tuples Tuples are the generic data type for integer and floating point values as well as strings A variable of type tuple can be of any of the three basic types Besides single values arrays of the basic types are supported Therefore one variable can contain none one or an arbitrary number of values where the types of each element can be different 1 to HALCON programming In most cases single values are treated in the same way as multiple values If e g a feature operator is called with a single region one feature value is returned When the operator is called with multiple regions a tuple with the corresponding number of values is returned The index of tuples range from to the number of values minus 1 Handles Handles are references to complex data structures e g models for
159. t Measure gt Base gt 3 Point 2 Assign a number and a name for the base Confirm with OK 3 Enter the number of the mounted tool Confirm with OK 4 Move the TCP to the origin of the new base Confirm with OK 5 Move the TCP to a point on the positive X axis of the new base Confirm with OK 6 Move the TCP to a point in the XY plane with a positive Y value Confirm with OK 7 Press Save The name of the base is project and it has the number 1 To make a good calibration the robot has to have the same axis than the camera because the camera 15 the eyes of the robot But a straight line in the camera 15 not the same as in the robot For this reason and to send to the robot the real coordinates in the same plane the best way to solve this is drawing a straight line in the program Halcon red line in the Picture 10 7 to know what are the real axis for the camera and then to draw this line on the table This line 1s utilized after to calibrate the base the robot as was explained before The code of this program 1 easy Straight line in the camera for the calibration dev open window 0 0 512 512 black WindowHandle read cam par campar dat CamParam1 read pose campose dat Pose1 set origin pose Posel 0 0 0 PoseNewOrigin1 close all framegrabbers open framegrabber uEye 2 2 0 0 0 0 default 8 1 false UI146xLE C 1 O 1 AcaHandle set framegrabber par
160. ta 14 1 lt Module Definition List gt Module MACOO FP 0x13 0x10 0x10 0x10 0x10 0x23 0x20 0x20 0x20 0x20 0x20 EndModule JVL Industri Elektronik A S User Manual Integrated Servo Motors MACO50 800
161. ta As String IpcbData As Long As Long Declare Function RegQueryValueExLong Lib advapi32 dll Alias RegQueryValueExA ByVal hKey As Long ByVal IpValueName As String ByVal lpReserved As Long As Long lpData As Long IpcbData As Long As Long 150 A3 Visual Basic final programs Declare Function RegQueryValueExNULL Lib advapi32 dll Alias RegQueryValueExA ByVal hKey As Long ByVal lpValueName As String ByVal loReserved As Long lpT ype As Long ByVal IpData As Long locbData As Long As Long Declare Function RegSetValueExString Lib advapi32 dll Alias HegSetValueExA ByVal hKey As Long ByVal IpValueName As String ByVal Reserved As Long ByVal dwType As Long ByVal loValue As String ByVal cbData As Long As Long Declare Function RegSetValueExLong Lib advapi32 dll Alias RegSetValueExA ByVal hKey As Long ByVal loValueName As String ByVal Reserved As Long ByVal dwType As Long lpValue As Long ByVal cbData As Long As Long Read out bof version used Public Function GetBOFVer Declare Variables Dim TempVar As String Set Fs CreateObject Scripting FileSystemObject TempVar Fs GetFileVersion c KRC HMI Kuka_HMI exe Set Fs Nothing GetBOF Ver TempVar End Function Deconnect from Kuka cross KRC2 Public Sub DisconnectRob Connected False CrossCommands CrossComm ServerOff Set CrossCommands Nothing End Sub To read a vaiable in the Kuka KRC2 Public Function getVar varName
162. ta should be the same in each computer to transfer information The communications has been done with the following data IP address 136 129 165 4 Remote port 10101 1 9 Communication and Visual Basic programs The KUKA robot has an own operating system 1 2 and it also has special version of Windows XP Because of this the communication between the robot and the main computer needs two steps for the final communication Due to this it will be necessary to make a Visual Basic program in the computer of the robot as well as in the main computer Communication between the robot and Windows is called Crosscom Windows 2000 VB server VB main program program Crosscom Picture 9 2 Communication scheme 9 3 2 First version of the server program in the robot The following program is the first version of the Visual Basic application made for Windows XP of the robot computer Two different parts are mentioned on the left side there are parameters needed for Ethernet connection running like a server on the right side there is the connection with the robot via Crosscom In addition the program includes two state lights and two texts where data sent and received are shown When both connections are good the lights have a green color if not they change into red Sometimes the state of the server is listening when the application in the main computer is not correct An example the following two pictures
163. tage to the motor between 12 and 48 VDC The maximum voltage in the power supply is 30 V which is used The pin connections are detailed in the pictures below Expansion module MACOO FP4 front plate BUS1 PWR Primary Profibus DP Power connector MI2 5pin male MI2 5pin male connector including connector including P P and secondary Profibus DP interface be i Y GO d subply optional BUS2 4 MI2 8pin female Secondary Profibus DP connector including connector RS232 Interface 12 5pin female Selectable 1 5 such connector including as analogue input Ol Profibus DP interface O2 INI NL PL TTIDORGR Picture 5 1 MACOO FP4 connectors 4 5 Motor PLC connection via PFOFIBUS PWR Power input M12 5 male connector JVL Cable WI1000M12 Isolation Signal name Description F5A05N group Note P and P are each available at 2 terminals Make sure that both terminals are connected in order to split the supply current in 2 terminals and thereby avoid an overload of the connector Isolation group Terminal A Siemens syntax for the Profibus DP interface Profibus DP interface ground B Terminal A Siemens syntax for the Profibus DP interface SHIELD Cable shield Internally conn to the motor housing Table 5 1 Detailed pin connections 5 2 PROFIBUS network configuration The PROFIBUS network configuration is used to
164. ther motors the terminal TX PD should only be connected at one of the motors If one of JVL s standard RS232 cables RS232 9 or n is used between the DSUB connector shown and the PC com port the RX and TX pins must be swapped since they cross in these standard cables How to connect the MAC00 FP2 RS232 interface Remember to connect TX PD Red to TX Green in order to achieve stable communication Interface connector JVL cable WG04xx incl analogue input PC RS232 standard I O COM port Screen terminated cable 24 wire to the GND terminal If the RS232 lines are extended through another cable this cable Screen must be must also be screened connected to Connector main ground Cable Female 9pin DSUB MACOO FP2 internal At PC Male 9pin DSUB connector bard TTO966GB If JV s standard programming cable type RS232 9 I or n is used between the shown connector and the PC the RX and TX signal must be swapped Tx to pin 2 and Rx to pin 3 4 5 13 Operation with dual supply for emergency situations In many applications it is intended that positional data and other setup information is re tained during an emergency situation It is however also required by law in many coun tries that the main power for energizing the motor is removed in such a situation To meet both of these requirements the MAC motor equipped with a MACOO FPx module offers a secondary supply input called VC If the main supply at the P termina
165. ts The first part is the mode that the motor will use The following 4 modes can be selected Value Motor mode after command Formt Velocity Command 32 Register The second part of the command is a register number or sub command number The following table shows the register numbers N Register Register Register N Register m se w e mu m 9 1 ste se w aim ja m w mn ole s e fs tm x The following table shows the sub commands N Command Command _ 0 No operation 6 Stat search zero s 1 Select relative postion mode using P FNG s PFNC FLWERR P7 16 24 Nooperaon P_FNC FLWERR P6 16 2 2 2 No operation 5 2 Nooperaton JVL Industri Elektronik A S User Manual Integrated Servo Motors MACO50 800 4 5 Expansion Module MACOO FP2 FP4 Examples of FlexM ac commands Change velocity mode and activate register 32 8 FlexMac command 40 Activate register P5 and change to position mode 64 4 FlexMac command 68 Activate register T3 and change to position mode 64 22 FlexMac command 86 Activate 0 0 0 10 and ZO without changing the mode 96 12 command 108 112 JVL Industri Elektronik A S User Manual Integrated Servo Motors MACO50 800 4 5 Expansion Module MACOO FP2 FP4 4 5 8 MACOO FP2 and FP4 description of connection
166. ub Form_Load window declaration Set Window1 HWindowXCtrl1 HalconWindow hv ExpDefaultWinHandle Window1 HalconID connection Set ConnectOPCServer New OPCServer ConnectOPCServer Connect OPC SimaticNet Set ConnectOPCGroups ConnectOPCServer OPCGroups Set ConnectOPCGroup ConnectOPCGroups Add connectie ConnectOPCGroup UpdateRate 250 Set ConnectOPCltems ConnectOPCGroup OPCltems ConnectOPCltems DefaultlsActive True Set bit start ConnectOPCltems Addltem S7 S7 connection 1 MX125 0 1 oet bit stop ConnectOPCltems Addltem S7 S7 connection 1 MX125 1 1 Set velocity ConnectOPCltems Addltem S7 S7 connection 1 30 1 Set initial data ConnectOPCltems Addltem S7 S7 connection 1 MX125 2 1 framegrabber Call Op CloseAllFramegrabbers Call Op OpenFramegrabber uEye 2 2 0 0 0 0 default 8 rgb 1 false Ul146xLE C 1 O 1 hv_AcqHandle Call Op SetFramegrabberParam hv_AcqHandle contrast 256 Op SetFramegrabberParam hv_AcqHandle exposure 10 3157 Call Op SetFramegrabberParam hv_AcqHandle frame_rate 27 542 Call Op SetFramegrabberParam hv AcqHandle gain master 35 Call Op GrablmageStart hv_AcqHandle 1 start grabbing images tkkkxkkkkkkkkkkkkkkkkkkkkkkkkkkk Timer2 Enabled True 118 A2 Visual Basic communication programs End Sub Private Sub Form_Unload Cancel As Integer Call Op CloseAllFramegrabbers E
167. vailable are restricted compared to the FP2 module since only 4 I O terminals are available The I Os connected to these 4 terminals must be selected by a small dip switch The connector layout PWR Power input M12 5 pin male connector JVL Cable WI1000M12 Isolation Signal name Description F5A05N group P 1 P supply 1248VDC Connect wih pin 2 M re supply around Connect wih pin 5 P Main supply around Connectwithpin3 5 crey 1 Note P and P are each available at 2 terminals Make sure that both terminals are connected in order to split the supply current in 2 terminals and thereby avoid an overload of the connector Terminal A Siemens syntax for the Profibus DP interface Profibus DP interface ground B Terminal A Siemens syntax for the Profibus DP interface SHIELD Cable shield Internally conn to the motor housing ontinued next page JVL Industri Elektronik A S User Manual Integrated Servo Motors MACO50 800 17 4 5 Expansion Module M ACOO FP2 FP4 BUS2 Profibus DP Interface M12 5 pin female connector Cable user supplied DGND Profibus DP interface ground Terminal Siemens syntex for the Profibus interface SHIELD Cable shield Internally connected to the motor housing I Os and RS232 interface M12 8 pin female connector JVL Cable Signal name Description m WI1000 M12 Isolation DIP 5 OFF PL input
168. ve Passive mode 0 When this mode is selected the user inputs are ignored The inputs can be read in output data 5 for other purposes Absolute Relative mode 1 When this mode is selected the inputs have the following functions IN I Selects the absolute position in position register IN2 Selects the absolute position in position register 2 IN3 Moves relative the distance in position register 3 IN4 Moves relative the distance in position register 4 The action is executed when an inactive to active transition is detected on the input Custom mode 15 When this mode is selected the action of each input can be selected with the slave pa rameters See Slave parameters on page 10 JVL Industri Elektronik A S User Manual Integrated Servo Motors MACO50 800 09 4 5 4 5 6 110 Expansion Module MACOO FP2 FP4 Slave parameters When configuring the profibus it is possible to set some parameters for the slave These parameters are setup during startup and cannot be changed during operation XX Input level Using these parameters the input level of the inputs INI IN2 IN3 IN4 NL and PL can be selected Possible values Active high The input will be active when a signal is applied Active low The input will be active when no signal is applied End limit action Using this parameter the action taken when an end limit is activated can be selected Possible values Velocity 0 When th
169. ve to run with high frequency The camera grabs more than 50 frames per second and because of this some dimming parts can appear The two fluorescent tubes are 13 W each one with a length of 530 mm they emit a uniform lighting without too brightness in the center otherwise the white color of the surface would reflex the light and the quality of the images would be bad For the tubes it is necessary to use another piece holding up these In this case the support will be made of wood The measures and location of this are selected by the user but these setting don t need a high precision A Quicktronic Intelligent QTi dimmable is a device which ensures flicker free operation of the lamps throughout the entire dimming range from 100 to 1 specifically the device Quicktronic Intelligent QTP 2x18 230 240 is utilized in the project The picture below shows the physical form of this the next picture expose it the electric diagram to make the connection between the lamps the Quicktronic and the electric network Picture 7 3 Quicktronic Intelligent QTP 2x18 230 240 QTP 2x 230 240 DL Picture 7 4 Electric diagram The cables have two colors one for each lamp white and red and they are hold in the camera support by bridges The Quicktronic is also holding up here too 60 7 Camera location lighting and calibration 7 4 Calibrating the coordinates on the work ar
170. w Project SIMATIC 300 1 D OR fabs lt 5 2 ma a SIMATIC Manager Project M Documenti Microsoft W var variable table1 CBE OS SS 21 04 Picture 5 16 Variable table uh Var motor Table Edt Insert PLC Variable View Options Window z A aeo x 9a motor SIMATIC 300 1 CPU 314C 2 DP 57 Program 1 pe Picture 5 17 Motor inputs and outputs 51 6 Step 7 program for the conveyor CHAPTER 6 Step 7 program for the conveyor 6 1 Requirements Firstly the motor is joined directly with the conveyor in one side The motor is used for applications of high velocity so it may have some problems when it is connected directly to the conveyor due to the velocity of this has to be slow To solve this problem in the test mode explained in the previous chapter many register were tested to adjust the best values of each one After many tests these values were chosen but the motor had a strange comportment because it worked in low velocity and high torque So it s impossible to move the conveyor itself For this reason afterwards the connection will be modified adding a component which reduces the velocity The initials data will be shown in this chapter Maybe these won t be the latest data The program in Step 7 for the conveyor consists in a start stop program controlled by some switches conn
171. xPos Value lt 670 Then A3 Visual Basic final programs MsgBox Value is not valid because of a possible blockade of robot please select in the permitted area hsbBoxPos Value box position Else box position hsbBoxPos Value End If End Sub Private Sub Initialvalues Click initial data Write 1 End Sub 129 Private Sub Startbelt Click bit_start Write 1 bit_stop Write 0 End Sub Private Sub Stopbelt Click bit stop Write 1 bit start Write O End Sub Private Sub 1 Timer reading opc items from plc LK K K K K K K K K K K K K K kK GE k bit_start Read 1 Label1 Caption bit_start bit_stop Read 1 Label2 Caption bit_stop velocity Read 1 Label3 Caption Format Round 1600 60 velocity 4096 3 0 000 vacuum Read 1 IblVacuum Caption vacuum End Sub Private Sub Timer3 Timer display connect state LK K K K K K K K K K K K K kK kK K Select Case Winsock1 State Case 0 IblState Caption Closed Case 1 IblState Caption Open Case 2 IblState Caption Listening Case 3 IblState Caption Connection pending Case 4 IblState Caption Resolving host Case 5 IblState Caption Host resolved Case 6 IblState Caption Connecting Case 7 lblState Caption Connected Case 8 IblState Caption Peer closing Case Else IblState Caption Error End Select 130 A3 Visual Basic final programs
172. xt step is to include the robot suction system necessary to complete the project The object which would be picked up is a small black ball with a diameter approx 500 mm So the best tool to get the ball 16 a suction cup tool with a diameter smaller than the diameter of the object in this way the power of suction 16 higher Besides the cup tool other components are needful even more important than the tool itself These components are the following Compressor Valve Vacuum sensor Pneumatic Converter Vacuum generator Suction cup tool Each one has its own function It s going to be explained in the next section 10 1 1 Compressor Panther Werther International One of the most important components in the suction system 15 the compressor the first part in this system A gas compressor is a mechanical device that increases the pressure of gas by reducing its volume with this 1s obtained air with a high velocity It 1s explained because the pressure and after the vacuum generator create the suction in the final point which means in the cup tool The picture 10 1 shows the compressor that takes part in the project application 84 10 Robot settings suction system and calibration Picture 10 1 Compressor 10 1 2 Solenoid valve MFH 2 M5 4573 The valve is connected directly with the compressor with a tube This valve has the function of start stop the suction It actuates through an electrical sign
Download Pdf Manuals
Related Search
Related Contents
Manual-ECH2O-TE-EC-T.. Télécharger Français Phonix S900LSW mobile phone case Digitus HDMI(C)/HDMI(A), 2m Fully Automated RNAscope® Assay RNAscope® LS Reagent Kit NetDA Manager User`s Manual Copyright © All rights reserved.
Failed to retrieve file