Author Topic: Constant Velocity Between Two Points in Sub Programs  (Read 111 times)

0 Members and 1 Guest are viewing this topic.

Offline king nothing

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 10
Constant Velocity Between Two Points in Sub Programs
« on: November 14, 2017, 07:57:06 PM »
I have code which is calling sub programs. The motion takes place in the sub programs. I have two motions which I want to sync up as a constant move (no stopping). Is there a good way to ensure this? Is KRL with KRC4 even capable of this? I have not been able to do this yet. I can easily do it if all of the code is in the same sub program.

example of code:
def sub-program1()
decl e6pos myposition
initialize mypsoition
base = base_data

tool = tool_data

lin myposition c_vel
end

def sub-program 2()
decl e6pos myposition2
initialize mypsoition2
base = base_data

tool = tool_data

lin myposition2 c_vel
end

There is of course other code in those sub programs. The main program would call sub program 1, then call sub program 2. I realize the obvious answer is to do this motion back in the main program that way I can get the constant velocity (no stopping between points) to work. I do not want to do it this way, however. This motion is a straight line. My code does work if I do all of the motion in the main program. The robot is capable of doing a c_vel here: the commanded speed is not too fast to get a way with a c_vel.

I am using manually programmed positions, not taught positions. Could this work if I used taught positions instead?

Any ideas or thoughts?

Offline Fubini

  • Sr. Member
  • ****
  • Thank You
  • -Given: 4
  • -Receive: 138
  • Posts: 488
Re: Constant Velocity Between Two Points in Sub Programs
« Reply #1 on: November 15, 2017, 05:08:39 AM »
As Long there is no advance run breaking instruction involved it should work. Most common error here is letting the subprograms begin with a INI-FOLD, which includes advance run breaking instructions.

Also have you tried using $STOPNOAPROX to debug the issue? Any Messages like approxination not possible in T2? What are the Approximation radii? ...

Fubini

Offline king nothing

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 10
Re: Constant Velocity Between Two Points in Sub Programs
« Reply #2 on: November 15, 2017, 04:20:18 PM »
Fubini Wrote:"Most common error here is letting the subprograms begin with a INI-FOLD, which includes advance run breaking instructions. "
This did the trick. I deleted the default initialization from the sub program. It initializes interrupt 3 when $stopmess = true. I don't know what interrupt 3 was programmed to do, but it seems to be causing issues in this case for me. If I had to guess it looks like $stopmess = true is being satisfied by one of the errors being sent to the front panel.


Update: I am now seeing notification messages which I didn't realize were there earlier.
Notification messages to the front panel when I try to execute this:
KSS01442
Sequence of instructions that cannot be approximated (module "main program", block 36)

KSS01123
Approximate positioning not possible (module "sub program", block 53) (=> 1442)

Even though the motion is continuous, I still get these error messages. I can live with the messages, but it would be nice to "fix" them properly.

When I look up these codes on google, this source (http://alarmcodes.com/kuka-error-message-1442-approximation-not-allowed-for-instructions/) claims that if a $tool command is programmed between two motions it will cause the 1442 error. The 1442 error seems to be what is stopping motion. My confusion here is that if I do all of this code within the main program, it works. Even if I redefine $tool in between the motions, the robot will execute the motion without stopping (maintaining constant speed).
If I execute this code all within the main program it does not stop motion. The main program contains the same init fold as the sub programs. I still even get the same error messages, but I do get constant motion. Why does interrupt 3 stop motion in the sub program but not in the main program?

If I try to look at what line the error message refers to (block 36): the line doesn't make sense with what the error message claims - it will call out what is an empty line. For example, in the error above, block 36 is an empty line. This is one beef I have wtih Kuka. Even from my experience back in programming 1 and 2 at Kuka college, the teachers there knew about this issue and had to known fix for it. The issue as far as I can tell is the way KRL counts the lines within the folds. Even if I open all  of the folds, the lines still don't match up with what the error message is telling me.

Anyway, it works for now. It would be nice to get rid of the error messages all together.
Thanks for the help Fubini!!