![]() |
![]() |
![]() |
Intro:
At some point I asked myself the question, whether you could enter values via the keyboard on the KCP in a running KRL program and process these values. The answer is YES and this functionality runs at Kuka under the term of 'user messages'.
User messages:
Kuka distinguishes 4 types of user messages, including the type "query". With this type it is possible to read values. This is described quite well in the following document. There is even an example program called MSG_DEMO.src on the KRC1 in the TP directory, in which all four message types are presented, BUT ...
The program regularly got stuck in one of the "WHILE $MSG.VALID" loops.
A search in the robot forum quickly revealed that this is a known bug,
but unfortunately the described solution with the counter did not work for me.
The program ran wonderfully in the "Incremental Step" mode,
so it looked like in automatic mode something was going to fast for the controller.
After endless trials & errors with WAIT instructions, a WAIT SEC 0.2
behind the definition of the message type brought the breakthrough. Below you find my version of the MSG_DEMO program,
that's running smoothly for me. (KRC1 v4.1.7 SP08)
Program:
&ACCESS RVP
&COMMENT Example on user messages
DEF msg_demo_vLoulli( )
DECL INT ANSWER, OFFSET
DECL STATE_T STATE
DECL MSG_T EMPTY_MSG
;---------------------Acknowledgement-Message----------
;The programm is stopped until this message is acknowledged over the
softkeys.
EMPTY_MSG={MSG_T: VALID FALSE,RELEASE FALSE,TYP #NOTIFY,MODUL[] "
",KEY[] " ",PARAM_TYP #VALUE,PARAM[] " ",DLG_FORMAT[]
" ",ANSWER 0}
$MSG_T=EMPTY_MSG
$MSG_T.KEY[]="DEMO1: Acknowledgement%1" ;%1 will be replaced
by $MSG_T.PARAM[]
$MSG_T.PARAM[]="-Message"
$MSG_T.PARAM_TYP=#VALUE
$MSG_T.TYP=#QUIT
WAIT SEC 0.2 ;mandatory to solve a bug with unreleased status messages
$MSG_T.VALID=TRUE
WHILE $MSG_T.VALID
WAIT SEC 0.05
ENDWHILE
;---------------------Status-Message----------
;This message should disappear after it is released.
EMPTY_MSG={MSG_T: VALID FALSE,RELEASE FALSE,TYP #NOTIFY,MODUL[] "
",KEY[] " ",PARAM_TYP #VALUE,PARAM[] " ",DLG_FORMAT[]
" ",ANSWER 0}
$MSG_T=EMPTY_MSG
$MSG_T.KEY[]="DEMO2: Status-Message"
$MSG_T.TYP=#STATE
WAIT SEC 0.2 ;mandatory to solve a bug with unreleased status messages
$MSG_T.VALID=TRUE
WAIT SEC 4 ;the status-message should disappear after this delay
$MSG_T.RELEASE=TRUE
WAIT SEC 0.5 ;mandatory to help reducing a bug with unreleased status
messages
;-------------------Dialog-Query----------------
;This message allows user reply over the softkeys.
EMPTY_MSG={MSG_T: VALID FALSE,RELEASE FALSE,TYP #NOTIFY,MODUL[] "
",KEY[] " ",PARAM_TYP #VALUE,PARAM[] " ",DLG_FORMAT[]
" ",ANSWER 0}
$MSG_T=EMPTY_MSG
$MSG_T.KEY[]="DEMO3: DIALOG-Message, Please choose one of the below
options:"
$MSG_T.DLG_FORMAT[]="A|B|C"
$MSG_T.TYP=#DIALOG
WAIT SEC 0.2 ;mandatory to solve a bug with unreleased status messages
$MSG_T.VALID=TRUE
WHILE ($MSG_T.VALID==TRUE)
WAIT SEC 0.05
ENDWHILE
ANSWER=$MSG_T.ANSWER
;---------------------Notification-Message----------
;This message is displayed until it is acknowledged but the programm
is not stopped.
EMPTY_MSG={MSG_T: VALID FALSE,RELEASE FALSE,TYP #NOTIFY,MODUL[] "
",KEY[] " ",PARAM_TYP #VALUE,PARAM[] " ",DLG_FORMAT[]
" ",ANSWER 0}
$MSG_T=EMPTY_MSG
OFFSET=0
;SWRITE converts ANSWER to a string and represents also an alternative
to using $MSG_T.PARAM[]
SWRITE($MSG_T.KEY[],STATE,OFFSET,"DEMO4: Notification, The previously
chosen option was number: %d",ANSWER)
$MSG_T.TYP=#NOTIFY
WAIT SEC 0.2 ;mandatory to solve a bug with unreleased status messages
$MSG_T.VALID=TRUE
END
Download:
![]() |
![]() |
msg_demo_vLoulli.src | KUKA_User_Messages_Programming.pdf |
Disclaimer of liability:
The present project requires specialist knowledge. Reproduction at your own risk and liability.