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

Mapping I/O KRC4 | Get Current Cartesian Position

  • Lucasss
  • June 16, 2022 at 12:41 PM
  • Thread is Resolved
  • Lucasss
    Trophies
    2
    Posts
    24
    • June 16, 2022 at 12:41 PM
    • #1

    Hi everyone, i'm doing some test with a KRC4 controller V8.3.378 with WorkVisual 6.0.

    I'm totally new in KRL and krc4 (curious student),

    I'm searching to get in real time, the X,Y,Z position of the robot on my HMI. According to implant these data on my HMI in need them to be on an output and not just as global variable.

    That's why i'm searching to assign an output taking the value of $POS_ACT in real time.

    So I've read a lot of documentation showing how mapping I/O with WorkVisual but i dont really get how to declare and assign i/O.

    So I've export my project from the Smartpad and open the Wws active file on WorkVisual.

    I've searched for a file such as iosys.ini in KRC2 with the declaration of I/O and found that WorkVisual is able to map them directly.

    According to the I/O panel of WorkVisual, I can see the different digital outputs but no names are attributed, so i go to the var_const.dat to see if some outputs are use or not.

    A lot of outputs is shaded, so i guess that they are exchangeable because not uses.

    On the robot, the outputs from 2160 to 2271 was already "mapped" (connected and declared but never used). So i'm trying to use these one to get the position.

    To assign these outputs, i write this code to the var_const.dat and comment the outputs non used :

    Code
    GLOBAL SIGNAL POSXact $OUT[2160] to $OUT[2192]
    GLOBAL SIGNAL POSYact $OUT[2193] to $OUT[2225]
    GLOBAL SIGNAL POSZact $OUT[2226] to $OUT[2258]
    
    ;GLOBAL SIGNAL OUT_INT_0 $OUT[2160]  TO $OUT[2175]
    ;GLOBAL SIGNAL OUT_INT_1 $OUT[2176]  TO $OUT[2191]
    ;GLOBAL SIGNAL OUT_INT_2 $OUT[2192]  TO $OUT[2207]
    ;GLOBAL SIGNAL OUT_INT_3 $OUT[2208]  TO $OUT[2223]
    ;GLOBAL SIGNAL OUT_INT_4 $OUT[2224]  TO $OUT[2239]
    ;GLOBAL SIGNAL OUT_INT_5 $OUT[2240]  TO $OUT[2255]
    ;GLOBAL SIGNAL OUT_INT_6 $OUT[2256]  TO $OUT[2271]
    Display More

    And i also add this code to the SPS.SUB to get these informations in real time :

    Code
    POSXact = $POS_ACT.X
    POSYact = $POS_ACT.X
    POSYact = $POS_ACT.X

    But there I've some questions without answers…

    1. Is the assignement well done ?

    2. Is this assignement enough for an output ? Do i have to declare them in the config.dat too ?

    3. Is it possible to get the position with boolean outputs ?

    4. The coordinate range of each is between 500 and 2500 max for each axe so 32bit is too much ?

    5. Is there something more to do ?

    I think I missed something, thank you for your indulgence and your time,

    Sincerely,

    Lucas

    Images

    • 2022-06-16 12_37_48-WorkVisual Development Environment - Projet 800T lub ACTUEL.wvs.png
      • 14.89 kB
      • 557 × 286
      • 31
  • Online
    SkyeFire
    Reactions Received
    1,060
    Trophies
    12
    Posts
    9,456
    • June 16, 2022 at 2:41 PM
    • #2
    Quote from Lucasss

    1. Is the assignement well done ?

    2. Is this assignement enough for an output ? Do i have to declare them in the config.dat too ?

    3. Is it possible to get the position with boolean outputs ?

    4. The coordinate range of each is between 500 and 2500 max for each axe so 32bit is too much ?

    5. Is there something more to do ?

    1. Well enough

    2. No. If the SIGNALS are DECL'd using GLOBAL, you do not have to add them to $CONFIG.DAT

    3. I'm not sure what you mean. Each "group" output is simply a collection of boolean outputs. So it would be possible, using Bitwise math, to set each boolean individually, but it would not be worth the extra effort

    4. That depends. You need to keep in mind, the SIGNALs are integer values. So if $POS_ACT.X is 1.23, your code as written will only send 1.0. For integers, 16bits would be enough to encode a value of 2500. But how are you handling sign bits? KRL only automatically applies sign (+/-) to 32-bit SIGNALs -- SIGNALs smaller than 32bit are treated as always positive integers. It is possible to encode real/floating-point values onto 32bit SIGNALs using the CAST_TO function (Panic Mode wrote several examples in the forum archives)

    5. Yes. $POS_ACT has been superceded by $POS_ACT_MES. Also, neither variable contains valid data at all times -- on initial boot, or after a program cancel, they are "declared" but not "initialized". Which means that your SPS code will crash. Each of your lines in the SPS should be preceded with an ON_ERROR_PROCEED to avoid crashing the SPS.

  • Lucasss
    Trophies
    2
    Posts
    24
    • June 16, 2022 at 2:54 PM
    • #3

    Thanks for answering Skyefire,

    The 3th question join the 4th. I was asking myself if the association of the 32 bits was able to get the Int position, but yes, math will help me.

    5. I see and will make the change, so is there a way to get the position in real time without crashing the SPS ? As i understand, except using ON_ERROR_PROCEED every line, this will not work. Should i put these lines (from SPS.SUB) in an other file call during the process of my program ?

  • Lucasss
    Trophies
    2
    Posts
    24
    • June 16, 2022 at 3:39 PM
    • #4

    I just refind this topic from 2018, it seems to be on a krc2 :

    KUKA 6-axis (position) to PLC - KUKA Robot Forum - Robotforum - Support and discussion community for industrial robots and cobots (robot-forum.com)

    I guess this is different for KRC4,

  • Online
    SkyeFire
    Reactions Received
    1,060
    Trophies
    12
    Posts
    9,456
    • June 16, 2022 at 5:46 PM
    • #5
    Quote from Lucasss

    I guess this is different for KRC4,

    No. That thread is talking about the axis positions -- the joint angles. Those are accessed via $AXIS_ACT or $AXIS_ACT_MEAS. Unlike $POS_ACT_MES, which is Cartesian data, $AXIS_ACT_MEAS always contains valid data. This is the same for KRC1, KRC2, and KRC4.

    The reason $POS_ACT_MES does not always contain valid data is because the values change depending on which Base and Tool are currently active. And there are certain circumstances where no valid Base or Tool are active.

    Since the motion control task and the SPS update asynchronously to each other, there is no way to guarantee that $POS_ACT_MES contains valid data the moment the SPS executes POSActX=$POS_ACT_MES.X. Even performing a validity check on $POS_ACT_MES one line earlier is not a guarantee, since $POS_ACT_MES can change state between one SPS line execution and the next. Using ON_ERR_PROCEED is the only way I'm aware of to ensure that the SPS never crashes on this condition.

    You can also use $ERR.NUMBER immediately after the assignment in the SPS to check if the assignment succeeded or not, and if not, assign a value to POSActX (et al) like -9999, to indicate to the remote device that $POS_ACT_MES currently holds no valid data. The BAS.SRC routine in your robot contains examples of using the ERR functionality in a similar fashion:

    Code
      ON_ERROR_PROCEED
      VEL_CHECK = $VEL.ORI1
      IF $ERR.NUMBER > 0 THEN
          $VEL.ORI1=DEF_VEL_ORI1 ; swivel velocity
          ERR_CLEAR($ERR)
      ENDIF
  • Lucasss
    Trophies
    2
    Posts
    24
    • June 17, 2022 at 9:05 AM
    • #6

    Thanks SkyeFire your time,

    As i understand, my sps must be like this,

    Code
         ;************ X AXE **********
    
    
    
            ON_ERROR_PROCEED
       POSXact = $POS_ACT_MES.X*1
       IF $ERR.NUMBER>0 THEN
           POSXact=-9999
           ERR_CLEAR($ERR)
       ENDIF
    ;*****************************
    
    ;************ Y AXE **********
    
       ON_ERROR_PROCEED
       POSYact = $POS_ACT_MES.Y*1
       IF $ERR.NUMBER>0 THEN
           POSYact=-9999
           ERR_CLEAR($ERR)
       ENDIF
    
    ;*****************************
    
    ;************ Z AXE **********
       ON_ERROR_PROCEED
       POSZact = $POS_ACT_MES.Z*1
       IF $ERR.NUMBER>0 THEN
           POSZact=-9999
           ERR_CLEAR($ERR)
       ENDIF
    
    ;*****************************
    Display More

    But there is something disrupting me,

    Code
    IF $ERR.NUMBER>0 THEN

    If the ERR is >0 then, the error can be everything, this can be a problem ?

    I've checked the KSS System Message Manual and found such number error like

    - 1418 : <X,Y,Z,A,B,C> Base not defined

    - 1419 : <X,Y,Z,A,B,C> Tool not defined

    - 1422 : Reading < Variable $> Incorrect value

    So my question is the following one :

    Should I identify the error codes that relate to my case? Or it does not pose a real problem of safety?

    I'm afraid to bypass another error by leaving >0

    Thanks in advance

  • MOM
    Reactions Received
    176
    Trophies
    7
    Posts
    1,424
    • June 17, 2022 at 9:12 AM
    • #7

    If tool (error 1419) and base (err 1418) are not defined then the result is undefined (err 1422).

  • Lucasss
    Trophies
    2
    Posts
    24
    • June 17, 2022 at 9:18 AM
    • #8

    Hello MOM,

    I see,

    then do you think these two error code are enough for my case ? :thinking_face:

    I'm searching in the KSS Manual in case of similar error,

    Thks

    NB : I forgot to tell you that this robot is part of a cell with a press and security elements, that's why I would like to avoid passing any erroneous code

  • Lucasss
    Trophies
    2
    Posts
    24
    • June 17, 2022 at 11:26 AM
    • #9

    Update : I found this post having the same problem,

    How to get robot current postion in a .sub programm - KUKA Robot Forum - Robotforum - Support and discussion community for industrial robots and cobots (robot-forum.com)

    Clearly it seems to have no way to get these informations in real time,

    Thx for help

  • Lucasss June 17, 2022 at 11:26 AM

    Changed the title of the thread from “Mapping I/O KRC4” to “Mapping I/O KRC4 | Get Current Cartesian Position”.
  • Online
    panic mode
    Reactions Received
    1,294
    Trophies
    11
    Posts
    13,126
    • June 17, 2022 at 2:28 PM
    • #10

    depends on your definition of real time. submit is slow and low priority task.

    you can use RSI or FSD instead of IOs and submit. then you get position data down to 1ms.

    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
    SkyeFire
    Reactions Received
    1,060
    Trophies
    12
    Posts
    9,456
    • June 17, 2022 at 4:25 PM
    • #11
    Quote from Lucasss

    Should I identify the error codes that relate to my case? Or it does not pose a real problem of safety?

    I'm afraid to bypass another error by leaving >0

    Using ON_ERR_PROCEED only applies to the next line of KRL code -- so ON_ERR_PROCEED on Line 1 only applies to Line 2. By line 3, the ON_ERR_PROCEED "trap" has "expired". So the odds of any other error being "caught" is extremely low. Any error that occurs on a line that is not immediately preceded by ON_ERR_PROCEED will be be caught by the system error handler and halt the program. Also, ON_ERR_PROCEED will not affect errors like collisions, E-Stops, communications failures, etc.

    It does not create a safety issue, b/c none of this code is safety-qualified, and as such should never be used for safety-critical interlocks.

  • MOM
    Reactions Received
    176
    Trophies
    7
    Posts
    1,424
    • June 17, 2022 at 11:23 PM
    • #12

    One option (especially for press lines) could be a soft plc (from kuka) having direct access to actual robot position in real time

  • Lucasss
    Trophies
    2
    Posts
    24
    • June 20, 2022 at 9:07 AM
    • #13
    Quote from panic mode

    depends on your definition of real time. submit is slow and low priority task.

    you can use RSI or FSD instead of IOs and submit. then you get position data down to 1ms.

    Thanks @PanicMode but i'm was searching for a free way to do it, just for some program tests not for the overall operation.

    But it's likely what i'm trying to do, i will consider the fact that it's not really possible for free,

    Quote from SkyeFire

    Using ON_ERR_PROCEED only applies to the next line of KRL code -- so ON_ERR_PROCEED on Line 1 only applies to Line 2. By line 3, the ON_ERR_PROCEED "trap" has "expired". So the odds of any other error being "caught" is extremely low. Any error that occurs on a line that is not immediately preceded by ON_ERR_PROCEED will be be caught by the system error handler and halt the program. Also, ON_ERR_PROCEED will not affect errors like collisions, E-Stops, communications failures, etc.

    It does not create a safety issue, b/c none of this code is safety-qualified, and as such should never be used for safety-critical interlocks.

    Thanks SkyeFire,

    I didnt catch the fact that only the error of the current line is aim,

    I guess that the code i post will make me more error than data i can use,

    Quote from MOM

    One option (especially for press lines) could be a soft plc (from kuka) having direct access to actual robot position in real time

    Thanks Mom, did you have something in mind about a soft plc ? Something like mxAutomation from KUKA ?

  • Lucasss
    Trophies
    2
    Posts
    24
    • June 20, 2022 at 10:30 AM
    • #14

    Update : General conversion between different coordinate system types (KUKA, Fanuc, ABB, etc) - Page 2 - Robot Geometry, Linear Algebra, Forward and Inverse Kinematics - Robotforum - Support and discussion community for industrial robots and cobots (robot-forum.com)

    I find this post questioning about position with axis and the conversion from matrix to coordinates.

    Do you think it's possible to get the $AXIS_POS_MES in "real time" (around 10ms) thanks to I/O and then convert it through the HMI using maths ? (even if the coordinate are according to the world base)

    Thx in advance, :winking_face:

    Edited once, last by Lucasss (June 20, 2022 at 10:36 AM).

  • hermann
    Reactions Received
    410
    Trophies
    9
    Posts
    2,621
    • June 20, 2022 at 10:58 AM
    • #15

    The same as with $pos_act_meas, real time 10ms only with options, "something like" realtime with about 24ms with sps.sub.

  • Lucasss
    Trophies
    2
    Posts
    24
    • June 20, 2022 at 11:09 AM
    • #16

    24ms seems good for my use, do you think it's possible to make it works as i described before (post #6)?

  • hermann
    Reactions Received
    410
    Trophies
    9
    Posts
    2,621
    • June 20, 2022 at 12:22 PM
    • #17

    Yes

  • Lucasss
    Trophies
    2
    Posts
    24
    • June 20, 2022 at 12:42 PM
    • #18

    Nice, thanks all again, have a nice day

  • Online
    panic mode
    Reactions Received
    1,294
    Trophies
    11
    Posts
    13,126
    • June 20, 2022 at 2:10 PM
    • #19

    not sure if this was resolved or not but your initial post shows signal declarations that are 33-bit wide. that will not work of course. maximum width for signal is 32-bit.

    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

  • Lucasss
    Trophies
    2
    Posts
    24
    • June 20, 2022 at 2:13 PM
    • #20

    I will try asap, I must have made a mistake when doing the count, thank you

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

Similar Threads

  • KRC4 Enabling Switch Timeout Error

    • robonovak
    • May 10, 2022 at 7:38 PM
    • KUKA Robot Forum
  • KRC4 Compact and Omron NX1P2 Ethernet IP Communication

    • senturkkomer
    • November 21, 2021 at 8:05 PM
    • KUKA Robot Forum
  • EL4004 analogue output setup with EL6692 I/O Mapping KRC4

    • akaaschool
    • June 15, 2022 at 1:52 PM
    • KUKA Robot Forum
  • KRC4 Ethernet/IP mapping

    • legityme
    • January 17, 2022 at 3:49 PM
    • KUKA Robot Forum
  • Errors in KRC4 when IO Mapping EL6692 for CX9020

    • spp
    • October 31, 2021 at 12:24 PM
    • KUKA Robot Forum
  • Change KRC4 Profinet default IO addresses - WoV IO mapping

    • Agustin Costa
    • February 11, 2021 at 1:06 AM
    • KUKA Robot Forum
  • transfer integer value between PLC and KRC4

    • Lochon Matthieu
    • July 22, 2019 at 3:22 PM
    • KUKA Robot Forum
  • KRC4 IO-mapping

    • Plc_User
    • October 2, 2019 at 3:33 PM
    • KUKA Robot Forum
  • Kuka TwinCAT configuration change

    • bagged2drag
    • September 12, 2018 at 7:57 PM
    • KUKA Robot Forum
  • Mapping KRC4 variables

    • debjitghosh
    • August 20, 2018 at 8:37 PM
    • KUKA Robot Forum

Tags

  • I/O
  • output
  • position
  • input
  • $POS_ACT
  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