Smooth motion programming with WHILE LOOP & externally sent XYZpos

  • Hello,


    I am trying to create a program that is able to smoothly execute a motion path generated by custom software and sent to the robot. I currently have a .sps file running that writes the desired points into an array of E6POS.


    SPS:

    Code
    softWriteIndexInt = softWriteIndex //This is needed due to softWriteIndex being a real and casting into an int variable
    ToolpathData[softWriteIndexInt+1].X = plcReqXPos //there is a +1 due to software index beginning to write at 0 whereas KRL array begins at 1
    ToolpathData[softWriteIndexInt+1].Y = plcReqYPos
    ToolpathData[softWriteIndexInt+1].Z = plcReqZPos


    This function is working properly and we are able to populate all of the desired points into the array prior to executing any motion. Once the array is populated, I am wanting to execute a while loop to loop through all of the motion points.


    SRC:


    Running this for loop, I am able to move to all of the desired points, however, the motion is quite jumpy, and smooth motion is desired. I believe what is causing the issue is the advanced program pointer, however, I'm quite stuck on how to edit the program to move smoothly. I was able to find a topic that somewhat addresses my issue, however in the example provided, it appears that the amount of points sent to the robot is a fixed amount, however, in this application the amount of points is variable.


    Advance pointer trick with a WHILE LOOP KUKA KRC4 8.x


    Please let me know if more information is needed to help provide a solution. I am currently running KSS 8.5.8 on a KUKA KRC4 controller. Thank you.

  • AD
  • add line before loop


    $STOPNOAPROX=TRUE


    this will cause program to stop when approximation is not possible, giving you chance to explore and see what the values of variables are.


    btw you did not post your DAT file that accompanies the SRC file.

    for example what is the value of LCPDAT12. that will override your line 13

    $APO.CDIS = 5


    also since you are setting advance to 1, you need to handle the last motion in that loop. it should be without approximation since you break from loop and next point value is not known.

    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

  • Did you checked APO_DIST in LCPDAT12 ?

    My apologies, I'm actually not using the extra syntax of the motion. Part of my rabbit hole troubleshooting was thinking that adding C_DIS after the motion command wasn't allowing it to approximate and that I needed the remaining syntax. I've since removed it and updated the main post.


    Is it possible my error is due to the advance program pointer not taking into consideration the incremented step counter and is attempting to move to the same position until the main pointer increments step counter?

  • I've added $stopnoapprox=true to the code and I'm able to run through the program without stopping. It appears when increasing the APO.CDIS to 10, it stops frequently. A low APO.CDIS of 0.1 or so is able to run through the motion but still appears fairly jittery.


    Here is an updated version of the code I am currently running:

  • as mentioned, change $ADVANCE to 1

    insert line to set $STOPNOAPPROX to true before loop

    try replacing SLIN with LIN

    and instead of single motion, create two cases

    Code
     
    IF stepCounter < toolpathArrSizeInt THEN
    LIN ToolpathData[stepCounter] C_DIS ; approximate most points
    ELSE
    LIN ToolpathData[stepCounter] ; no approximation on last point
    ENDIF

    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

  • if you get through the program without issue while stopnoaprox is true, then you have no advance run issue any more. there may still be "not nice" motions but that is a different issue, not related to advance run pointer. could be number of factors including density of points, approximation, acceleration, load etc.

    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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account
Sign up for a new account in our community. It's easy!
Register a new account
Sign in
Already have an account? Sign in here.
Sign in Now