Welcome, Guest. Please login or register.
Did you miss your activation email?
December 03, 2008, 09:31:14 PM
Home Help Search Calendar Login Register
News: Any Problems or Experience with Industrial Robots ?
Register and place your Question to worldwide Robotexperts right here !

+  Robotforum | Support for Robotprogrammer and Users
|-+  Robot Help and Discussion Center
| |-+  KUKA Robots (Moderators: Werner Hampel, kai_n, MartinH)
| | |-+  Stopping the robot on some events
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] 2 Print
Author Topic: Stopping the robot on some events  (Read 847 times)
karel
Newbie
*
Offline Offline

Posts: 6


« on: September 04, 2008, 02:09:34 AM »

Hi,

I would like to be able to stop the robot when some events occur. Let me explain my problem a little bit more. When a certain BOOL global variable (lets call it 'foo') has the value false AND $IN[30] has the value true, I want the robot to stop exactly where it is. Then the user would have to acknoledge when the states of those values changes. I don't want to use a PLC and I want it to be effective in T1, T2 and Auto mode. I tried putting an IF condition in the submit inside the loop looking at those 2 variables but nothing worked (with BRAKE and HALT statement, ex.: IF ((NOT foo) AND ($IN[30])) THEN ...). I also tried using an interrupt, but my problem is that because I am looking at 2 values, I cannot use a $CYCFLAG inside the submit as it is read only once when the submit load. I also tried using an acknoledge message inside the submit but then the submit stays on that instruction as long as the message is there and doesn't continue to do the other stuff it is suppose to do (as a software PLC). I also tried to put the code inside a global function so that the function is called within the submit but it doesn't make any difference.

Does anybody have a suggestion?

Logged
jseger
Jr. Member
**
Offline Offline

Posts: 94



« Reply #1 on: September 04, 2008, 01:24:26 PM »

i understand your question, but i have no solution right now.  i'll have to think about that because i'd like to do a similar thing.

Logged
Jim Tyrer
Global Moderator
Sr. Member
*****
Offline Offline

Gender: Male
Posts: 394


If all else fails, read the manual.


« Reply #2 on: September 04, 2008, 07:48:46 PM »

Had an app once where I wanted to be able to stop motion when a spring-loaded flange on EOAT was compressed enough to make a sensor.
Perhaps this would help.

In the program that was to be interrupted I put code like:

    INTERRUPT DECL 1 WHEN crashSensor == TRUE DO ABORT( )   ; in USER INI fold

DEF motions()
   INTERRUPT ON 1       ;& enable the crash sensor IRQ
   LIN target              ;& abort if crashSensor
END                        ;& of motions

DEF ABORT ( )
  INTERRUPT OFF 1
  BRAKE
  RESUME
END                         ;&of abort
Logged
Andicot
Newbie
*
Offline Offline

Posts: 25


« Reply #3 on: September 04, 2008, 11:55:43 PM »

You can declare the interrupt for IN[30] that call a subroutine with brake and halt

In sps you can enable or disable the interrupt looking the variable foo

if foo==true then
 interrupt on 1
else
 interrupt off 1
endif

Other solution is to chek the variable inside the subroutine called by interrupt

if foo==true then
 brake
 halt
else
 resume
endif
Logged
SkyeFire
Full Member
***
Online Online

Posts: 157


« Reply #4 on: September 05, 2008, 12:01:57 AM »

The BRAKE command is what you need to interrupt motion w/o stopping program execution, but BRAKE will only function inside a subroutine called by an interrupt (interrupts and BRAKE have some weird rules, there are other postings in the forum covering them).

My initial off-the-cuff suggestion would be to set up a $CYCFLAG to match the condition you're looking for (IF (NOT FOO) AND $IN[30]), and set the interrupt to trigger on the $CYCFLAG. 

One tricky bit will be making sure that your interrupt/BRAKE setup only cancels one motion, and making sure that the robot can safely move to the next point regardless of where the interrupt stopped it.  For example, if you have 3 points A,B,C, like so:

A
|
|
B-----C

And you BRAKE the robot in between A and B, when you pick up moving again the robot will *not* move to B, it will move directly to C from wherever the interrupt stopped it.  You'll need to take steps to handle this.
Logged
karel
Newbie
*
Offline Offline

Posts: 6


« Reply #5 on: September 05, 2008, 03:11:37 AM »

Hi all,

Jim Tyrer: Thanks for the suggestion, but my problem is that I want this to be effective anywhere and anytime. So I cannot put it in a single program. That's why I was thinking of using the submit. Secondly, I have 2 variables to check, so in order to use it with an interrupt, I have to use a $CYCFLAG. But the problem with the $CYCFLAG is that it is updated only once inside the submit!

Andicot: Thank you for your post. But because I have 2 variables, I have to declare a $CYCFLAG for the interrupt to work. But as I said, the $CYCFLAG is updated only once inside the submit, so that's my real problem.

SkyeFire: Thanks for replying. The problem is I would really want to be able to look at those variables anytime. So I guess the submit is the right place. But the problem is still the same for me: where do I put the $CYCFLAG if it is updated only once in the submit?

Thanks to everybody for trying to help me. Keep on posting, probably somebody will have a solution.

Logged
RAS-Skordos GR
Newbie
*
Offline Offline

Gender: Male
Posts: 21



« Reply #6 on: September 05, 2008, 11:02:03 AM »

Hello Karel

A good solution would be (I think) to combine the answers of Jim Tyler and Andicot.
I have NEVER used $CYCFLAG. I always use serial check. For example:

IF $IN[30]==TRUE THEN
  IF FOO==TRUE THEN
    BRAKE F   (try this command as well. Offers MUCH faster braking than BRAKE)
    HALT
  ENDIF
ENDIF

I would suggest an interrupt in your main program
INTERRUPT DECL 1 WHEN $IN[30]==TRUE DO CHK_FOO()
INTERRUPT ON 1

And then an expert program (remove the INI section from the top)
DEF CHK_FOO ( )
INTERRUPT OFF 1        ; Stop the interrupt so that you don't get multiple triggers.
                                    ;$IN[30] is already true, otherwise you wouldn't be here
IF FOO==TRUE THEN   ; so check foo as well. Serial checking.
    BRAKE F                   ; Brake Fast
    HALT
ENDIF
INTERRUPT ON 1          ; Restart the interrupt
END

I think that should do it

Regards

Nikos
Logged
SkyeFire
Full Member
***
Online Online

Posts: 157


« Reply #7 on: September 05, 2008, 03:46:37 PM »

Actually, if you want to stop motion, the Submit is *not* what you want.  As a general rule, you cannot control motion or the operation of a application-level program from within the SPS.  You *could* set up a boolean that the SPS would set and then have your application program check for that boolean between each motion, but the impression I get is that you want to be able to *interrupt* a motion between two points, correct?

The only way that I know of (though if current trends continue, I'll probably learn differently sometime this afternoon after saying this) to stop a PTP or LIN command in mid-execution is to call an interrupt subroutine that has the BRAKE or BRAKEF command in it.  Speaking of which, I need to correct my earlier posting: an interrupt routine with a BRAKE command does not cancel the interrupted motion unless the RESUME command is also used.  So a BRAKE command followed by some sort of user intervention (like using $LOOP_MSG[]) *should* pick up where it left off and continue the interrupted motion.

$CYCFLAG variables, once set up, are updated on a roughly 12ms cyclic period (hence the name).  You don't have to set them up in the SPS to be updated.  In fact, because INTERRUPT declarations can only accept a single boolean variable, $CYCFLAGS were created in part to create system-level booleans that could be used to create INTERRUPTs that trigger on complex boolean logic statements.

Logged
RAS-Skordos GR
Newbie
*
Offline Offline

Gender: Male
Posts: 21



« Reply #8 on: September 06, 2008, 06:25:28 PM »

Hello all

I would say that I agree with Skyefire.
Only one addition...

If you use ONLY the BRAKE or BRAKE F command inside an interrupt subroutine, the robot DOES stop, but it continues the execution of the motion immediately on its own. If you combine it with the HALT command, the robot stops and waits for the start button to be pressed. After the start button is pressed the robot continues exactly from where it stopped. (This works somehow like pressing the stop button). If you also add the RESUME command, the robot will again stop waiting for the start button. But at this time, it will not continue from where it stopped. It will ignore everything and jump back to the program where the interrupt was DECLARED. (This technique is widely used where a "touch-sensing" logic is required).

Example:
Lets say we have the program MAIN.SRC Inside this program (in the INI section) we declare INTERRUPT 1 (for example). We also have another program called CHECK_HEIGHT.SRC. The CHECK_HEIGHT is a program we call from within the MAIN program. And of course we have the interrupt subroutine (lets call it INTER.SRC).
We start running the MAIN, which at some point calls the CHECK_HEIGHT, in the middle of which the interrupt is triggered.
- Without the RESUME command (inside INTER.SRC), the program will continue exactly from where it stopped, finish with the rest of CHECK_HEIGHT and then go back to the rest of MAIN.
- With the RESUME command (inside INTER.SRC), the rest of CHECK_HEIGHT (including the last motion that was stopped) will be ignored and the execution of the program will go back to the MAIN. Actually, it will go to the line right after the call of the CHECK_HEIGHT(), inside the MAIN program, because that is where the interrupt was declared.
Logged
Andicot
Newbie
*
Offline Offline

Posts: 25


« Reply #9 on: September 06, 2008, 08:53:56 PM »

Thank you for the clear explanation
Logged
karel
Newbie
*
Offline Offline

Posts: 6


« Reply #10 on: September 09, 2008, 02:58:04 AM »

Hi again,

RAS-Skordos GR: Thank you for your post. I want the instruction to stop the robot in any mode and in any program. So I cannot put the instruction in only one program, that's why I wanted a general solution. Also, in order to use an INTERRUPT, I need to use a $CYCFLAG as I am looking at 2 variables, not only one. Thanks anyway.

SkyeFire: Thanks again. Because I want to be able to stop in any mode and any program, I don't know elsewhere to put the instruction apart from the submit. But I understand that it is not the right place to put a *motion* instruction. As for the $CYCFLAG, I understand the concept, but if I want that $CYCFLAG to be initiated everywhere, I was thinking of using it in the INI section of the submit, not in the main loop. But the thing is, it is updated only once the submit is initialize.

Maybe I wasn't clear at the beggining of this post, but what I want to do is to be able to stop the robot in any program from any modes, base on 2 variables: one $IN and a global variable. I wanted a general solution if it was possible, not put the code in every files.

Even better, does anybody think it is possible to find a solution that works even when a user is manually jogging the robot, in other words: not in a program (this is really what I am trying to achieve). In that case, I don't see any way to do it apart from the submit file.

Thanks again for all your posts.
Logged
potis
Newbie
*
Offline Offline

Posts: 21


« Reply #11 on: September 09, 2008, 10:33:28 AM »

what you are trying to do is very difficult and i do not know if you wil have any success.

Let me propose you another idea.

how about to enable an output at the submit when your variables are correct, and that output to be electrically connected with the stop button? you could also set a message for the error that is happening and in order for someone to move the robot would be to change one event (at the submit that would turn off the output) or if this is not possible then you have to stop the submit, close the output, move the robot to somewhere safe and then start the submit again.
theproblem is that the program will continue exactly from where it stopped (the robot will move to the point that it stopped and then continue its move) and no resume can happen.
Logged
karel
Newbie
*
Offline Offline

Posts: 6


« Reply #12 on: September 11, 2008, 01:47:41 AM »

Nice suggestion potis, I thought of that one also, but for me, the problem is still the same (or maybe I've missed something): I need to look at 2 variables at the same time. So even if I change an output in the submit, I need a $CYCFLAG which cannot be used in the submit file.
Logged
asimo
Full Member
***
Offline Offline

Posts: 174


« Reply #13 on: September 11, 2008, 02:01:51 AM »

karel,

In the case of the solution from potis, you don't need a $CYCFLAG as you won't have to use an INTERRUPT. You could just make a simple IF statement:

IF ((NOT yourGlobalVariable) AND ($IN[30])) THEN
    $OUT[1]=TRUE ; ...or FALSE
ELSE
    $OUT[1]=FALSE; ...or TRUE
END

Hope this helps.
« Last Edit: September 12, 2008, 01:57:32 AM by asimo » Logged
SkyeFire
Full Member
***
Online Online

Posts: 157


« Reply #14 on: September 11, 2008, 01:23:59 PM »

Well!  I've never run into the Submit limitation on the CYCFLAGS before. 

What stops you from setting up the CYCFLAG in the INI section of each program?

As a stopgap... You could set up your interrupt to trigger on a global variable, and set that global variable from inside the Submit with something like
Interrupt_Variable=Global_Variable AND $IN[30]

Given that the SPS is not a fixed-time system, you lose some precision this way.  But if high interrupt-location precision isn't your requirement, this could work for you.
Logged
Pages: [1] 2 Print 
« previous next »
Jump to:  


Login with username, password and session length

Powered by MySQL Powered by PHP Powered by SMF 1.1.7 | SMF © 2006-2008, Simple Machines LLC Valid XHTML 1.0! Valid CSS!