In ROBOGUIDE help, there is an example program (B.4 PTH_MOVE) which references a PATH variable, pth1. Unfortunately, this example is incomplete in that the TP components (PTH_SUB) of this example are not included. My question is how do I set up a PATH variable and properly initialize it such that it would satisfy the requirements of the PTH_MOVE example.
PATH variable initialization
-
BitBucketBob -
February 10, 2014 at 1:11 PM -
Thread is Resolved
-
-
I have the same problem, help me
-
so help -> Contents.
Which section is this example under? I'll take a look at it.
-
i use the following program to test the path move, and it works.
--This program checks to determine if PATH variables are taught or not. If the paths are taught, the
--robot moves TO a JOINT POSITION AND THEN loops ALONG a PATH 5 times.
--This example also sets up two global condition handlers.
--? The first CONDITION handler detects IF the user has pushed a teach pendant key, AND IF so aborts the
--PROGRAM.
--? The second CONDITION handler sets a variable WHEN the PROGRAM is aborted.
------------------------------------------------------------------------------
---- Section 1: Program and Environment Declaration
------------------------------------------------------------------------------
PROGRAM PTH_MOVE -- Define the program name
%ALPHABETIZE -- Create the variables in alphabetical order
%COMMENT = 'PATH MOVES'
%ENVIRONMENT PATHOP -- Necessary for PATH_LEN
%ENVIRONMENT SYSDEF -- Necessary for using the $MOTYPE in the MOVEs
%ENVIRONMENT UIF -- Necessary for SET_CURSOR
------------------------------------------------------------------------------
---- Section 2: Constant and Variable Declarations
------------------------------------------------------------------------------
CONST
CH_ABORT = 1 -- Number associated with the abort Condition handler
CH_F1 = 2 -- Number associated with the F1 key Condition handler
CH_F2=3
VAR
STATUS :INTEGER -- Status from built-in calls
loop_pth :INTEGER -- Used in a FOR loop counter
prg_abrt :BOOLEAN -- Set when program is aborted
pth1 :PATH
strt_jnt :JOINTPOS6 -- starting position of a move
via_pos :XYZWPR -- via point for a circular move
des_pos :XYZWPR -- destination point
real_ary :ARRAY[6] OF REAL -- This is used for creating a joint position with 6 axes
indx :INTEGER -- FOR loop counter
------------------------------------------------------------------------------
---- Section 3: Routine Declaration
------------------------------------------------------------------------------
---- Section 3-A: RANDOM Declaration
---- ROUTINE TP_CLS FROM ROUT_EX -- ROUT_EX must also be loaded.
------------------------------------------------------------------------------
------------------------------------------------------------------------------
---- Section 3-B: YES_NO Declaration
---- Display maximum elements of ary_nam.
--- Display choices on the function line of the TP.
---- Asks for user response.
--- F1 key is monitored by the Global condition handler
---- [CH_F1] and the F2 is monitored here.
---- If F1 is pressed the program will abort.
--- But, if the F2 is pressed the program will continue.
------------------------------------------------------------------------------
ROUTINE tp_cls FROM rout_ex -- ROUT_EX must also be loaded.
ROUTINE YES_NO
BEGIN
WRITE TPFUNC (CHR(137)) -- Home Cursor in Function window
WRITE TPFUNC (' ABORT CONT') -- Display Function key options
WAIT FOR TPIN[131] -- Wait for user to respond to continue.
-- If the user presses F1 (abort) condition handler CH_ABORT will abort program.
WRITE TPFUNC (CHR(137)) -- Home Cursor in Function window
WRITE TPFUNC (' ABORT',CHR(129)) -- Redisplay just Abort option and
-- clear rest of Function window
END YES_NO
-----------------------------------------------------------------------------
---- Section 4: Main Program
-----------------------------------------------------------------------------
BEGIN -- PTH_MOVE
-----------------------------------------------------------------------------
---- Section 4-A: Global Condition Handler Declaration
-----------------------------------------------------------------------------
CONDITION[CH_ABORT]:
WHEN ABORT DO -- When the program is aborting set prg_abrt flag.
-- This will be triggered if this program aborts itself
-- or if an external mechanism aborts this program.
prg_abrt = TRUE -- You may then have another task which detects
-- prg_abrt being set, and does shutdown operations
-- (ie: set DOUT/GOUT's, send signals to a PLC)
ENDCONDITIONCONDITION[CH_F1]:
WHEN TPIN[129] DO -- Monitor TP 'F1' Key. If 'F1' key is pressed,
ABORT -- abort the program.
ENDCONDITIONCONDITION[CH_F2]:
WHEN TPIN[131] DO -- Monitor TP 'F2 Key. If 'F1' key is pressed,
CONTINUE
ENDCONDITIONprg_abrt = FALSE -- Initialize variable which is set only IF
-- the program is aborted and CH_ABORT is enabled.
--ENABLE CONDITION[CH_ABORT] -- Start scanning abort condition as defined.
--ENABLE CONDITION[CH_F1] -- Start scanning F1 key condition as defined.
--ENABLE CONDITION[CH_F2]
-----------------------------------------------------------------------------
---- Section 4-B: Display banner message and wait for users response
-----------------------------------------------------------------------------
TP_CLS -- Routine Call; Clears the TP USER menu, and forces the TP USER menu to be visible.SET_CURSOR(TPDISPLAY,2,13, STATUS) -- Set cursor position in TP USER menu
IF (STATUS <> 0 ) THEN -- Verify that SET_CURSOR was successful
WRITE ('SET_CURSOR built-IN failed WITH STATUS = ',STATUS,CR)
YES_NO -- Ask whether to quit, due to error.
ENDIF
--- Write heading in REVERSE video, then turn reverse video off
WRITE (CHR(139),' PLEASE READ ',CHR(143),CR)
WRITE (CR,' *** F1 Key is labelled as ABORT key *** ')
WRITE (CR,' Any TIME the F1 key is pressed the PROGRAM')
WRITE (CR,' will ABORT. However, the F2 key is active ')
WRITE (CR,' only WHEN the function key is labeled.',CR,CR)
YES_NO -- Wait for user response
----------------------------------------------------------------------------
---- Section 4-C: Verify PATH variable, pth1, has been taught
------------------------------------------------------------------------------ Check the number of nodes in the path
IF PATH_LEN(pth1) = 0 THEN -- Path is empty (has no nodes)
WRITE ('You need TO teach the PATH.',CR) -- Display instructions to user
WRITE ('BEFORE executing this PROGRAM.',CR)
WRITE ('Teach the PATH variable pth1', CR, ' AND restart the PROGRAM',CR)
ABORT -- Simply ABORT the task
-- do not continue since there
ENDIF -- are no nodes to move to
----------------------------------------------------------------------------
---- Section 4-D: Creating a joint position and moving along path's
----------------------------------------------------------------------------
FOR indx = 1 TO 6 DO -- Set all joint angles to zero
real_ary[indx] = 0.0
ENDFORreal_ary[5] =- 90.0 -- Make sure that the position is NOT AT a singularity point.
CNV_REL_JPOS(real_ary, strt_jnt, STATUS) -- Convert real_ary values into
-- a joint position, strt_jnt
IF (STATUS <> 0 ) THEN -- Converting joint position was NOT successful
WRITE ('CNV_REL_JPOS built-IN failed WITH STATUS = ',STATUS,CR)
YES_NO -- Ask user if want to continue.
ELSE -- Converting joint position was successful.
-- The start position, strt_jnt, has been created and is located at
-- axes 1-4 = 0.0, axes 5 = 90.0, axes 6 = 0.0.
via_pos = strt_jnt -- Copy the strt_jnt to via_pos
via_pos.x = via_pos.x +10 -- Add offset to the x location
via_pos.y = via_pos.y +10 -- Add offset to the y location
-- The via position, via_pos, has been created to be the same position
-- as strt_jnt except it has been offset in the x and y locations by
-- 200 mm.
des_pos = strt_jnt -- Copy the strt_jnt to des_pos
des_pos.x = des_pos.x +20 -- Add offset to the x location
-- The destination position, des_pos, has been created to be the same
-- position as strt_jnt except it has been offset in the x location by
-- 200 mm.
MOVE TO strt_jnt -- Move to the start position
WRITE (CR,'Moving TO Destination POSITION',CR)
WITH $MOTYPE = CIRCULAR MOVE TO des_pos VIA via_pos
-- Move robot to destination
-- position using circular motion
-- via the via_pos
ENDIF--- Execute the same path for 5 times.
FOR loop_pth = 1 TO 5 DO
WRITE ('Moving ALONG pth1 ',loop_pth::2, ' times',CR)
-- Display the loop iteration
-- NOTICE: that "loop_pth::2" will cause 2 blanks to be
-- displayed after "pth1 '" and before loop_pth.
MOVE TO pth1[1].node_pos
MOVE TO pth1[2].node_pos
ENDFOR
WRITE TPFUNC (CHR(128),CHR(137)) -- Home Cursor and Clear to
-- End-of-line. This will remove
-- the ABORT displayed above F1.
WRITE ('pth_move Successfully Completed',CR)
END PTH_MOVE