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

How safe is it to "split" a motion to an axis-specified position?

  • mudanda
  • October 31, 2024 at 1:48 PM
  • Thread is Unresolved
  • mudanda
    Reactions Received
    2
    Trophies
    1
    Posts
    24
    • October 31, 2024 at 1:48 PM
    • #1

    Hi,

    I'd like to split a motion to an E6AXIS axis-specific position in several different motions, to position some axes before others and avoid some collisions or risky situations.

    Since it is not possible to use variables in "single-axis" motions (e.g. SPTP {A1 value}) I declared a temporary E6AXIS variable of which I initialize only the necessary components, like in the code block below.

    Is it safe to command a positioning to a partially initialized E6AXIS, and what values could I expect to find in the uninitialized components of tempAxis?

    Is it possible to "clear" the content of tempAxis to use it again, in the same way but using different coordinates? I don't think it is possible to "terminate" a variable. Perhaps I can assign some kind of "null" value that will be ignored by the motion planner?

    Thanks.

    Code
    DEF program()
    
    	E6AXIS tempAxis
    	
    	tempAxis.A1 = p00.A1
    		
    	SPTP tempAxis	; MOVE A1 TO p00.A1
    	
    	SPTP p00 		; MOVE TO p00
    	
    END
    Display More

    Edited 2 times, last by mudanda (October 31, 2024 at 2:12 PM).

  • work_BR
    Reactions Received
    11
    Trophies
    1
    Posts
    95
    • October 31, 2024 at 4:19 PM
    • #2

    It is possible to swing single axis as a time... You cannot have variables in the curly braces yes... but you can do:


    Code
    DECL E6AXIS HOLDER
    HOLDER=$AXIS_ACT ;WHERE EVER YOU ARE, POPULATE THIS VARIABLE
    HOLDER.A1 = VARIABLE
    PTP HOLDER 
    ...


    This should drive a single axis. The trick between mine and yours is using $AXIS_ACT.

  • mudanda
    Reactions Received
    2
    Trophies
    1
    Posts
    24
    • October 31, 2024 at 5:01 PM
    • #3

    Ok this works but I want to avoid accessing $AXIS_ACT to avoid stopping the ARP

  • work_BR
    Reactions Received
    11
    Trophies
    1
    Posts
    95
    • October 31, 2024 at 5:14 PM
    • #4

    I see. I don't have a lot of context, but you can have A2 ... A6 pre populated, and only have A1 based on a variable like:

    Code
    DECL E6AXIS HOLDER
    ;HOLDER=$AXIS_ACT ;WHERE EVER YOU ARE, POPULATE THIS VARIABLE
    HOLDER.A1 = VARIABLE
    HOLDER.A2 = 2
    HOLDER.A3 = 3
    HOLDER.A4 = 4
    HOLDER.A5 = 5
    HOLDER.A6 = 6
    PTP HOLDER 
    ...
  • hermann
    Reactions Received
    405
    Trophies
    9
    Posts
    2,597
    • November 1, 2024 at 9:48 AM
    • #5

    Don't understand the task.

    - you have one special position where you want to avoid collision? So why not using a fix position.

    - you have many positions where you want to avoid collision, how is it possible that on every position you have the same strategy to avoid collision?

    Even if I don't understand the problem, may be it could be a solution to calculate the position backwards from target.

  • mudanda
    Reactions Received
    2
    Trophies
    1
    Posts
    24
    • November 4, 2024 at 11:04 AM
    • #6

    My objective is to move the robot to a specific position but "sequentially".

    In the first code block above the end position is "p00", a global variable of type E6AXIS.

    Calling "SPTP p00" would move all robot axes contemporarily to the end position.

    I just want to let some axes position before others. For example, I want to move A1 to the end position's A1 (p00.A1) while keeping the other axes still. When A1 has reached p00.A1, I will move all the other axes to the end position. I am just "sequentializing" the motion to P00.

    The code I presented in the first post works and does exactly what I expected.

    From any start position, the robot first moves A1, then all the other axes. To do so, I am calling a motion instruction to an E6AXIS position of which not all its components are initialized (tempAxis).

    While this works, I was just wondering if it is "safe" to do so.

  • SkyeFire
    Reactions Received
    1,044
    Trophies
    12
    Posts
    9,391
    • November 4, 2024 at 10:07 PM
    • #7
    Quote from mudanda

    While this works, I was just wondering if it is "safe" to do so.

    Yes, this works and is completely safe, as far as I know. For E6AXIS and E6POS points, any axes that are left undefined simply result in those axes being kept in their previous position.

    So, DECL E6AXIS PSafe={A1 90}, then using PTP PSafe, will result in A1 moving to 90deg while A2-A5 remain unmoved.

    Now, this does have some potential issues. For example, if the previous move is approximated, then A2-A5 will complete their motion over the course of the approximation arc. So this could be unsafe to use in conditions where the motion is very close to collision and could be executed from multiple different starting directions. Avoiding approximation, or using smaller approximation radii, would be wise in that case.

    DECLing PSafe (don't use P00, that's a reserved keyword) in a DAT file could be dangerous, if someone were to edit it. Also, using PSafe in an Inline Form would be VERY dangerous, as anyone using TouchUp on that form would rewrite all values of PSafe to the current position. So it's probably safer to DECL PSafe inside the active routine, and then assign a value only to A1. This way, unless someone edits the .SRC file, it should avoid the risks of someone tampering with it not knowing what they're doing.

  • Online
    MOM
    Reactions Received
    175
    Trophies
    7
    Posts
    1,419
    • November 5, 2024 at 12:18 AM
    • #8

    In a first step I would initialize with the actual position (axes specific - like PSafe as mentioned above).
    In the second step just change the axis (as SkyFire mentioned) like PSave={A1 90} and so on

    I do not like phrases like

    Quote from SkyeFire

    any axes that are left undefined

    (the complete movement is undefined)

    Like (I do not have a system for testing):

    DECL E6AXIS PSafe=$ACT_AXIS
    PTP PSafe={A1 90}

    something like that - all axes are initialized and with the PTP you only change the axis as requested

  • panic mode
    Reactions Received
    1,268
    Trophies
    11
    Posts
    13,040
    • November 5, 2024 at 12:32 AM
    • #9
    Quote from mudanda

    Is it possible to "clear" the content of tempAxis to use it again, in the same way but using different coordinates?

    yes it is possible...

    put it into a subroutine (or function). this way every time that routine is called, runtime variable in that routine is not initialized. you can then selectively initialize rest.

    Code
    DEF SafePos_A1(a1_value:in)
       DECL REAL a1_value
       DECL AXIS temp
       temp.A1 = a1_value
       PTP temp
    END

    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,268
    Trophies
    11
    Posts
    13,040
    • November 5, 2024 at 12:38 AM
    • #10

    or

    Code
    DEFFCT AXIS SafePos(A1:in,A2:in,A3:in,A4:in,A5:in,A6:in)
      DECL REAL A1,A2,A3,A4,A5,A6
      DECL AXIS temp
      If VarState("A1")==#INITIALIZED THEN
         temp.A1=A1
      endif
      If VarState("A2")==#INITIALIZED THEN
         temp.A2=A2
      endif
      If VarState("A3")==#INITIALIZED THEN
         temp.A3=A3
      endif
      If VarState("A4")==#INITIALIZED THEN
         temp.A4=A4
      endif
      If VarState("A5")==#INITIALIZED THEN
         temp.A5=A5
      endif
      If VarState("A6")==#INITIALIZED THEN
         temp.A6=A6
      endif
      return temp
    ENDFCT
    Display More

    and to move to {A1 25, A4 75, A6 -10} call it like this.

    Simply leave unwanted axis empty, but - do not forget the commas. they determine which value lands where.

    PTP SafePos(24,,,75,,-10) ; only enter values for A1, A4 and A6

    and with this, you can also use variables...

    PTP SafePos( ,,,,,$OV_JOG) ; turn A6 to whatever $OV_JOG value is... (or whatever variable you want...)


    you can skip commas if nothing else is entered after them

    PTP SafePos( ,,90) ; turn A3 to 90 deg, A3 is last value provided so commas after it are not needed. but A1 and A2 are skipped so commas are needed there

    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

  • Online
    MOM
    Reactions Received
    175
    Trophies
    7
    Posts
    1,419
    • November 5, 2024 at 12:39 AM
    • #11

    panic mode

    You have a system available (?).

    Write a simple program and declare DECL AXIS temp and using variable to show the result - please, just to learn - thanx in advance

  • panic mode
    Reactions Received
    1,268
    Trophies
    11
    Posts
    13,040
    • November 5, 2024 at 2:17 AM
    • #12

    I am not sure what would be a convincing argument... i guess one would have to try it an see it... which is what i have done many moons ago.

    KRL does NOT un-initialize variables... ever...!


    When variables are declared they are always un-initialized ... but ... as soon as SOMETHING is assigned to it, that variable IS initialized.. and it STAYS initialized... for the REST OF THE LIFE of that variable. only if variable is a structure, it is possible to un-initialize some elements of it (but not all).

    1. consider variable declared in DAT file of program module called PANIC (which contains files PANIC.SRC and PANIC.DAT)

    DECL AXIS A_DAT

    right now that value is not initialized.

    selecting program module PANIC, shows PANIC.SRC in the HMI.

    if one assigns value to that variable somehow (by program line in that SRC file or using variable monitor), variable becomes initialized.

    A_DAT = {A4 75}

    note that A_DAT is an axis so it has 6 elements (A1 - A6) but at this moment only element A4 is initialized.

    VarSTate("A_DAT") returns TRUE, (as long as ANY part of structure is initialized, result is true)

    VarState("A_DAT.A5") returns false, because now we are specifically checking element A5 of A_DAT

    ...


    deselecting program hides the program module and blocks access to this variable. one can select another programs and check other variables... then come back and select PANIC.SRC and voila.. that variable value is still there... because memory for it is resevered "permanently" (until reboot). therefore A_DAT.A4 still has value. and A_DAT will remain initialized no matter what... until end of life of that variable. deselecting program module did not clear it. but rebooting will clear it...

    consequence of this is that you cannot recover memory from variables that are declared in DAT files... so by sleeting bunch of programs that have lots of things declared in their DAT file, your controller can run out of memory and only way to purge it is to reboot...


    2. consider variable declared in a SRC file such as:

    DECL AXIS A_SRC

    this variable is also not initialized. but.. it can be initialized just like the previous one. the difference is that this variable is a runtime variable. memory assigned to this variable is returned to system as soon as this routine ends. so one can continuously create, run, delete program modules... all day long, over and over.. without EVER running out of memory.


    3. consider variable declared in DAT file and also INITIALIZED in the DAT file...
    DECL REAL PI = 4.0 ; declaration AND initialization in one line only works in DAT files.

    as soon as module is compiled and selected that value will be assigned. but... this is still a VARIABLE... so value CAN change...
    if you select the program module of DAT file where this is declared, you can change the value, for example by using assignment in the SRC file, or by using variable monitor...
    say we make change it to PI = 3.14...
    if you go back and check the DAT file, declaration now has been modified so it shows the most recent value:
    DECL REAL PI = 3.14

    and since this is now part of file, this value is retentive. even after reboot, controller will read this value and PI will be whatever the last value you assigned to it. This is how data points of inline form motions are retained. but.. still there is no way to un-initialize it...


    4. consider variable of some type of structure such either of above two examples.
    structure is an assembly or collection of values, each represented by own variable (element). KRL considers variable initialized as soon as ANY element of the structure is initialized. and as shown above one can check for initialization of main variable or variable element.

    but.. as soon as some element is initialized, the main (structure) variable is initialized and there is no way that i can think of to un-initialize it. you cannot assign value to structure from something that is not initialized. you CAN choose which elements you are assigning and if assigned value is a literal, then it is possible to un-initialize some elements of the structure.. but not all of them.

    Example

    DECL AXIS W

    W = {A4 100} ; W and W.A4 are initialized, but not the other elements.
    W = {A2 -90} ; W and W.A2 are initialized, but not the other elements. note that W.A4 element is no longer initialized but that is only possible because SOME part of W is still initialized (in this case that is W.A2)

    W.A1 = 45 ; now W.A1=34, W.A2=-90, other elements are not initialized. using dot operator to access elements one can initialize them directly but not un-initialize.
    W = {A4 333} ; now W.A4 is the only element initialized (and so is W) but values of W.A1 and W.A2 are lost, they became un-initialized.

    with all this.. it should be clear how previously mentioned function SafePos() works. when called, it creates local variables (runtime) which are of course un-initialized. then selectively, some elements can be assigned value. as long as at least one of the elements has value, function can return entire structure as a result - even if some elements of that results are not initialized... and this result can be either assigned to some variable or used directly in motion instructions as already shown.

    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,268
    Trophies
    11
    Posts
    13,040
    • November 5, 2024 at 2:24 AM
    • #13

    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,268
    Trophies
    11
    Posts
    13,040
    • November 5, 2024 at 2:33 AM
    • #14

    using same approach one can for example strip S&T from POS variables.

    here is an example of using function result directly in motion instruction

    or variable

    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

  • mudanda
    Reactions Received
    2
    Trophies
    1
    Posts
    24
    • November 5, 2024 at 10:26 AM
    • #15

    Thank you all for your suggestions, especially to Panic Mode for the in-depth explanation.

    The function "SafePos" is a brilliant solution in my case, to get each time a new position value with just some components initialized. It does also solve the missing functionality of calling a motion instruction to a position with its components specified by a variable (SPTP {A1 myVariable})

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
  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