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

KUKA RSI: Get $TOOL & $BASE

  • s2007.ravi
  • June 7, 2021 at 8:06 PM
  • Thread is Unresolved
  • s2007.ravi
    Reactions Received
    14
    Trophies
    4
    Posts
    585
    • June 7, 2021 at 8:06 PM
    • #1

    Hi All,

    RSI: 3.3.3.267

    KSS: V8.3.320/KUKA8.3

    I have been developing an application to communicate with a KRC4 controller over RSI. I have developed an external UDP Server application (running on my computer) that talks to the robot and fetches some data such as cartesian and axes positions, etc. I have gone through the manuals and tried to find a way to send the real-time values of actual TOOL and BASE to the external application from the robot. However, in the manual and the examples, I could not find any RSI block that I can use in RSI Visual to get these system variables and send over the bus.

    If anyone has achieved this, then please help me with the idea of programming it.

    Thanks

  • colinb83
    Reactions Received
    13
    Trophies
    2
    Posts
    102
    • June 7, 2021 at 8:10 PM
    • #2

    Does your tool and base change?

  • s2007.ravi
    Reactions Received
    14
    Trophies
    4
    Posts
    585
    • June 7, 2021 at 8:19 PM
    • #3
    Quote from colinb83

    Does your tool and base change?

    Yes, in some of the applications they do change. For example, at the beginning of the src file, the robot motions are w.r.t to $WORLD and then the BASE can change as per the workpiece.

  • Online
    SkyeFire
    Reactions Received
    1,051
    Trophies
    12
    Posts
    9,422
    • June 7, 2021 at 11:57 PM
    • #4

    IIRC, there are RSI objects that can access the $SEN_PREA system variables. You might be able to have the SPS assign $TOOL and $BASE values to those variables.

  • s2007.ravi
    Reactions Received
    14
    Trophies
    4
    Posts
    585
    • June 8, 2021 at 8:21 PM
    • #5
    Quote from SkyeFire

    IIRC, there are RSI objects that can access the $SEN_PREA system variables. You might be able to have the SPS assign $TOOL and $BASE values to those variables.

    Thanks for the suggestion. I did exactly the same. However, when the submit gets launched or a new value to the current TOOL or BASE gets assigned, it throws an error saying invalid X value or invalid Y value, These errors are random.

    With KRC4, I observed that it throws the above-mentioned errors when the TOOL and BASE are assigned to unknown. Once a valid value is assigned, it works fine. However, when I run the program and current TOOL and BASE get reassigned, the error comes back randomly. I will have to dig into it and find a workaround.

  • colinb83
    Reactions Received
    13
    Trophies
    2
    Posts
    102
    • June 8, 2021 at 9:13 PM
    • #6

    Don't forget you can always ask kuka tech support, some clever guys there that know the tech packs far more than is explained in the documentation

  • Online
    SkyeFire
    Reactions Received
    1,051
    Trophies
    12
    Posts
    9,422
    • June 9, 2021 at 2:49 PM
    • #7

    Yes, under certain conditions (cold boot, Program Cancel), $BASE and $TOOL get set to Uninitialized. You get around this by using ON_ERR_PROCEED in your SPS -- if an attempt to copy $BASE or $TOOL into $SEN_PRES returns an error, skip it and keep going.

  • s2007.ravi
    Reactions Received
    14
    Trophies
    4
    Posts
    585
    • June 10, 2021 at 7:37 PM
    • #8

    Sorry for the late reply.

    Thank you SkyeFire for the heads up. For now, I put protection in the code using VARSTATE.

    Code
    IF VARSTATE("$BASE") == #INITIALIZED THEN
      $SEN_PREA[1] = $BASE.X
      $SEN_PREA[2] = $BASE.Y
      $SEN_PREA[3] = $BASE.Z
      $SEN_PREA[4] = $BASE.A
      $SEN_PREA[5] = $BASE.B
      $SEN_PREA[6] = $BASE.C
    ENDIF

    I tested the code and it works fine.

  • Online
    panic mode
    Reactions Received
    1,278
    Trophies
    11
    Posts
    13,076
    • June 11, 2021 at 7:22 AM
    • #9

    that may work for most cases but ... it is not ideal. you are assuming that someone will always initialize all elements. that is not a safe assumption. it is better to check each element individually if initialized....

    if you don't believe me, simply when you see $base not initialized (shows up as ? on the smartPad), you can try to give it value such as { X 0} using either program or variable monitor.

    or create new program with some test code like this:

    DEF VAR_INIT_TEST()

    DECL FRAME f

    f = {X 0}

    $BASE = f

    IF VARSTATE("$BASE")==#INITIALIZED THEN

    $SEN_PREA[1] = $BASE.X

    $SEN_PREA[2] = $BASE.Y

    $SEN_PREA[3] = $BASE.Z

    $SEN_PREA[4] = $BASE.A

    $SEN_PREA[5] = $BASE.B

    $SEN_PREA[6] = $BASE.C

    ENDIF

    END


    although you only initialized one element add other five are still not initialized, your check will say that $BASE is initialized (which is not exactly true) and the program will crash when it reaches line 3.

    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,051
    Trophies
    12
    Posts
    9,422
    • June 11, 2021 at 2:28 PM
    • #10

    One problem with using VARSTATE in the SPS on certain system variables like $BASE and $TOOL is that the Level 0 interpreter (SPS) and Level 1 Interpreter ("normal" programs, usually with motion) are completely asynchronous.

    This means that, even if VARSTATE shows $BASE as being Initialized, it's possible for $BASE to change to an uninitialized state in between your SPS's VARSTATE check and the next line. I had this happen way back when I first tried doing something similar to what you're attempting now. If you roll the dice often enough, eventually you'll come up snakeeyes.

    The more robust approach is to place a ON_ERR_PROCEED immediately before each $SEN_PREA= line. Maybe follow it with a command to check the $ERR return state and, if there was a fault, fill the $SEN_PREA with deliberate nonsense (like -99999 or something) that will act as a signal to your server to not trust the $SEN_PREA values.

  • s2007.ravi
    Reactions Received
    14
    Trophies
    4
    Posts
    585
    • June 20, 2021 at 1:56 PM
    • #11

    panic mode and SkyeFire

    You both are right. The program failed after working fine for a few attempts throwing error KSS01422 i.e. ($variable value Invalid) for one of the sub-elements of $BASE.

    I will modify the code and test on the next available opportunity and port an update here.

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

  • How to create custom HMI on KUKA KCP???

    • LCotta
    • November 13, 2014 at 11:08 AM
    • KUKA Robot Forum
  • KUKA Move in #TOOL

    • iljalways
    • June 19, 2018 at 3:57 PM
    • KUKA Robot Forum
  • Kuka workspace error after transferring program

    • p0nder
    • May 3, 2018 at 5:38 PM
    • KUKA Robot Forum
  • Kuka KRC1 - Transferring files between robots

    • maaron
    • March 15, 2018 at 8:04 PM
    • KUKA Robot Forum
  • Milling With KUKA

    • Moriii6530
    • December 4, 2017 at 6:09 AM
    • KUKA Robot Forum
  • Need help with Link b/t SprutCAM & Kuka KR 30/2

    • neeboy74
    • November 30, 2013 at 5:34 AM
    • KUKA Robot Forum
  • about the sequence of calibrating tool frame and base frame in KRC4

    • dinesh_harsoliya
    • August 10, 2017 at 12:45 PM
    • KUKA Robot Forum
  • Using LK_Base (Roboteam) outside inline form

    • MissM
    • June 29, 2017 at 11:08 PM
    • KUKA Robot Forum
  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