FANUC Robot - PC: Communication protocols

  • Hello there,


    Let me introduce myself, I am a student Industrial Automaton currently in my junior year.


    I am working on a project with the following equipment from FANUC:

    FANUC Robot LR Mate 200iC/5L

    R30iA Mate Controller - Software version 7.70

    PC Windows 10 - Python app


    I want to read the robot position in the world-coordinate system (preferably as soon as possible). By means of these values I will make calculations to make another machine sync with the robot.

    I have already searched a bit about the communication protocols: Modbus TCP/IP, Ethernet/IP or Communication via Socket Messaging TCP/IP. I know some options require a license, this is not a problem.


    My question is:

    1) Which protocol is best to use if I want to send information from the robot to an application in Python on my PC?

    2) Another approach will be: Sending position data to the robot. Is this easier to get done?

    Thanks in advance.

  • Place your Ad here!
  • tboekhorst

    Changed the title of the thread from “FANUC Robot Communication protocols” to “FANUC Robot - PC: Communication protocols”.
  • Thanks for the reaction Fabian Munoz.

    I found sending group outputs XYZ WPR coordinates:


    GO[1:X POS]=($SCR_GRP[1].$MCH_POS_X*10)

    GO[2:Y POS]=($SCR_GRP[1].$MCH_POS_Y*10)

    GO[3:Z POS]=($SCR_GRP[1].$MCH_POS_Z*10)

    GO[4:W ANG]=($SCR_GRP[1].$MCH_POS_W*100)

    GO[5:P ANG]=($SCR_GRP[1].$MCH_POS_P*100)

    GO[6:R ANG]=($SCR_GRP[1].$MCH_POS_R*100)


    Note that I’ve multiplied the X, Y, and Z positions by 10, so Iwill have to divide by 10 in my PC program. Likewise I multiplied the W, P, and R angles by 100, so divide by 100.


    Run this as a program in the background with BG Logic.

    However in which way can I send the data to my PC?

  • Thanks HawkME for the anwswer.


    Important note that I forgot to mention.

    Firstly I want to try only writing the position data of the robot 'as fast as possible', so +- every 8ms from FANUC to PC.


    1 ) Is it possible to send GO (Group Outputs) with TCP/IP, Socket Server Messaging?

    Therefore will need a KAREL script if I am not mistaking.


    R648 - User Socket Messaging

    R632 - KAREL


    2) What about using CRMA15 (CRMA62) and CRMA16 (CRMA63)?

    Or is this only for DI/DO?

  • 8ms is pretty fast. I think socket messaging with karel is the right option for this but I have not done it myself. Others on the forum can chime in if you have more questions.


    1. You don't want GOs. Those are max of 16 bit Integers. Instead you will want to read a register value.


    2. DI/DO only. Not what you want either.


    You will want to either read the position system variable directly or first store it in a register then read it from there.

  • I just now realized you said "write" not "read". Reading position will be easier. If you write position data that implies you want the robot to move to that position. You could do that by writing a position to registers then triggering the robot to move to that position in a TP program.

  • Check out this thread for using the pyModbus library for using Python and Modbus TCP to communicate between a robot and a PC. We have the HMI (SNPX) option in our robots that allows for Modbus TCP comm. Assuming you can also use the Modbus TCP option.

  • I want to read the robot position in the world-coordinate system (preferably as soon as possible). By means of these values I will make calculations to make another machine sync with the robot.

    Sorry for not clearifing enough.


    I made a brief summory:


    If read the robot positioning to PC:

    You will want to either read the position system variable directly or first store it in a register then read it from there.


    If writing the robot positioning from PC:

    You could do that by writing a position to registers then triggering the robot to move to that position in a TP program.


    Option 1) EXPLICIT MESSAGING

    Option 2) Tcp/ip or Http, User Socket Messaging

    Option 3) Using the pyModbus library for using Python and Modbus TCP to communicate between a robot and a PC. However, hawkME is telling TCP Modbus is typically done with a PLC.


    I will look into this. Thanks for your help so far.


    This morning I was in contact with a fanuc engineer, explained the situation and he advised to use FANUC Linetracking software and hardware.

    Any thoughts?

  • I wasn't aware of the PyModbus library. That sounds like a viable option as well.


    Linetracking is for coordination of robot motion with a moving conveyor. You didn't really tell us what your application is so I can't comment on if that would be helpful.

  • Let me explain to you what kind of system is involved. It is called a flexible transport system (FTS).


    see the following video: FTS


    The robot must be synchronized with a carrier of this FTS system. Imagine that the track is in a cirkle like in the video (also see attachment). The robot is attached to the platform and must rotate a semicircle with a carrier of FTS from point A to B. When the movement is finished it goes back to point A and waits for a new carrier.


    Eventually the robot will have to perform a specific movement (depends on the customer), but for now I want to have the robot arm running synchronize with the carrier (from A to B) at all times.


    What do you think could be a valuable option to make this work?

  • By synchronized do you mean that the robot and the carriage can be moving at the same time relative to each other (complex).


    Or do you mean the carrier will move to a location, stop, then the robot will does something. Then the carrier will start moving again when the robot action is complete. (simple).

  • By synchronized do you mean that the robot and the carriage can be moving at the same time relative to each other (complex).

    Thanks for your reply HawkME and for thinking along.


    This is exactly what I have in mind. It is indeed quite complex.


    Currently, I have achieved synchronisation based on IO, I will give the robot and carrier a start signal and both will follow the track at the same speed. However, of course this is not really synchronous.

  • I don't think this will be a slam dunk but there are a couple options. You could to choose a leader and a follower.


    Option 1. Robot is the leader and just runs its program. You read the robots current position and command the carrier to speed up or slow down to sync up with it.


    Option 2. Carrier is the leader and you use something like the streaming motion option or dynamic path mod to command the robot position.


    Option 3. No leader. You break up the paths of both Carrier and robot into segments and do an IO handshake at each segment. If one of them doesn't get the handshake they stop and sync up again.


    In order of complexity i would say 3 would be easy but may not perform the way you want.


    1 might be easier than 2 depending on how hard it is to program dynamic movement on the carrier.


    2, is possible but I have no personal experience with. I only have read about.

  • Your best bet would be using KAREL Socket Messaging function to send and recieve positional data to and from the robot with .csv file manipulation but

    you will never succeed at fully syncronizing the robot with the carrier. You could spend hours of testing and fine-tuning how many positions to send and stream and when (based on the calculated latency of the network you made between the robot the controller and the carrier) and come to a solution where you have almost syncronized them only to realize that a small flood in network traffic between the two, a sudden crash on the PC handling the streaming, a sudden change in its RAM available capacity will desync them. There is a reason why PCs are not used (or shouldn't be used) in production environments, they are unstable, they crash, they overload their RAM they do things in the background that we dont want them to do.


    You could also use ROS-Industrial framework since you are adept with python but keep in mind that by streaming positional data to the robot, you effectively cripple big time the robot's motion planner which is a pretty sofisticated piece of software. In fact this is where the big money goes when buying a robot. you should expect occasional jerks and judders, missed positions (due to latency) from time to time although not really often, but imo all those solutions are what I call "Leeroy Jenkins" projects, they rarely comply with the basic safety standards a robotic application must meet when installed in a production environment.

    I would stick with the FANUC solution.

  • I didn't realize there was a circular line tracking option available. If so that would be a truely synchronized Fanuc option.


    I also agree with ps0f0r, any of the 3 solutions I posted above will have latency effects that will cause some jerkiness. Without knowing the details of your process its hard to say what will actually work.

  • Thank you all for thinking along.


    FTS is a complex system that accurately determines its position based on MR sensors (0.1 micrometer accuracy). It can be controlled via Python by providing a position reference in position unit (pu = 1 micrometer). For example, the track is scaled from 0 to 80 000 pu (a circular or straight track does not matter. In the FTS software the track is plotted in a real number), give value 10 000 and the carrier of FTS will go to this possition very accurately.


    I don't see AB points on the picture.

    Do I understand correctly, that the robot has to follow the conveyor only on semicircle?

    If so, this is a clear case for circular linetracking.

    Correct. I didn't draw the points in the picture, but that is the correct way of thinking.

    The robot only has to follow the carrier on the FTS track on the half cirkle of the track.

  • The normal way to do that task is using linetracking.

    Circular linetracking is possible, but only linear movements in the robot are allowed in that case.

    You need an external encoder for the track (FTS), that's connected direct to the robot controller.


    Think the other discussed solutions will be not a good option, because you should have access to the path planning procedures in the robot, preferably in the interpolation cycle. That will be impossible in TP or Karel programs.

    You will always have latency problems.

    May be there are some sensor options that allow access to the internal path planning within the interpolation cycle.

  • Thank you all for thinking along.


    I checked all the options above. With our team we came to the conclusion that we want to configure the robot as a master and FTS as a slave. The FTS system can make very accurate movements, and is therefore better able to serve as a slave of the robot. The FTS system has a camming and gearing functionality which I will not bother you with.


    So we are going to focus on getting the position data from the robot to a PC application (python) via TCP/IP.


    On the Robot Controller we have the following functionality:

    - R648 Socket User Msg


    The PC already has a connection by means of TCP/IP and can read the current position of the robot via the web server. If there are any more tips on how to get the robot position data I would like to hear that. Otherwise thank you very much for your help.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account
Sign up for a new account in our community. It's easy!
Register a new account
Sign in
Already have an account? Sign in here.
Sign in Now

Advertising from our partners