Home > arte3.2.0 > RAPID > programs > beta > test_packaging.m

test_packaging

PURPOSE ^

This script demonstrates an alternative definition of the target

SYNOPSIS ^

function test_packaging

DESCRIPTION ^

 This script demonstrates an alternative definition of the target
 points defines the target points by separate fields

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 % This script demonstrates an alternative definition of the target
0002 % points defines the target points by separate fields
0003 
0004 % IN ORDER TO SIMULATE THE PROGRAM:
0005 %   A) FIRST, LOAD A ROBOT
0006 %       robot = load_robot('abb','irb140');
0007 %   B) NEXT, LOAD SOME EQUIPMENT.
0008 %       robot.equipment = load_robot('equipment','tables/table_small');
0009 %       OR
0010 %       robot.equipment = load_robot('equipment','bumper_cutting');
0011 %   C) NOW, LOAD AN END TOOL
0012 %       robot.tool= load_robot('equipment','end_tools/parallel_gripper_0');
0013 %   D) FINALLY, LOAD A PIECE TO GRAB BY THE ROBOT
0014 %       robot.piece=load_robot('equipment','cylinders/cylinder_tiny');
0015 %
0016 %   E) IF NECESSARY, CHANGE THE POSITION AND ORIENTATION OF THE ROBOT'S
0017 %   BASE
0018 %       robot.piece.T0= [1 0 0 -0.35;
0019 %                        0 1 0 -0.55;
0020 %                        0 0 1 0.2;
0021 %                        0 0 0 1];
0022 %
0023 % during the simulation, call simulation_open_tool; to open the tool and
0024 % simulation_close_tool; to close it.
0025 % To grip the piece, call simulation_grip_piece; and
0026 % simulation_release_piece to release it.
0027 % The call to each function must be correct, thus, typically the correct
0028 % sequence is:
0029 
0030 % simulation_open_tool;
0031 % approach the piece to grab.
0032 % simulation_close_tool;
0033 % simulation_grip_piece; --> the piece will be drawn with the robot
0034 % move to a different place
0035 % simulation_open_tool;
0036 % simulation_release_piece
0037 
0038 function test_packaging
0039 pieza_presente=1;
0040 pieza_correcta=0;
0041 
0042 simulation_open_tool;
0043 
0044 % ningun eje externo conectado
0045 ejes_ext = [9E9, 9E9, 9E9, 9E9, 9E9, 9E9];
0046 
0047 % posicion y orientacion de reposo para el robot
0048 pos_reposo = [0.5, 0.0, 0.35];
0049 ori_reposo = [0.7071, 0.0, 0.7071, 0.0];
0050 conf_reposo = [0, 0, -1, 1];
0051 rob_reposo = [pos_reposo, ori_reposo, conf_reposo, ejes_ext];
0052 
0053 %posicion y orientacion de agarre de la pieza sobre la cinta
0054 pos_cinta = [0.7, 0.0, 0.35];
0055 ori_cinta = [0.7071, 0.0, 0.7071, 0.0];
0056 conf_cinta = [0, 0, -1, 1];
0057 rob_cinta = [pos_cinta, ori_cinta, conf_cinta, ejes_ext];
0058 
0059   % posición y orientación de descarga de pieza correcta
0060 pos_correcta = [0.3, 0.4, 0.25];
0061 ori_correcta = [0.4, -0.5, 0.5, 0.5];
0062 conf_correcta = [0, 0, -1, 1];
0063 rob_correcta = [pos_correcta, ori_correcta, conf_correcta, ejes_ext];
0064   
0065 pos_defect = [0.3, -0.4, 0.25];
0066 ori_defect = [0.4, 0.5, 0.5, -0.5];
0067 conf_defect = [-1, -1, 0, 1];
0068 rob_defect = [pos_defect, ori_defect, conf_defect, ejes_ext];
0069 
0070 % herramienta utilizada (pinza)
0071 pinza_robhold = 1;%TRUE;
0072 pinza_tframe = [[0.0, 0.0, 0.120], [1, 0, 0, 0]];
0073 pinza_tload = [1.5, [0.0, 0.0, 0.60], [1, 0, 0, 0], 0.01, 0.01, 0.01];
0074 pinza = [pinza_robhold,pinza_tframe, pinza_tload];
0075 
0076 
0077 simulation_open_tool;
0078 %  PROC main()
0079 MoveJ(rob_reposo,'vmax','z5', pinza, 'wobj0');%v200
0080 
0081 % espera hasta tener una pieza disponible
0082 %    WaitDI pieza_presente, 1;
0083 
0084 % desplazamiento hacia la pieza, lento y con maxima precision
0085 MoveL(rob_cinta,'vmax','z5', pinza,  'wobj0');%v50
0086 
0087 simulation_grip_piece;
0088 simulation_close_tool;
0089 % activa pinza y espera 1 segundos
0090 %Set(do1);
0091 WaitTime(1);
0092     
0093 if (pieza_correcta==1)
0094     % desplazamiento a caja piezas correctas, rapido y poco preciso
0095      MoveL(rob_correcta, 'vmax', 'z5', pinza,  'wobj0'); %v200
0096 
0097 else
0098       % desplazamiento a caja piezas defectuosas, rapido y poco preciso
0099       MoveL(rob_defect, 'vmax', 'z5', pinza,  'wobj0'); %v200
0100 end
0101 
0102 simulation_open_tool;
0103 simulation_release_piece;
0104 
0105 % se abre la pinza y se esperan dos segundos
0106 %Reset(cerrar_pinza);
0107 WaitTime(1);
0108     
0109 
0110 
0111     
0112 
0113

Generated on Fri 03-Jan-2014 12:20:01 by m2html © 2005