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

Send the current position of the robot through profinet

  • ss.sun
  • September 6, 2019 at 4:17 AM
  • Thread is Unresolved
  • ss.sun
    Trophies
    3
    Posts
    35
    • September 6, 2019 at 4:17 AM
    • #1

    I have a fanuc robotics, the control cabinet is R30IB mate plus, has complete profinet communication with PLC, the next need robot sent via profinet robot the current position, how to implement?
    Send the real type (32 bits), does anyone know how to implement it, thanks.

  • Go to Best Answer
  • HawkME
    Reactions Received
    568
    Trophies
    10
    Posts
    3,268
    • September 6, 2019 at 3:27 PM
    • #2

    To monitor current position:

    Set $SCR_GRP[1].$M_POS_ENB to true

    Then for current joint angles you can monitor

    $SCR_GRP[1].$MCH_ANG[0 to 6]

    And for current Cartesian position relative to active Frames you can monitor:

    $SCR_GRP[1].$MCH_POS_X (and y,z,w,p,r)

    To monitor current TCP speed:

    Set $SCR_GRP[1].$M_DST_ENB to true

    and monitor $SCR_GRP[1].$MCH_SPD


    To send position to the PLC you can create a BGlogic program to copy the current position values from the system variables into registers. Then in your PLC program create the logic to read those register values periodically.

  • scotty
    Reactions Received
    43
    Trophies
    5
    Posts
    497
    • September 6, 2019 at 3:32 PM
    • Best Answer
    • #3

    You need to do next:

    $SCR_GRP[1].$M_POS_ENB set to TRUE

    then you can get data from:

    $SCR_GRP[1].$MCH_POS_X/Y/Z/W/P/R

    or you can take angle positions:

    $SCR_GRP[1].$MCH_ANG[1-9]

    current speed

    $SCP_GRP[1].$MCH_SPD

    if you want to transfer through Profinet, then just take data convert to integers values and send via GO. on PLC side just collect the data and represent in a way you want.

  • ss.sun
    Trophies
    3
    Posts
    35
    • September 7, 2019 at 3:17 AM
    • #4
    Quote from scotty

    You need to do next:

    $SCR_GRP[1].$M_POS_ENB set to TRUE

    then you can get data from:

    $SCR_GRP[1].$MCH_POS_X/Y/Z/W/P/R

    or you can take angle positions:

    $SCR_GRP[1].$MCH_ANG[1-9]

    current speed

    $SCP_GRP[1].$MCH_SPD

    if you want to transfer through Profinet, then just take data convert to integers values and send via GO. on PLC side just collect the data and represent in a way you want.

    Display More

    Thank you very much, have according to you said method through GO successfully sent the current position.
    But, PLC program has been completed and cannot be changed, PLC side receive 32 for floating point number.Excuse me what method can be implemented by PROFINET directly to 32-bit floating point Numbers?

  • rumblefish
    Reactions Received
    19
    Trophies
    2
    Posts
    131
    • September 9, 2019 at 5:01 PM
    • #5

    Unfortunately I don't think you're not going to be able to send reals over profinet. You will have to modify the plc code for this. I just recently implemented this same solution with an S7-1500 and R30iB. I ended up creating a macro that updates the plc with the current robot position.

    The trick is to separate the decimal value from the whole number. Value 1 is the left side of the decimal, value 2 is the right side of the decimal. The DO (737) is an indicator to the plc that the value is negative. The plc basically will run the math in reverse and reattach the two values. Hopefully this helps.

    I should note that I have the math tools option installed.

    1: !******************************** ;

    2: !Position Output Macro ;

    3: ;

    4: !This macro separates the two ;

    5: !side of the decimal point ;

    6: !in to two whole numbers ;

    7: !******************************** ;

    8: ;

    9: ;

    10: PR[150:Pos Out LPOS]=LPOS ;

    11: ;

    12: !******************************** ;

    13: !Configure X Axis Output ;

    14: !******************************** ;

    15: R[150:MC Pos Out Var 1]=PR[150,1:Pos Out LPOS] ;

    16: ;

    17: !Check If Negative ;

    18: IF (R[150:MC Pos Out Var 1]<0),DO[737:OFF]=(ON) ;

    19: R[150:MC Pos Out Var 1]=(ABS[R[150]]) ;

    20: R[151:Pos Out X Val 1]=(TRUNC[R[150]]) ;

    21: R[152:Pos Out X Val 2]=R[150:MC Pos Out Var 1]-R[151:Pos Out X Val 1] ;

    22: R[152:Pos Out X Val 2]=(R[152:Pos Out X Val 2]*1000) ;

    23: R[152:Pos Out X Val 2]=(TRUNC[R[152]]) ;

    24: ;

    25: GO[1:0:Echo Pos X Val 1]=R[151:Pos Out X Val 1] ;

    26: GO[2:0:Echo Pos X Val 2]=R[152:Pos Out X Val 2] ;

    Edited once, last by rumblefish (September 9, 2019 at 5:40 PM).

  • scotty
    Reactions Received
    43
    Trophies
    5
    Posts
    497
    • September 10, 2019 at 12:19 AM
    • #6
    Quote from rumblefish

    Unfortunately I don't think you're not going to be able to send reals over profinet. You will have to modify the plc code for this. I just recently implemented this same solution with an S7-1500 and R30iB. I ended up creating a macro that updates the plc with the current robot position.

    The trick is to separate the decimal value from the whole number. Value 1 is the left side of the decimal, value 2 is the right side of the decimal. The DO (737) is an indicator to the plc that the value is negative. The plc basically will run the math in reverse and reattach the two values. Hopefully this helps.

    I do in same way :smiling_face:

    ss.sun

    You will need to take a look how your float val realized inside of your PLC. Depends how you did set up of your group of inputs.

  • zahid990170
    Trophies
    2
    Posts
    41
    • July 9, 2021 at 1:04 PM
    • #7

    rumblefish if you or another person reads this comment kindly answer.

    I have used the similar method of separating a float value such as 123.4567 into two parts, part "a" on the left side of the decimal point i.e., 123, and part "b" on the right side of the decimal point i.e., 4567. And, then I use reverse logic to reattach the two parts ("a" and "b"). However, I have a question,

    Imagine the value is 12.00053, now, part "a" = 12, part "b" = 53 instead of 00053. When I reattach, I can only get 12.53 instead of 12.00053. Is there any easy fix for the above using TP programming options. What other suggestions that can help me to receive the correct value.

    thanks for your help.

    Zahid

  • scotty
    Reactions Received
    43
    Trophies
    5
    Posts
    497
    • July 9, 2021 at 3:09 PM
    • #8
    Quote from zahid990170

    rumblefish if you or another person reads this comment kindly answer.

    I have used the similar method of separating a float value such as 123.4567 into two parts, part "a" on the left side of the decimal point i.e., 123, and part "b" on the right side of the decimal point i.e., 4567. And, then I use reverse logic to reattach the two parts ("a" and "b"). However, I have a question,

    Imagine the value is 12.00053, now, part "a" = 12, part "b" = 53 instead of 00053. When I reattach, I can only get 12.53 instead of 12.00053. Is there any easy fix for the above using TP programming options. What other suggestions that can help me to receive the correct value.

    thanks for your help.

    Zahid

    If you use 10-5 then just use *10 multiplier in your logic.

    12.00053 - initial number.

    12 -> goes into register 1

    0.00053 -> goes into register 2

    100000 * 0.00053 = 53. Send this data to you destination device.

    Before you compile these 2 numbers together, do not forget to divide 53 / 100000 to get your real data.

  • jmd2777
    Reactions Received
    34
    Trophies
    4
    Posts
    193
    • July 9, 2021 at 3:10 PM
    • #9

    A common practice is to use a multiplier. For example, multiply the number by 10000 and then send it. Once its received, divide by 10000.

    You have to be careful not to exceed the max value of a 16 bit register.

  • zahid990170
    Trophies
    2
    Posts
    41
    • July 9, 2021 at 3:33 PM
    • #10

    thank you jmd2777 that solved the issue.

  • zahid990170
    Trophies
    2
    Posts
    41
    • July 9, 2021 at 4:13 PM
    • #11
    Quote from scotty

    If you use 10-5 then just use *10 multiplier in your logic.

    12.00053 - initial number.

    12 -> goes into register 1

    0.00053 -> goes into register 2

    100000 * 0.00053 = 53. Send this data to you destination device.

    Before you compile these 2 numbers together, do not forget to divide 53 / 100000 to get your real data.

    Display More

    thanks scotty

  • Dgsuarez86
    Trophies
    3
    Posts
    5
    • July 31, 2021 at 11:26 PM
    • #12

    Hi all! First of all i want to thank you for your time, I use this forum almost all the time :smiling_face:

    My question is: how do you separate this two values? (Left&right side of de decimal) I think that the trunc instruction it's for this purpose but, what if you don't have the math tools option? ( I assume it becomes within it)

    Thanks again!

  • scotty
    Reactions Received
    43
    Trophies
    5
    Posts
    497
    • August 2, 2021 at 3:34 PM
    • #13
    Quote from Dgsuarez86

    Hi all! First of all i want to thank you for your time, I use this forum almost all the time :smiling_face:

    My question is: how do you separate this two values? (Left&right side of de decimal) I think that the trunc instruction it's for this purpose but, what if you don't have the math tools option? ( I assume it becomes within it)

    Thanks again!

    You can use a logic from reply above or I do a bit different way. I use MOD/DIV as I remember. I do not have Roboguide next to me know for test, I hope it works:

    Code
    !R[100] - initial num
    !R[101] - integer part
    !R[102] - float part
    
    R[101] = R[100] DIV 1
    R[102] = R[100] - R[101]
  • Dgsuarez86
    Trophies
    3
    Posts
    5
    • August 3, 2021 at 6:55 AM
    • #14

    Thanks for your quick reply scotty ! I will try it!

  • Sergei Troizky
    Reactions Received
    67
    Trophies
    6
    Posts
    650
    • August 6, 2021 at 12:49 AM
    • #15

    Integer part:

    R[101] = R[100] DIV 1

    Decimal fractional part:

    R[102] = R[100] MOD 1

    For negative R[100], both will be negative.

    Do it well right away. It will become bad by itself.

  • SkyeFire
    Reactions Received
    1,044
    Trophies
    12
    Posts
    9,391
    • July 1, 2022 at 2:59 PM
    • #16

    Doing a bit of threadcromancy on this topic, b/c I just ran into something odd the first time I encountered a robot using these variables.

    Short version: this was a brand-new R30iB+ running V9.3 with a non-synchronous 7th axis, and it was "inheriting" some BG code that copied $SCR_GRP[2].MCH_ANG[1] into a Register, and from the Register into a GO. I tested it by jogging the 7th axis, and everything worked as intended.

    But I didn't do any programming -- I was only on-site to do the hardware and core software setup, the customer had their own programmer coming in a week or two later to generate and install their offline programs.

    And that's where it gets weird -- when they ran a program, the R and GO did not update. But when jogging the axis, they did update.

    It gets stranger: I booted up my virtual copy of that robot in RG, and tested it for myself. And in RG, the R and GO failed to update in either jog or program execution. So, it was behaving differently between the real robot, and a virtual robot built from a backup of that robot.

    The core issue was that I hadn't known I needed to set $SCR_GRP[2].$M_POS_ENB to True. As soon as we did that (in both the real and virtual robots), they both worked entirely as intended.

    But the discrepancies are very odd, and something to look out for if anyone encounters this in the future.

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