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

Error with CNV_REAL_STR or other reason for blank string

  • jcol
  • April 2, 2024 at 11:27 AM
  • Thread is Resolved
  • jcol
    Trophies
    1
    Posts
    3
    • April 2, 2024 at 11:27 AM
    • #1

    Hi all,

    I'm experiencing a bug on my system that seemingly defies reason.

    A KAREL program gets the current robot position using CURPOS, sets the current coordinates into a series of real variables. Then CNV_REAL_STR converts these variables into strings, groups then together to transfer over socket coms to a PC.

    The problem is that under seemingly random conditions, the string variable storing the current z position (CUR_Z_STR in the code attached) returns an empty value.

    When this happens, the program will continue this behaviour, printing this variable blank. The program can be aborted, the system power cycled, the robot moved, nothing fixes this blank variable. The only thing that fixes it is to delete the Karel program where this runs (check_align_speed.kl in attached code) and reuploading the exact same code. I don’t know what this changes.

    The other perplexing part of this error is that the exact same real to string conversion is happening in x,y,z,w,p,r & ext1 but only z ever seems to fail. As part of troubleshooting for this I have printed the real variable from CURPOS which shows a non-blank seemingly innocuous number (e.g. 1.09168E+03).

    Does anyone know what could cause an error like this? How to prevent it from happening or a way for the system to recover itself?

    Code
    CUR_POS : XYZWPREXT 
    CUR_X_STR : STRING[9]
    CUR_Y_STR : STRING[9]
    CUR_Z_STR : STRING[9]
    CUR_W_STR : STRING[9]
    CUR_P_STR : STRING[9]
    CUR_R_STR : STRING[9]
       
    SEND_POSE('robot2,')
    WRITE('sending current TCP position', CR, CUR_X_STR, CUR_Y_STR, CUR_Z_STR, CR, CUR_W_STR, CUR_P_STR, CUR_R_STR, CR, CUR_EXT1_STR, CR)
    Code
    --================================================================--
                ROUTINE SEND_POSE (NICKNAME: STRING)
    --================================================================--
    
    BEGIN
    
        -- Get current robot pose
        $GROUP[1].$UTOOL = $MNUTOOL[1,$MNUTOOLNUM[1]]
        $GROUP[1].$UFRAME = $MNUFRAME[1,$MNUFRAMENUM[1]]
        CUR_POS = CURPOS(0,0)
        -- CONVERT REAL TO STRING
        -- 9 CHARACHTERS WITH 3 AFTER DECI POINT
        CNV_REAL_STR(CUR_POS.X, 9, 3, CUR_X_STR)
        CNV_REAL_STR(CUR_POS.Y, 9, 3, CUR_Y_STR)
        CNV_REAL_STR(CUR_POS.Z, 9, 3, CUR_Z_STR)
        CNV_REAL_STR(CUR_POS.W, 9, 3, CUR_W_STR)
        CNV_REAL_STR(CUR_POS.P, 9, 3, CUR_P_STR)
        CNV_REAL_STR(CUR_POS.R, 9, 3, CUR_R_STR)
        CNV_REAL_STR(CUR_POS.EXT1, 9, 3, CUR_EXT1_STR)
    
        CUR_POS_STR = 'current robot pose:'+CUR_X_STR+';'+CUR_Y_STR+';'+CUR_Z_STR+';'+CUR_W_STR+';'+CUR_P_STR+';'+CUR_R_STR+';'+CUR_EXT1_STR
    
        ASK_FOR_DATA(NICKNAME, CUR_POS_STR)
    
    END SEND_POSE
    Display More
  • MOM April 2, 2024 at 11:38 AM

    Approved the thread.
  • jcol
    Trophies
    1
    Posts
    3
    • April 2, 2024 at 11:44 AM
    • #2

    The controller is a 30iB plus - A. Robot is a FANUC R-2000iC/165F.

  • jcol
    Trophies
    1
    Posts
    3
    • May 2, 2024 at 5:17 PM
    • #3

    Hi anyone,


    After lots of hairpulling I did manage to squash this bug. No idea what was causing it. For the problematic float I converted it to a int (by multiplying it by 1000 and rounding) then using CNV_REAL_INT to turn it into a string.

    The bug still occurred but instead of the string appearing blank it would appear as a large seemingly random number. After some investigation it seemed to be some kind of stack underflow error where instead of the result being z, the result was 2^24-z. An extra condition on the PC was added to correct for this when z was extremely large.

  • Nation
    Typical Robot Error
    Reactions Received
    556
    Trophies
    9
    Posts
    1,937
    • May 3, 2024 at 3:15 AM
    • #4

    Nice job reporting back your findings. I wonder if it is a bug in the CNV_REAL_STR, or something like a unicode character that was causing it.

    Check out the Fanuc position converter I wrote here! Now open source!

    Check out my example Fanuc Ethernet/IP Explicit Messaging program 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
  • krc5
  • KRL
  • KUKA
  • motoman
  • Offset
  • PLC
  • PROFINET
  • Program
  • Programming
  • RAPID
  • 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
  • krc5
  • KRL
  • KUKA
  • motoman
  • Offset
  • PLC
  • PROFINET
  • Program
  • Programming
  • RAPID
  • roboguide
  • robot
  • robotstudio
  • RSI
  • safety
  • Siemens
  • simulation
  • SPEED
  • staubli
  • tcp
  • TCP/IP
  • teach pendant
  • vision
  • Welding
  • workvisual
  • yaskawa
  • YRC1000

Tags

  • Fanuc
  • karel
  • string
  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