How to check for BOOL signal status over a specified time period

  • Hi everybody,


    System information:

    • KSS 8.7.3
    • HMI V 8.7 B442
    • Kernel system version KS V8.7.441
    • WorkVisual V6.0.22
    • KR C5 micro controller
    • KR 4 R600 robot

    I have an application, where I want to grip an object with a vacuum gripper (I do not have GripperSpotTech, just fyi). There is a vacuum sensor attached, which is supposed to record if vacuum has been lost, i.e. the object has been dropped accidentally or the vacuum is faulty. The signal is a BOOL, where a high signal means vacuum is on, and the object has been gripped, while a low signal means no vacuum has been established and hence no object has been gripped/the object has been dropped. As of now, the sensor is very sensitive despite setting the sensitivity way down, which means that small fluctuations in the signal occurs during movement of the robot arm, so the sensor will say the object has been dropped even though it is in fact still in the gripper.


    I am monitoring the sensor via a couple of interrupts, which will be triggered, if the object has been gripped (LOW-->HIGH), and if the object has been dropped (HIGH-->LOW). Right now, I'm just sending a warning to the PLC whenever the interrupt is triggered. However, to avoid falsely detecting that the bag has been dropped, I have to look at the signal over a period of time to see if it remains LOW or if the interrupt was triggered on a false-positive fluctuation.


    I was thinking that I'd like to start a timer once the interrupt is triggered and then check the signal again after the timer has run out, to see if it is still LOW, but I don't know the best way to do so without interfering with the motions of the main program.


    Does anybody have a suggestion on how this is best done?


    TIA!

  • First of all you want reliable signal. If the sensor you have is giving you false readings, it is not a bad idea to look for a substitute.

    If the glitches are brief, use debouncing to produce stable signal. And rest of the code (interrupts or whatever) should ,only use the debounced signal.

    1) read pinned topic: READ FIRST...

    2) if you have an issue with robot, post question in the correct forum section... do NOT contact me directly

    3) read 1 and 2

  • One possibility is something like this


    Signal vac $IN[666]

    Decl boolvvac_stablw




    $timer_stop[1]=false

    If vac==false then

    $timer[1]=0

    Endif

    Vac_stable=$timer[1]>650: ms

    1) read pinned topic: READ FIRST...

    2) if you have an issue with robot, post question in the correct forum section... do NOT contact me directly

    3) read 1 and 2

Advertising from our partners