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

Fanuc karel leading zeros

  • petro1909
  • May 4, 2024 at 6:40 PM
  • Thread is Unresolved
  • petro1909
    Trophies
    2
    Posts
    4
    • May 4, 2024 at 6:40 PM
    • #1

    Hello everyone. I have a problem with fanuc data with Real type. For my task i need to convert my cartesian robot position into string and send it to external device. But in Fanuc system, if data is in range from -1 to 1, then there is no leading zeros. So data such as 0.234 looks like .234. So because of there is no leading zeros external device can't parse robot position. To convert position i use CURPOS(0,0) to get current position and then for each coordiante CNV_REAL_STR routine to convert from real to string.

    I wrote a simple routine that check, if coordinate is between -1 and 1 and add leading zero to start of converted coordinate, but maybe there is standart buildin karel routine to keep leading zeros active, or maybe system variable to include leading zeros?

  • Fubini May 4, 2024 at 7:13 PM

    Approved the thread.
  • kalhonl
    Posts
    4
    • July 30, 2024 at 9:42 PM
    • #2

    Any chance you could post some code. I am doing the same at the minute but I am having trouble converting each position from a REAL to a STRING using CNV_REAL_STR when I look at the strings in roboguide I just get a bunch of asterisk *****

  • PnsStarter
    Reactions Received
    95
    Trophies
    6
    Posts
    337
    • July 31, 2024 at 8:28 AM
    • #3

    Hi

    when using "CNV_REAL_STR"

    check the length and num_digits argument!

    Syntax : CNV_REAL_STR(source, length, num_digits, target)

    Details:

    • source is the REAL value to be formatted.
    • length specifies the minimum length of the target . The actual length of target may be greater if
    required to contain the contents of source and at least one leading blank.
    • num_digits specifies the number of digits displayed to the right of the decimal point. If num_digits
    is a negative number, source will be formatted in scientific notation (where the ABS( num_digits )
    represents the number of digits to the right of the decimal point.) If num_digits is 0, the decimal
    point is suppressed.
    • If length or num_digits are invalid, target is returned uninitialized.
    • If the declared length of target is not large enough to contain source with one leading blank, target is returned with one leading blank and the rest of its declared length filled with ``*''s (asterisks).


    Best

    Backdate/TP-Tools: A small collection of tools that simplify the commissioning and programming of Fanuc robots. (github.com)

  • hoitzing
    Reactions Received
    24
    Trophies
    1
    Posts
    128
    • July 31, 2024 at 8:28 AM
    • #4

    From the KAREL manual, CNV_REAL_STR documentation. Sounds like your string is too small to contain the number.

  • kalhonl
    Posts
    4
    • July 31, 2024 at 1:21 PM
    • #5

    Thanks 🙏

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
  • Real Number
  • leading zeros
  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