July 19, 2019, 04:48:58 PM
Robotforum | Industrial Robots Community

  How to add a heart beat in the sps

hot_post Author Topic:   How to add a heart beat in the sps  (Read 544 times)

0 Members and 1 Guest are viewing this topic.

July 13, 2019, 02:09:00 AM
Read 544 times
Offline

plustandard


Dear all.
In a simple case, I have done the palletizing with kuka kr5 krc4.
Everything runs well. But my customer want an output during the program running.
They want an heart beats (1 rise up / sec.)when the robot is running my program.
How can I do that? I mean I do not know how to write the code.

Today at 04:48:58 PM
Reply #1

Advertisement

Guest

July 13, 2019, 05:40:13 AM
Reply #1
Online

panic mode

Global Moderator
get your hands on programming manual for system integrators and system variables manual. check variables like $TIMER, $PRO_IP, $PRO_STATE etc. i would suggest creating own expert module and test it in robot interpreter. once everything works, just link it with Submit.
1) http://www.robot-forum.com/robotforum/kuka-robot-forum/read-first/
2) if you want reply about robot, post it in forum
3) read 1 and 2

July 13, 2019, 08:47:14 PM
Reply #2
Offline

Casius


Hello,
You can make a logic like:
If ($pro_act==true and ($date.sec-($date.sec/2)*2==0)) then
Beat=true
else
Beat=false
endif

$pro_act --This output is set whenever a process is active at robot level
($date.sec-(-$date.sec/2)*2==0) is $date.sec modulo 2==0, read the clock and for 1 sec you will have a beat.

Maybe you will have to modify the modulo syntax but is a tip.





July 14, 2019, 03:07:27 AM
Reply #3
Online

panic mode

Global Moderator
do they need to know if some program is running or they want info on specific program?

July 15, 2019, 04:58:20 AM
Reply #4
Offline

plustandard



Thanks Casius
I try your code this morning, I found that the $date.sec is error. Seems there is no system Variables named $date.sec
Can you tell me more.
Sorry I do not make a systematic study of kuka program. Just study how to make code by reading others.
« Last Edit: July 15, 2019, 05:21:05 AM by plustandard »

July 15, 2019, 05:12:10 AM
Reply #5
Offline

plustandard



Thanks your help Panic mode
I followed the tips from you and Casius.
Yes,I need to know which program is running, and what is the current status of the robot.

I make some code like this.
Code: [Select]
IF ($MODE_OP==#AUT) And ($pro_state==#P_Active) and THEN ;make sure the program is running, then start the heart beat
  $timer[3]=0 
  $TIMER_STOP[3]=FALSE
  IF $TIMER[3]>1000 THEN ;the time can not use "=="to check the current data, I can only make sure it is more then 1000ms
    $out[3]=TRUE 
  ENDIF
  IF $TIMER[3]>2000 THEN
    $out[3]=FALSE
    $TIMER[3]=0
  ENDIF
ENDIF

But I meet a new problem. I put the code in sps. The kuka rise up a error "sps is read protect only"
What's wrong on my code??
« Last Edit: July 15, 2019, 05:18:47 AM by plustandard »

July 15, 2019, 12:58:00 PM
Reply #6
Online

panic mode

Global Moderator
those are two separate questions




this has nothing to do with code. simply file is protected. if you want to edit it, you need to remove write protection.
this usually means checking and changing file attributes.
in case of KSS8.3 with installed MultiSubmit, SPS tasks must be cancelled manually before editing.




few things, both logic and syntax

Today at 04:48:58 PM
Reply #7

Advertisement

Guest

July 17, 2019, 12:42:54 AM
Reply #7
Offline

plustandard


I put the code in sps. The kuka rise up a error "sps is read protect only"


this has nothing to do with code. simply file is protected. if you want to edit it, you need to remove write protection.
this usually means checking and changing file attributes.
in case of KSS8.3 with installed MultiSubmit, SPS tasks must be cancelled manually before editing.




few things, both logic and syntax

Hello Panic mode.
Finally, I want to share my solution.
For the sps. I modified it in workvisual(actully,modified the sps in expert mode is ok).
And I found that can not use some system variables. like:$mode_op and $pro_start etc.
But we can do it like this:
Code: [Select]
;ADD codes in SPS between LOOP and ENDLOOP
$TIMER[3]=0
$TIMER_STOP[3]=FALSE
LOOP
.
.
.
HB_1( )
.
.
.
ENDLOOP

Code: [Select]
;create a sub program
DEF HB_1( )
IF ($MODE_OP==#AUT) OR ($MODE_OP==#T2) THEN
    IF $TIMER[3]>1000 THEN
        $OUT[6]=TRUE
    ENDIF

    IF $TIMER[3]>2000 THEN
        $OUT[6]=FALSE
        $TIMER[3]=0
    ENDIF

ELSE
    $OUT[6]=FALSE
ENDIF

« Last Edit: July 17, 2019, 12:54:20 AM by plustandard »

July 17, 2019, 01:00:25 PM
Reply #8
Offline

SkyeFire

Global Moderator
I can offer a slightly more compact method of making a heartbeat, just for the heck of it: 
Code: [Select]
$TIMER[1] = -1000
$TIMER_STOP[1] = FALSE ; these lines go in the INI section of the SPS

LOOP ; the built-in Loop section of the SPS

  ; add this to the User section of the SPS loop
  IF $TIMER_FLAG[1] THEN ; True whenever Timer>=0
    $OUT[1] = NOT $OUT[1] ; invert signal state
    $TIMER[1] = -1000
  ENDIF

ENDLOOP

July 17, 2019, 04:19:00 PM
Reply #9
Online

panic mode

Global Moderator


All variables can be used. That is the whole point to have them.
If that was not possible, they have no reason to exist.
you actually use $MODE_OP in your own example.


there may be limitations in terms of scope or access type but ALL variables can be used.

Yesterday at 12:12:32 PM
Reply #10
Offline

the leg


$TIMER[1] = -1000
$TIMER_STOP[1] = FALSE ; these lines go in the INI section of the SPS

LOOP ; the built-in Loop section of the SPS

  ; add this to the User section of the SPS loop
  IF $TIMER_FLAG[1] THEN ; True whenever Timer>=0
    $OUT[1] = NOT $OUT[1] ; invert signal state
    $TIMER[1] = -1000
  ENDIF

ENDLOOP [/code]



Or in 1 line in the sps

$out[100]= ($date.sec-($date.sec/2)*2==0) AND $PRO_ACT AND $EXT

:-)
« Last Edit: Yesterday at 12:29:17 PM by the leg »

Yesterday at 01:11:52 PM
Reply #11
Online

panic mode

Global Moderator
nice but still it only tells that some program is running, not a specific one.  :icon_wink:

Yesterday at 01:31:03 PM
Reply #12
Offline

the leg


some [/i]program is running, not a specific one.  :icon_wink:

True he would need to a variable maybe to his module but i liked the one line :-)

Yesterday at 02:08:40 PM
Reply #13
Offline

SkyeFire

Global Moderator
I can offer a slightly more compact method of making a heartbeat, just for the heck of it: 
Code: [Select]
$TIMER[1] = -1000
$TIMER_STOP[1] = FALSE ; these lines go in the INI section of the SPS

LOOP ; the built-in Loop section of the SPS

  ; add this to the User section of the SPS loop
  IF $TIMER_FLAG[1] THEN ; True whenever Timer>=0
    $OUT[1] = NOT $OUT[1] ; invert signal state
    $TIMER[1] = -1000
  ENDIF

ENDLOOP



Or in 1 line in the sps

$out[100]= ($date.sec-($date.sec/2)*2==0) AND $PRO_ACT AND $EXT

:-)
[/quote]
Yabbut, that only works for a 0.5Hz waveform.  Which, I admit, is what the OP asked for, so... you win.    :guru:

Today at 04:48:58 PM
Reply #14

Advertisement

Guest

Yesterday at 02:12:30 PM
Reply #14
Offline

the leg



Yesterday at 02:45:58 PM
Reply #15
Online

panic mode

Global Moderator
really? how is 0.5Hz equal to "1 rise per second"?
0.5Hz<>1Hz  :fish:

Yesterday at 04:25:49 PM
Reply #16
Offline

SkyeFire

Global Moderator
some [/i]program is running, not a specific one.  :icon_wink:

Hm.  I once did something along those lines using $PRO_IP.SI0x.NAME[], where the 'x' represents the level of the call stack.  Depending on whether the program the OP wants to identify is reliably at a known level (SI02, SI05, etc), it might be necessary to create a subroutine that can search through the stack looking for a string match.

Yesterday at 04:27:48 PM
Reply #17
Offline

SkyeFire

Global Moderator

Unless I'm missing something, as written, the output only goes True when the $DATE.SEC value is an even number.  That would generate one positive edge every 2sec, for 0.5Hz.

Yesterday at 05:22:33 PM
Reply #18
Online

panic mode

Global Moderator
that is correct but OP stated rise once per second so - 1Hz was expected but 0.5Hz was demonstrated.
just being stickler ...   :icon_wink:


Share via facebook Share via linkedin Share via pinterest Share via reddit Share via twitter

xx
Soft Robot helps the Heart beat

Started by karthikaqpt on other Robots

0 Replies
971 Views
Last post January 19, 2017, 11:25:11 AM
by karthikaqpt
xx
KRC1 RS232...do not beat me

Started by axv6l on KUKA Robot Forum

3 Replies
1601 Views
Last post July 09, 2016, 08:35:28 AM
by axv6l