1. Home
    1. Dashboard
    2. Search
  2. Forum
    1. Unresolved Threads
    2. Members
      1. Recent Activities
      2. Users Online
      3. Team Members
      4. Search Members
      5. Trophys
  3. Articles
  4. Blog
  5. Videos
  6. Jobs
  7. Shop
    1. Orders
  • Login or register
  • Search
This Thread
  • Everywhere
  • This Thread
  • This Forum
  • Articles
  • Pages
  • Forum
  • Blog Articles
  • Products
  • More Options
  1. Robotforum - Support and discussion community for industrial robots and cobots
  2. Forum
  3. Industrial Robot Support and Discussion Center
  4. KUKA Robot Forum
Your browser does not support videos RoboDK Software for simulation and programming
Visit our Mainsponsor
IRBCAM
Robotics Channel
Robotics Training
Advertise in robotics
Sponsored Ads

Smooth motion programming with WHILE LOOP & externally sent XYZpos

  • Carleton Hall
  • October 20, 2021 at 7:12 PM
  • Thread is Unresolved
  • Carleton Hall
    Reactions Received
    1
    Trophies
    3
    Posts
    20
    • October 20, 2021 at 7:12 PM
    • #1

    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:

    Code
    $ADVANCE = 3
    stepCounter = 1
    
    WHILE stepCounter < toolpathArrSizeInt //Array size is a variable passed from software
    
       ToolpathData[stepCounter].E1 = -3500 //external axis positions and rotation values are temporarily static
       ToolpathData[stepCounter].E2 = -90
       ToolpathData[stepCounter].E3 = 90   
       ToolpathData[stepCounter].A = -91.36
       ToolpathData[stepCounter].B = -1.65
       ToolpathData[stepCounter].C = 1.19
    
       $APO.CDIS = 5
    
       SLIN ToolpathData[stepCounter] C_DIS
       
       toolpathPosIndex = toolpathPosIndex + 1 
       stepCounter = stepCounter + 1
    
    ENDWHILE
    Display More

    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.

    Edited 2 times, last by Carleton Hall (October 20, 2021 at 8:19 PM).

  • DenisCa
    Reactions Received
    1
    Trophies
    2
    Posts
    38
    • October 20, 2021 at 8:16 PM
    • #2

    Did you checked APO_DIST in LCPDAT12 ?

    Quote from Carleton Hall

    SLIN ToolpathData[stepCounter] WITH $APO = SAPO(LCPDAT12) C_DIS

  • panic mode
    Reactions Received
    1,262
    Trophies
    11
    Posts
    13,027
    • October 20, 2021 at 8:33 PM
    • #3

    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

  • Carleton Hall
    Reactions Received
    1
    Trophies
    3
    Posts
    20
    • October 20, 2021 at 8:34 PM
    • #4
    Quote from DenisCa

    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?

  • Carleton Hall
    Reactions Received
    1
    Trophies
    3
    Posts
    20
    • October 20, 2021 at 8:41 PM
    • #5
    Quote from panic mode

    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

    Display More

    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:

    Code
    FOR resetCounter = 1 to 10000 STEP 1
       ToolpathData[resetCounter] = {X 0,Y 0,Z 0,A -91.36,B -1.65,C 1.19,E1 -3500,E2 -90,E3 90,E4 0.0,E5 0.0,E6 0.0}
    ENDFOR
    
    goHome(1)
    
    WAIT SEC 0
    
    robUpdateToolpathArr = TRUE ;REQUEST POINTS TO BE SENT
    
    WAIT FOR $IN[57] ;SOFTWARE STARTING TO SEND POINTS
    
    ;MOVE TO READY POS
    SLIN XP3 WITH $VEL = SVEL_CP(0.1, , LCPDAT2), $TOOL = STOOL2(FP3), $BASE = SBASE(FP3.BASE_NO), $IPO_MODE = SIPO_MODE(FP3.IPO_FRAME), $LOAD = SLOAD(FP3.TOOL_NO), $ACC = SACC_CP(LCPDAT2), $ORI_TYPE = SORI_TYP(LCPDAT2), $APO = SAPO(LCPDAT2), $JERK = SJERK(LCPDAT2), $COLLMON_TOL_PRO[1] = USE_CM_PRO_VALUES(0) C_Spl
    
    SPTP XP1 WITH $VEL_AXIS[1] = SVEL_JOINT(50.0), $TOOL = STOOL2(FP1), $BASE = SBASE(FP1.BASE_NO), $IPO_MODE = SIPO_MODE(FP1.IPO_FRAME), $LOAD = SLOAD(FP1.TOOL_NO), $ACC_AXIS[1] = SACC_JOINT(PPDAT1), $APO = SAPO_PTP(PPDAT1), $GEAR_JERK[1] = SGEAR_JERK(PPDAT1), $COLLMON_TOL_PRO[1] = USE_CM_PRO_VALUES(0) C_Spl
    ;ENDFOLD
    
    WAIT FOR NOT $IN[57] ;SOFTWARE DONE SENDING POINTS
    
    robUpdateToolpathArr = FALSE ;REQUEST POINTS TO NOT BE SENT
    
    WAIT SEC 0
    
    $ADVANCE = 3
    
    $STOPNOAPROX = TRUE
    
    WHILE stepCounter < toolpathArrSizeInt
       
       $APO.CDIS = 0.1
    
       SLIN ToolpathData[stepCounter] C_DIS
    
       toolpathPosIndex = toolpathPosIndex + 1
       stepCounter = stepCounter + 1
    
    ENDWHILE
    Display More
  • panic mode
    Reactions Received
    1,262
    Trophies
    11
    Posts
    13,027
    • October 20, 2021 at 8:47 PM
    • #6

    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

  • panic mode
    Reactions Received
    1,262
    Trophies
    11
    Posts
    13,027
    • October 20, 2021 at 9:37 PM
    • #7

    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

Advertising from our partners

IRBCAM
Robotics Channel
Robotics Training
Advertise in robotics
Advertise in Robotics
Advertise in Robotics

Job Postings

  • Anyware Robotics is hiring!

    yzhou377 February 23, 2025 at 4:54 AM
  • How to see your Job Posting (search or recruit) here in Robot-Forum.com

    Werner Hampel November 18, 2021 at 3:44 PM
Your browser does not support videos RoboDK Software for simulation and programming

Tag Cloud

  • abb
  • Backup
  • calibration
  • Communication
  • CRX
  • DCS
  • dx100
  • dx200
  • error
  • Ethernet
  • Ethernet IP
  • external axis
  • Fanuc
  • help
  • hmi
  • I/O
  • irc5
  • IRVIsion
  • karel
  • kawasaki
  • KRC2
  • KRC4
  • KRC 4
  • KRL
  • KUKA
  • motoman
  • Offset
  • PLC
  • PROFINET
  • Program
  • Programming
  • RAPID
  • robodk
  • roboguide
  • robot
  • robotstudio
  • RSI
  • safety
  • Siemens
  • simulation
  • SPEED
  • staubli
  • tcp
  • TCP/IP
  • teach pendant
  • vision
  • Welding
  • workvisual
  • yaskawa
  • YRC1000

Thread Tag Cloud

  • abb
  • Backup
  • calibration
  • Communication
  • CRX
  • DCS
  • dx100
  • dx200
  • error
  • Ethernet
  • Ethernet IP
  • external axis
  • Fanuc
  • help
  • hmi
  • I/O
  • irc5
  • IRVIsion
  • karel
  • kawasaki
  • KRC2
  • KRC4
  • KRC 4
  • KRL
  • KUKA
  • motoman
  • Offset
  • PLC
  • PROFINET
  • Program
  • Programming
  • RAPID
  • robodk
  • roboguide
  • robot
  • robotstudio
  • RSI
  • safety
  • Siemens
  • simulation
  • SPEED
  • staubli
  • tcp
  • TCP/IP
  • teach pendant
  • vision
  • Welding
  • workvisual
  • yaskawa
  • YRC1000

Tags

  • Configuration
  • PROFINET
  • external axis
  • KR210
  • Communication
  • toolpath
  • while
  • Motion Planning
  • advanced pointer
  1. Privacy Policy
  2. Legal Notice
Powered by WoltLab Suite™
As a registered Member:
* You will see no Google advertising
* You can translate posts into your local language
* You can ask questions or help the community with your knowledge
* You can thank the authors for their help
* You can receive notifications of replies or new topics on request
* We do not sell your data - we promise

JOIN OUR GREAT ROBOTICS COMMUNITY.
Don’t have an account yet? Register yourself now and be a part of our community!
Register Yourself Lost Password
Robotforum - Support and discussion community for industrial robots and cobots in the WSC-Connect App on Google Play
Robotforum - Support and discussion community for industrial robots and cobots in the WSC-Connect App on the App Store
Download