18 3 COSIMIR Educational Software COSIMIR Educational (the new designation is COSIMIR Robotics) provides you with a virtual learning environment in the field of robotics. Step by step, you will be able to advance independently from very simple robotics applications right through to highly complex workcells in a highly realistic, simulated 30 work environments. For study purposes there are over 30 different robot applications (projects) which make it possible to write the control program for the robot and test this program on the virtual 3D computer model. In COSIMIR Educational robot programming languages MELFA Basic IV (MB4), Movemaster Command (MRL) or Industrial Robotic Language (IRL) can be used. Languages MB4 and MRL are intended only for Mitsubishi robots programming and IRL programming language is suitable for optional series of robots. COSIMIR Educational does not allow for downloading the robot control program into the real robot control device. 3.1 Start-up Starting the program COSIMIR Educational consists of the following steps: START → Programs → Festo Didactic → COSIMIR Educational (Fig. 3.1). Fig. 3.1. Start-up of COSIMIR Educational During the starting of the program the windows shown in Figs. 3.2 and 3.3 are opening. The first window of COSIMIR Educational is the general view of applications where writing and testing of the control program occur. The other window is the help window where the selection of different robot applications is displayed.
Software COSIMIR Educational (the new designation is COSIMIR Robotics) provides you with a virtual learning environment in the field of robotics. Step by step, you will be able to advance independently from very simple robotics applications right through to highly complex workcells in a highly realistic, simulated 30 work environments. For study purposes there are over 30 different robot applications (projects) which make it possible to write the control program for the robot and test this program on the virtual 3D computer model.
In COSIMIR Educational robot programming languages MELFA Basic IV (MB4), Movemaster Command (MRL) or Industrial Robotic Language (IRL) can be used. Languages MB4 and MRL are intended only for Mitsubishi robots programming and IRL programming language is suitable for optional series of robots.
COSIMIR Educational does not allow for downloading the robot control program into the real robot control device.
Starting the program COSIMIR Educational consists of the following steps: START → Programs → Festo Didactic → COSIMIR Educational (Fig. 3.1).
Fig. 3.1. Start-up of COSIMIR Educational
During the starting of the program the windows shown in Figs. 3.2 and 3.3 are opening. The first window of COSIMIR Educational is the general view of applications where writing and testing of the control program occur. The other window is the help window where the selection of different robot applications is displayed.
Fig. 3.2. General view of COSIMIR Educational
Fig. 3.3. Help window of COSIMIR Educational
When we click on the designation of the industrial application picture, all information about this application is displayed on the help window (description of the industrial application, list and description of the devices applicable, list of the robot inputs/outputs, auxiliary materials for writing the control program).
Fig. 3.4. Information about industrial application of the robot (contents)
The application required for programming the robot in the COSIMIR Eductaional window is opening when clicking on the text beginning with the word Open in the help window. In Fig. 3.5 the application FirstSteps is opened. The following is displayed:
A. robot application 3D window where the robot simulation is shown,
B. window for writing the robot control program,
C. window of the robot position list.
Robot applications can be opened from the CD disc when you choose the file of a concrete application from the folder C:\Program Files\didactic\Cosimi Educational.GB\Model. Then by the help of double click you choose the file called MOD from the folder Model. In the general view COSIMIR Educational, the robot application is opened. Remember the folders Position Lists where the robot position list is located and the folder Programs where the robot control program is located.
Fig. 3.5. A general view of COSIMIR Educational in a robot application
3.2 3D-show Window
The three dimensional model of the robot is displayed in the 3D-show window. The different additional views of robot functioning can be displayed from the menu View→New.
To watch the operation area of the robot in a 3D-show window you must choose View→Show Workspace from the menu. The following point in the 3D-show window of the robot and the workstation is varied. The following possibilities exist:
• Ctrl+Shift - changing the distance of the view (zoom)
• Shift key - shifting the view (right and left, up and down)
• Ctrl key - rotating the view
Industrial applications of every robot have defined standard views that can be chosen from View→Standard menu. The choices are as follows:
• Default Setting – general view
• Front View – front view
• Rear View – back view
• Top View – upper view
• Left Side View – left side view
• Right Side View – right side view
• Full Format – full view of the robot industrial application
Standard views are changeble by opening the drop-down menu in the 3D-show window by the help of the right button of the mouse.
3.3 Robot Model Controlling in the 3D-show Window
To control the robot model in the 3D-show window, the Jog Operation window (Fig. 3.6) is used. This window is opening from the menu Extras->Teach-In. From there it is possible to move the robot, to open and to close the robot gripper, give the destination point (coordinates of the point) for the robot and record the instant position of the robot.
Fig. 3.6. 3D show window when JOINT Jog is chosen
It is possible to move the robot in three different coordinate systems. They are: JOINT, XYZ and TOOL (Fig. 3.7). To move the robot in the coordinate system JOINT, we must mark JOINT Jog (Fig. 3.6). In this coordinate system the single axes of the robot moves in two directions when we click on the arrow key in front of the designation of a suitable axis. The rotation angles of robot are limited.
Fig. 3.7. Moving and rotation directions of the robot when the coordinate systems JOINT (a), XYZ (b) or TOOL (c) are chosen
To move the robot in the XYZ coordinate system XYZ Joint is chosen (Fig. 3.8 a). This coordinate system is the main coordinate system of the robot (world coordinates). When we click on the arrow near the axis, the robot moves in the range of this axis. Near every axis there are buttons connected with the curve line which makes the rotation of the robot gripper around the axis possible.
Fig. 3.8. 3D-show window when XYZ Jog (a) and TOOL Jog (a) are chosen
In the TOOL coordinate system (TOOL Jog), the zero point of the coordinates is the end point of the robot gripper (Fig. 3.8 b).
Movement of the scroll bar Jog Override results in the change of the speed of the robot. The column with the per cent shows the speed of the manually controlled robot (in per cent of the maximum speed of the robot).
The button with the text Close Hand or Open Hand makes it possible to open and close the robot gripper. Sometimes this button may be grey in which case instead of the gripper the robot has another tool. If the gripper exists, then we must use the menu choice Extras->Settings->Grip…. In the open window (Fig. 3.9.) we must choose one of closing or opening commands marked with number from the menu Gripper Control at Teach-In. When the gripper opening/closing button does not function, we must choose the command with another number.
Fig. 3.9. Window Grip
With the button Set Joint Coordinates... or Set XYZ Position…it is possible to give the coordinaates for the robot where it must be located (Fig. 3.10.). If the coordinates are out of the operating area, the robot will not recognize these coordinates.
Fig. 3.10. Coordinates of the robot in JOINT (a) and main (b) coordinate system
The button Current Position → Pos. List makes it possible to record the instant coordinates of the robot into the list of the robot positions. It allows the robot to move to the programmed position and to record this position into the position list only by pressing the button (manual of coordinates entering all positions is not necessary).
The control programs of Mitsubishi robots are recorded mostly into the MB4 or MRL format files which are opening separately for writing the program (in the case of the new program the window is empty). The control programs of other robots may be recorded into the IRL format files. The program file of each robot is opening in a different window.
The program writing window is shown in Fig. 3.11. Every program row (line) consists of the number of the row and the command of the programming language, for example, 10 MOV P1 ’robot moves to position P1. In the given example the number of the row is 10 and the command with the position MOV P1. At the end of the row, a comment about functioning is added.
Program writing is simplified by the drop-down menu (Fig. 3.11) which is opening by the help of the right button of the mouse. Choosing some commands from there it is possible to enter mostly used commands. The meaning of the commands is described in section MELFA Basic IV commands.
Joonis 3.11. Window for writing the program and and drop-down menu for choosing the commands
The manual numbering of program rows is not necessary. Numbering occurs automatically by clicking on Renumber icon. The beginning of the numbering and the step is determined in the window shown in Fig. 3.12. For clicking on Renumber icon the program writing window must be opened. When the window of the robot position list is opened, the numbering of positions occurs.
Fig. 3.12. Renumber window
For the initial testing of the robot control program, the icons Compile and Compile & link are used. After clicking on the icon, the control program is tested. During the testing of the program the new window is opening. In this window warning, fault and test end messages are shown. When the fault message appears, the location of the fault in the program is shown by the help of the double click on the fault message. Sometimes instead of the incorrect row the next row is marked because the checking of the previous row is necessary. For testing the program the program writing window must be opened.
After testing the program Compile & link icon loading the control program into the virtual control device of the robot is placed in the software COSIMIR Educational. The program in the virtual control device of the robot begins functioning when the program simulation is started.
3.5 MELFA Basic IV Commands
Mostly used commands of the programming language MELFA Basic VI and the samples of the control programs are described in this section. On writing the commands there is no difference between caps and small letters. All variables must be written so that first they be declared.
It is marking the beginning of the text in the program row. The text after aphostrope is the comment. Samples:
11 ‘comments begin from here 12 MOV P1,+40 ’comments begin from here
Use this instruction to declare numerical values. The variable declared with INTE will be an integer type (-32768 to +32767). When before the designation of the variable “M” is written, the program is considered as a numeric variable. Declaring at the beginning of the program is not necessary. Samples:
20 DEF INTE a, B, C ’integer type variable declares a, B and C variable 30 DEF INTE d ’integer type variable decares d variable 40 a=0 ‘assigns value 0 to variable a 60 d=12.13 ‘assigns value 12 to variable d 70 C=12.67 ’assigns value13 to variable C 80 d=d+3 ’add number 3 to variable d 90 M1=12-M1 ’from number 12 subtracts variable M1 value and assigns the
result to variable M1
DOUBLE stands for a double-precision real number. The variable declared with DOUBLE will be a double precision type (+/- 1.701411834604692E+308). Instead of the decimal point, the point is used. Samples:
10 DEF DOUBLE Arv ’double-precision type real number variable declares Arv variable 20 Arv = 100/3 ‘assigned to variable Arv value 33.333332061767599
FLOAT stands for single-precision real number. The variable declared with FLOAT will be a single precision type (+/- 1.70141E+38). Instead of the decimal point, the point is used. Samples:
10 DEF FLOAT real ’single-precision type variable declares real variable 20 reaal = 123.468 ‘assigns value 123.468000 to variable real
Declares a character string variable. It is used when using a variable with a name that begins with a character other than “C”. It is not necessary to declare variables whose names begin with the character “C” using the DEF CHAR instruction. Samples:
10 DEF CHAR TEADE ’character type variable declares TEADE variable 20 TEADE = “Töötab” ‘assigns “Töötab” value to character type variable TEADE
30 CMSG = ABC ‘assigns “ABC” value to variable CMSG
This instruction declares XYZ type position vatiables. It is used when using a variable with a name that begins with a character other than “P”. It is not necessary to declare variables whose names begin with the character “P” using the DEF POS instruction. Samples:
angle, C-angle) to position variable 1PUNKT 40 Pabi=P1+P2 ‘assigns coordinates which are the result of two position adding
to position variable Pabi 50 MOV 1PUNKT ’moving to position 1PUNKT
This instruction declares joint type position variables. It is used when using a variable with a name that begins with a character other than “J”. It is not necessary to declare variables whose names begin with the character “J” using the DEF JNT instruction. Samples:
10 DEF JNT TURB ’joint variable declares TURB variable 20 MOV J1 ’moving to position J1 30 TURB = (-50,120,30,300,0,0,0,0) 40 MOV TURB ’moving to position TURB
This instruction declares acceleration and deceleration in per cent from the maximum acceleration and deceleration time. Samples:
30 ACCEL 50,60 ’robot acceleration time is 50% of maximum
. deceleration time is 60% of maximum 50 ACCEL 100,100 ’maximum acceleration and deceleration times
This instruction declares the speed of the robot on linear and arc movement. The maximum speed on 10000 units and it is recorded into the M_NSPD variable. On using the SPD command the fault messages may appear. To avoid this, the speed of the robot must be decreased. Samples:
10 SPD 100 ’robot speed is 100 units 30 SPD 500 ’robot speed is 500 units 90 SPD M_NSPD ’robot speed is value recorded in variable M_NSPD. The optimal
speed control is turned on.
This instruction designates the override that is valid only during robot’s joint movements. The values of the JOVRD 1 – 100, 0 are given in per cent from the maximum speed of the robot. Samples:
10 JOVRD 1 ’robot speed is 1% of the maximum speed of robot joints 40 JOVRD 50.2 ’robot speed is 50.2% of the maximum speed of robot joints 50 JOVRD 100.0 ’robot speed is 100% of the maximum speed of robot joints
This instruction specifies the speed of robot movement as a value in the range from 1 to 100%. This is the override applied to the entire program. Samples:
10 OVRD 50 ’robot speed is 50% from maximum speed
60 OVRD 90 ’robot speed is 90% from maximum speed 190 OVRD 100 ’robot speed is 100% from maximum speed
This instruction will enable us to move or rotate the robot coordinate system. Specify the base conversion data for this instruction. Pay extra attention when making changes in the program, as it may lead to errors in jog operations, etc. The coordinates of the zero point are recorded into the variable P_NBASE. Samples:
10 BASE (50,100,0,0,0,90) ’coordinate system of the robot is shifted to a new zero point and Z- axis is rotated 900
90 BASE P_NBASE ’ initial position reset of coordinate system
Fig. 3.13. Changing the coordinate system of the robot
This instruction changes the test position of the robot tool. The default test position of the robot tool is recorded into the variable P_NTOOL. This instruction is usable when the robot has some tools. The test position guarantees safe functioning of the robot. Samples:
40 TOOL (100, 0, 100, 0, 0, 0) ’changing the test position, shifting on X-axis 100mm and Z-axis 100mm in the coordinate systemTOOL
300 TOOL P_NTOOL ’test position default reset
This instruction moves the robot by using the robot joint motion (joint interpolation). The robot moves along the trajectory calculated by the control device of the robot. Samples:
10 MOV P1 ’robot moves to position P1 by using the joint interpolation 20 MOV P2, -40 'by using the joint interpolation robot moves 40mm higher from
a) b) c)
d) e) f)
Fig. 3.14. Robot motion by using MOV (a), MVS (b), MVR (c), MVR2 (d), MVR3 (e) and MVC (f) commands
This instruction carries out linear interpolation movement from the current position to the movement target position. It is used only on short distances because on long distances a fault message may appear. Samples:
20 MVS P1 ’robot moves to position P1 using linear interpolation 30 MVS,-40 ’using linear interpolation the robot moves 40 mm higher from
instantaneous position 40 MVS P1, -40 ’using linear interpolation the robot moves 40 mm higher from
position P1 MVC
This instruction carries out 3D circular interpolation motion in the order of the start point, transit point 1, transit point 2 and the start point. Pay attention that the circular interpolation remains in the functioning area of the robot. Samples:
20 MVC P1, P2, P3
This instruction carries out 3-dimensional circular interpolation movement from the start point to the end point via transit points. The first position is the start point where the circular interpolation begins. The third position is the end point. The second point is the transit point. Pay attention that the circular interpolation remains in the functioning area of the robot. Samples:
50 MVR P1, P2, P3
This instruction carries out 3-dimensional circular interpolation movement from the start point on the arc composed of the start point, end point, and reference points. The direction of movement is in a direction that does not pass through the reference points. Pay attention that the circular interpolation remains in the functioning area of the robot. Samples:
10 MVR2 P1, P3, P2
This instruction carries out 3-dimensional circular interpolation movement from the start point on the arc composed of the center point, start point and the end point. Pay attention that the circular interpolation remains in the functioning area of the robot. Samples:
20 MVR3 P1,P3,P3
This instruction connects the ON and OFF of the servo motor power. Samples:
10 SERVO ON ’servo motors turns ON 90 SERVO OFF ’servo motors turns OFF
1) When a single command is used:
It causes a delay at a designated time. It is used for positioning the robot and timing input/output signals.
2) When used as an additional pulse output:
it designates an output time for a pulse.
The minimum value that can be set is 0.01 seconds. Samples:
50 DLY 0.5 ’0.5 second delay 60 DLY 10 ’10 second delay 70 M_OUT(2)=1 DLY 0.5 ’0.5 the control output turns ON on 2 seconds
This instruction commands the hand (gripper) to open. The following number determines the number of the gripper (maximum 4 grippers). Samples:
This instruction commands the hand (gripper) to close. The following number determines the number of the gripper (maximum 4 grippers). Samples:
20 HCLOSE 1 ’the first gripper closes 30 HCLOSE 3 ’the third gripper closes
This instruction determines the digital output with a changeble status. The number of the output bit will be written between brackets. When in the end M_OUT is B, the output bit with the number between the brackets is connected with the variable. M_OUTW corresponds to output bit 2 and M_OUTD to output bit 4. Samples:
20 M_OUT(1) = 1 ’output bit 1 turns ON 30 M_OUTB(8)=0 ’since 8 bit 1 bit outputs are cleared 40 M_OUTW(20)=0 ’since 20 bit 2 bit outputs are cleared 50 M_OUT(2)=1 DLY 0.5 ‘output bit 2 turns ON on 0.5 seconds
This instruction determines the digital input with a changeble status. The number of the input bit will be written between brackets. When in the end M_OUT is B, then the input bit with the number between the brackets is connected with the variable. M_OUTW corresponds to input bit 2 and M_OUTD to input bit 4. Samples:
30 WAIT M_IN(1)=1 ’the program waits until the digital input of the robot (bit 1) is turned ON
20 M1=M_INB(20) ’8 bit input value beginning at 20 input bit is assigned to variable M1.
FOR TO STEP
This instruction determines the beginning of the repetition in the program. This command determines the initial and final values of the counter and the increasing step. When the counter overcomes the final, the repetition of the program between FOR TO STEP and NEXT is finished. Samples:
10 FOR M1=1 TO 5 ’beginning of the repetition where the initial value of counter M1 and the final value of the repetition are determined.The default value of the step of increasing the counter number is 1.
… ’all for repeating
50NEXT M1 ’the end of repetition. Counter is increased by the step and it jumps to row FOR when the counter value has not overcome the final value
10 FOR M1=1 TO 6 STEP 2 ’beginning of the repetition where the initial value of counter M1 and the final value of the repetition are determined. The default value of the step of increasing the counter number is 2.
… 60 NEXT M1 ’the end of repetition. Counter is increased by the step (2) and it
jumps to row FOR when the counter value has not overcome the final value
Repeatedly executes the program between the FOR statement and NEXT statement until the end conditions are satisfied.
The program between the WHILE statement and WEND statement is repeated until the loop conditions are satisfied. On compiling the conditions the following signs are used: = (equal), <> (not equal), < (smaller), > (bigger), <= (smaller/equal), >= (bigger/equal), OR (or), AND (and), Samples:
10 WHILE (M_IN(1)=1) OR (M_IN(2)=1) ’beginning of repetition. The program is repeated until bit 1 or 2 signal appears in the digital input of the robot. When the signal from both inputs disappears, the repetition ends
… ’all for repeating
90 WEND ’end of repetition. When the conditions are satisfied, it jumps to the beginning of repetition
This instruction determines the end of the repetition fixed by conditions. Look at WHILE command for samples.
IF THEN ELSE
A process is selected and executed according to the results of an expression. Samples:
5 DLY 1 ’1 second delay before reading the robot input
10 IF M_IN(1)=1 THEN 100 ELSE GOTO 300 ’if input bit 1 value is 1 then jumps to the program row 100, but or not 1, then to row 300
30 IF M_IN(3) THEN Pabi=P2 ELSE Pabi=P3 ’if input bit 3 value is 1 then to position variable Pabi assigns the position P2 but or when not 1 that position P3
20 IF M_IN(4)<>1 THEN ’if input bit 4 is not 1 then...
… ’on positive result, is executed before ELSE program segment
50 ELSE ... ’on negative result, is executed after ELSE program segment 70 ENDIF ’end of IF sentence
This instruction calls up the subroutine at the designated line No, or line label. Be sure to return from the jump destination using the RETURN instruction. Samples:
100 GOSUB 300 ’jump to subroutine the row of which begins with number 300 110 END ’end of program 300 MOV P1 ’move the robot to position P1 310 RETURN ’end of the subroutine and jump to main program 100 GOSUB *LBL ’jump to subroutine with row designated *LBL 110 END ’end of program 300 *LBL ’row designated *LBL 310 MOV P1 ’move the robot to position P1 320 RETURN ’jump to subroutine where the row begins with number 320
When returning from a normal subroutine, return to the next line after the GOSUB. When returning from an interrupt processing subroutine, return either to the line where the interrupt was generated, or to the next line. For samples look at GOSUB command.
This instruction makes a program branch to the specified line number or label line unconditionally. Sample:
200 GOTO 300 ’jump to row with number 300 300 MOV P1 ’the robot moves to position P1 by using joint interpolation
200 GOTO *LBL ’jump to row designated *LBL 300 *LBL ’the row where the program jumps to. Designation of the row is
*LBL 310 MOV P1 ’the robot moves to position P1 by using joint interpolation
This instruction waits for the variable to reach the designated value. Samples:
40 WAIT M_IN(2)=1 ’program waits until input bit 2 will be 1 70 WAIT M1=100 ’program waits until the value of variable M1 is equal
This instruction defines the final line of the program. It is also used to indicate the end of the program explictly, by entering the END instruction at the end of the main processing, in case a sub program is attached after the main program. In the case of a sub program called up by the CALLP instruction, the control is returned to the main program when the END instruction is executed. Sample:
100 END ’ end of program
This instruction defines the pallet (3-point pallet, 4-point pallet). This command is used at the same time with the command PLT. The format of the command is:
DEF PLT <Pallet No>, <Start Point>, <End Point A>, <End Point B>, <Diagonal Point>, <Quantity A>, <Quantity B>, <Assignment Direction>
< Pallet No > - selection no. of the set pallet < Start Point > - refers to the pallet’s start point < End Point A > - one of the end points for the pallet < End Point B > - another end point for the pallet < Diagonal Point > - diagonal point from the pallet’s start point < Quantity A > - number of workpieces from the pallet’s start point to the end
point A < Quantity B > - number of workpieces from the pallet’s start point to the end
point B < Assignment Direction > - describes the direction of the number assignment when
numbering divides grid points
1 2 3
4 5 6
7 8 9
Start point End point A
End point B Diagonal point
1 2 3
7 8 9
Start point End point A
End point B Diagonal point
Fig. 3.15. Positions of pallets and numbers of grids in the pallet when zigzag (a) or the same direction (b) numbering methods are used
10 DEF PLT 1, P1, P2, P3, P4, 3, 4, 2 ’defines pallet no 1 by positions P1, P2, P3 and P4. Capacity of the pallet is 3 products in a row and 4 products in a column (maximum 12 products). The same direction numbering method is used.
20 DEF PLT 2, P2, P3, P4 ,P1, 2, 5, 1 ’defines pallet no 1 by positions P2, P3, P4, and P1. Capacity of the pallet is 2 products in a row and 5 products in a column (maximum 10 products). The zigzag numbering method is used.
This instruction calculates the position of the grid in the pallet. This command is used at the same time with the command DEF PLT. Samples:
30 Pabi = PLT 1, 2 ’calculated the position of grid no 2 in the pallet no 1 and assigned to variable Pabi
20 Pabi = PLT 2, 1 ’calculated the position of grid no 1 in the pallet no 2 and assigned to variable Pabi
60 Pabi = PLT 1, 4 ’calculated the position of grid no 4 in the pallet no 1 and assigned to variable Pabi
3.6 Sample of the Robot Control Program
The program is an example compiled for the robot which detects the colour of the detail and then places the details to the determined places. The control program is as follows:
100 DEF INT VARV ’declared numeric variable
110 MOV P99 ’robot moves to the neutral position
120 HOPEN 1 ’robot’s gripper opens
130 DLY 1 ’delay 1 second
140 WAIT M_IN(0) = 1 ’robot is waiting until the detail arrives to the colour detecting place
150 OVRD 75 ’ robot speed is 75% from the maximum
160 MOV P1 ’robot moves to the colour detecting place
170 DLY 0.5 ’delay 0.5 seconds
180 IF M_IN(1)=1 THEN VARV=1 ELSE VARV=0 ’the colour of the detail is detected. When the detail is black value 0 is assigned to variable VARV and when coloured, then 1
190 OVRD 20 ’ robot speed is 20% from the maximum
200 MVS P1,-40 ’robot lifts the gripper 4 cm higher
210 MOV P2,-40 ’robot moves above the detail
220 DLY 0.1 ’delay 0.1 seconds
230 MVS P2 ’robot moves down for gripping the detail
240 DLY 0.1 ’delay 0.1 seconds
250 HCLOSE 1 ’the gripper closes
260 DLY 1 ’delay 1 second
270 MVS P2,-30 ’robot lifts the detail 3 cm higher
280 OVRD 100 ’robot speed is at the maximum
290 MOV P99 ’robot moves to the neutral position
300 IF VARV=1 THEN GOTO 310 ELSE GOTO *MUST ’looks from which row to continue program execution. When the detail is black, then jumps to the row designated “*MUST”
310 MOV P3,-40 ’robot moves to coloured detail place
320 DLY 0.1 ’delay 0.1 seconds
330 MVS P3 ’robot drops the gripper 4 cm down
340 HOPEN 1 ’robot’s gripper opens
350 DLY 1 ’delay 1 second
360 MVS P3,-40 ’robot lifts the gripper 4 cm higher
370 GOTO *LOPP ’jump to the row designated *LOPP
390 MOV P4,-40 ’robot moves to black detail place
400 DLY 0.1 ’delay 0.1 seconds
410 MVS P4 ’robot drops the gripper 4 cm down
420 HOPEN 1 ’robot’s gripper opens
430 DLY 1 ’delay 1 second
440 MVS P4,-40 ’robot lifts the gripper 4 cm higher
460 MOV P99 ’robot moves to the neutral position
470 END ’end of program
On row 100 of the program the integer type of variable VARV is declared. The value related to the colour of the detail is assigned to the variable. It is necessary to declare all the variables at the beginning of the program.
On row 110 the robot is commanded to move to P99 position which belongs to the positions list. It is reasonable to choose position P99, as the robot may move to this position by the simplest way.
Fig. 3.16. The trajectory of the robot controlled by the given sample of a control program
On row 120 the command is to open the gripper. The gripper must be open when the robot is gripping the detail. For that reason on the next row there is a 1 second delay as the robot gripper will be opened accurately.
On row 140 the robot is waiting for the arrival of the detail. When the detail is on the right place, then the sensor changes number 0 in the input bit to 1 (bit numbering begins at 0). During the arrival of the detail the program moves to the next row. The speed of the robot is changed there. The speed of the robot is 75% from the maximum speed.
On row 160 the robot moves to the colour detecting place P1 which belongs to the positions list. On the next row the robot is stopped for 0.5 seconds to allow the colour detecting sensor will detect the detail.
On row 180 it is observed what kind of colour the sensor has detected. When the value of the first input bit is 1, then the coloured detail is detected and value 1 is assigned to variable VARV. But when the value of the first input bit is 0, then the black detail is detected and value 0 is assigned to variable VARV.
On row 190 the speed of the robot has been changed to 20% from the maximum speed. On the next two rows the robot moves above to the detail.
On row 220 there is a delay, as the robot accurately arrives to position P2-40. On the next two rows robot gripper drops to grip the detail.
On row 250 the robot is gripping the detail. On the next row there is a delay of 1 second, to allow the robot to grip the detail.
On row 270 the robot gripper is lifted 3 cm. On the next row the speed of the robot increases to the maximum.
On row 290 the robot moves to the zero point, wherefrom the robot may move to all positions that are in the position list.
On row 300 shows which row the execution of the program must continue. When the detail is black, then jump to the row where *MUST is written. The fragment of the program between the condition row and the row with designation *MUST was not executed. While the detail is of a different colour, then the execution of the program continues from the next row. Jump to the next row commands GOTO 310.
On row 310 the robot moves to the coloured detail releasing place. The delay on the next row makes it possible for the robot to arrive above the determined position. Then the robot gripper drops 4 cm and the gripper is opening. After that the robot is waiting up to 1 second so as to release the detail.
On row 360 the robot gripper is lifted 4 cm, not to collide with the detail placed on the ground when the robot is retreated from where the detail is placed. On the next row a program jumps to the row *LOPP, to avoid the down putting process of the black detail.
On row 380 there is the designation *MUST which determines the row where the program must jump when the detail is black.
On row 390 the robot moves to the black detail releasing place. The delay on the next row makes it possible for the robot to arrive above the determined position. Then the robot gripper drops 4 cm and the gripper is opening. After that the robot is waiting up to 1 second so as to release the detail.
On row 440 the robot gripper is lifted 4 cm not to collide with the detail placed on the ground when the robot is retreated from the detail releasing place.
On row 380 there is the designation *LOPP which determines the row where the program must jump to put down the coloured detail.
On row 460 the robot moves the the zero point.
The last row determines the end of the main program. On this row the robot arrives to the neutral position.
The used positions P1, P2, P3, P4 and P99 belong to the robot position list. The position added to the position list is described in chapter 3.7.
To simplify the program the DEF POS command is used. It is possible to eliminate the fragment of the program between the rows *MUST and *LOPP and then some other rows become unnecessary. This simplifying is a practical exercise for students.
3.7 Robot position list
The position list is recorded into the POS file on MELFA Basic IV programming language and into the PSL file on the universal robot programming language (IRL). Remember that the designation of the position list file must be the same that the designations of the robot control program file are.
A window of the robot position list is shown in Fig. 3.17. The designation of the position, coordinates, rotation angles, and comments are shown.
By the help of double click on the concrete position, the virtual robot moves in the 3D-show window to this position. When the position is out of the robot operating area, then the fault message appears.
The parameters of the positions on the position list are changeble. For that purpose a drop down menu (Fig. 3.18) must be opened on a certain position (chosen by the help of the right button of the mouse). Choose Properties from drop-down menu and the window Position List Entry (Fig. 3.18.) is opening. It is possible to determine the designation of a robot position which mostly consists of letter P and the position recording number. It is possible to change the coordinates X, Y,Z and rotating angles A and B. The column with asterisk is suitable for comments about the position of the robot.
Fig. 3.17. Robot position list and the drop-down menu
Fig. 3.18. Position parameter changing
The position of a robot is added via the position list by clicking on Jog Operation window (Figs. 3.6 and 3.8) button Current Position → Pos. List (section 3.3. Robot Model Controlling in the 3D-). The same function is usable by choosing the command Insert Position from drop-down menu. Then the instant position of the robot is recorded into the position list with another designation. The command Accept Position records the actual position of the robot into the position list by using the recently chosen designation of the position. The parameters of the position are overwritten.
To delete the robot position from the position list, choose the position and press the key Delete on the keyboard.
3.8 Program simulation
After writing the program and creation of the position list, the testing of the control program is done by the computer to find program errors.
Before starting the simulation, the program writing window must be chosen. Click on the icon Compile & link which checks the text of the program and download the program into the memory of virtual robot control device. If you did not click on icon Compile & link before starting the simulation, recently downloaded simulation program is starting.
The simulation of the program is possible row by row or the whole program at once. To start the simulation row by row, choose the command Next Step (this icon belongs to menu) from Execute menu.
To start the simulation of the whole program at once, choose the command Start (this icon belongs to menu) from Execute menu. Then the whole program until END command or first mistake (no position) will be executed. To stop the simulation, choose the command Stop (this icon belongs to menu) from Execute menu.
There is the command Start Cycle in Execute menu which simulates the program of the robot interminably or until the user stops the simulation.
During the simulation of the control program the row of the instantenous operation of the robot is shown in the program writing window.
Before starting every new simulation, the 3D-show window and the robot control program must be in the initial state. For that purpose choose the command Reset Workcell from Edit menu. When choosing the command Reset Program from Execute menu, the control program is directed to the beginning.
To detect collisions between the robot and the details, the collision detection regime must be activated. For that purpose choose Collision Detection regime from Execute menu. When the robot knocks at something (details, frames etc.), then the detail changes to violet colour (Fig 3.19).
Fig. 3.19. 3D-show window view before detecting the collision (a) and after that (b)
In industrial applications when sensors are used, the simulation of sensors must be turned on. It is necessary to obtain real information from sensors to the control device of the robot. For that purpose choose Sensor Simulation regime from Execute menu.
3.9 New element addition into the robot project
It is possible to add new elements, details, devices like sensor, interval wall, gripper etc. from COSIMIR Educational model data base to the robot application project. The model data base opens when choosing the command Model Libraries…from Execute menu. In the open window (Fig. 3.20 a), the following folders with different models are shown:
• ABB - Robots
• Fanuc - Robots
• KUKA - Robots
• Miscellaneous Grippers
• Miscellaneous LEDs
• Miscellaneous Materials
• Miscellaneous Mechanisms
• Miscellaneous Primitive
• Miscellaneous Robots
• Miscellaneous Sensors
• Miscellaneous Textures
• Mitsubishi - Robots
• Reis - Robots
• Siemens S5/S7 - PLC
• Staeubli - Robots
Fig. 3.20. Model Libararies window (a) after capacitive sensor choice (b)
Choosing Capacitive Sensor from Miscellaneous Sensors folder, the illustration of the model and technical information about the sensor are shown in the Model Libraries window (Fig. 3.20 b). Dimensions of the sensor and operating area are shown.
After choosing the model the illustration of this is shown in the 3D-show window when clicking the button Add in the Model Libraries window. To add the model to the project, only one click is needed.
Mostly it is necessary to move the model to the determined place in the 3D-show window. For that purpose choose Model Explorer from Execute menu. That open window (Fig. 3.21) allows for access to objects used for simulation, elements, materials, libraries, control device I/O, and luminary of 3D-show window.
Fig. 3.21. Model Explorer window
Every new model adding creates a new folder in the Objects folder with the designation of the new model. The added capacitive sensor model has the folder CapacitiveSensor in the Objects folder. Sometimes the changing of the model designations is necessary. For that purpose click on the folder by using the right button of the mouse. By using the drop-down menu (Fig. 3.22.) choose Rename. After that enter the new designation into the folder.
Fig. 3.22. Drop-down menu on the capacitive sensor model
To start to move the capacitive sensor, choose the folder in the 3D-show window by the help of the right button of the mouse. Choose the command Properties (Fig. 3.22) from drop-down menu. In the new window Properties for object choose the panel Position (Fig. 3.23). The coordinates of the position (X, Y and Z column) and rotation angles (Roll, Pitch and Yaw column) are given there. The numbers in the columns of coordinates and rotation angles can be changed by clicking on the buttons with the arrows. The column Increment makes it possible to determine the step of changing the coordinates by clicking on the arrows near the X, Y and Z column. Using the column Increment it is possible to determine the step of the rotation angle.
Fig. 3.23. changing the coordinates of the position and rotation angles
Fig. 3.24. Robot simulation window before (a) and after adding the capacitive sensor (b)
The capacitive sensors added into the model are useless when they are not connected with the digital input of the control device. For that use the Objects folder in the Model Explorer window folder of the robot model (RV-2AJ) and open the Inputs folder (Fig. 3.25). All the information about digital inputs of the control device (status are in use are not in use) is recorded there. Next, open the Outputs folder. The digital output in the folder must be dragged to the free digital input of the robot and released there (Fig. 3.26). By the help of this operation the capacitive sensor is connected with the input of the robot control device. Later, the sensor can be used to detect a certain object. The connection of a certain model input with the robot control device output is carried out by the help of dragging (drag the model input above to the robot output and release).
Fig. 3.25. Robot input list
Fig. 3.26. Connecting the capacitive sensor with the robot control device
Sometimes the models of the details required are not found in the data base. The models may be placed in the MOD files which are situated, for example, in C:\Program Files\didactic\COSIMIR Educational.GB\Models\MiscLibs folder. Such kind of models must be imported to robot application. For that purpose choose the 3D-show window, then the command Import…from File menu. The file MOD must be found in the open window and then press the key OK. After that the model in the MOD file is added to the 3D-show window.