Controlling Fanuc robot using ethernet/ip and Python

  • Hi!


    I'm wondering if it's possible to communicate with my FANUC R-30iB controller using my computer with python over ethernet/ip.


    I want to use the open source computer vision libary in python to create an inspection application using a PoE camera mounted on my M-10iA-12S robot. The PC application should be able to load the correct tp-program, starte the robot and listen if the robot wants to activate the camera. Before purchasing "A05B-2600-R785 R-30iB Softw/ ETHERNET/IP I/O SCAN" which should enable me to communicate over ethernet/ip, I would like to check if any one have any experience using a python script to communicate with a fanuc robot.


    So my question is: Does anyone know or have any experience using python to communcuticate over ethernet/ip with a Fanuc robot? If so, is it possible to starte the robot from the script?


    Thank you guys!

  • There are a few different ways you could program your robot offline. For your application one solution that comes to mind is RoboDK. The basic version of this is free and also has tools to insert your python script.

  • I'm not sure I understand how I can do this offline? Could you please elaborate?


    What I want do to is to listen to, lets say register R[1], from my computer. When the robot changes this to 1 the camera should start taking pictures and when the R[1]=0, stop taking pictures. Maybe there is a easier way?`


    The second thing I want to do, is to trigger and start a given TP-program from the computer. All this should preferably be done using python.


    Thanks!

  • I worked on a much larger but similar project where I used .net instead of python. I believe Python will work aswell since the fanuc socket interface is low level (you just fill a byte buffer and send it)

  • Your need [R648] USER SOCKET MSG. And if using TCP/IP, Ethernet/IP is not necessary.

  • Ok, that's great!


    I assume I can use the socket library in python to communicate with the robot over TCP/IP.


    I have requested the R632 and R648 from my supplier, and also the manuals for KAREL and ethernet options. While I'm waiting, maybe some of you could help me a bit more.


    As my PC should run the application it would act as the client, and the robot act as the server. Correct? The server application is writen in karel and should constantly run in the background as a background logic?


    Using the server and client application with socket messaging, is it possible to write and trigger the robot to start a given program from my computer?


    Thanks again!!

  • Quote

    The server application is writen in karel and should constantly run in the background as a background logic?


    Yes, for your problem the best thing is writing a server in Karel and no, you can't run it on background logic since its purpose is mainly to monitor signals (and you can only run TP code).


    Quote

    Using the server and client application with socket messaging, is it possible to write and trigger the robot to start a given program from my computer?


    Yes, It is possible (check RUN_TASK and related functions on the manual) and you can achieve that by implementing a simple RPC model.

  • You can run it in background by using karel or tp multitasking features.
    I used to have a tp program that was autoexecuted at robot start which started (by using RUN instruction) 2 karel programs in background (one of those was a karel server)

Advertising from our partners