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

PC and FANUC robot TCP/IP Communication

  • mahboobelahi93
  • September 24, 2021 at 4:02 PM
  • Thread is Unresolved
  • Nation
    Typical Robot Error
    Reactions Received
    523
    Trophies
    9
    Posts
    1,901
    • October 28, 2021 at 4:19 AM
    • #41

    Did you create a robot config?

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

    Check out my example Fanuc Ethernet/IP Explicit Messaging program here!

  • mahboobelahi93
    Reactions Received
    1
    Trophies
    2
    Posts
    82
    • October 28, 2021 at 2:26 PM
    • #42
    Quote from Nation

    Did you create a robot config?

    Hi Nation,

    Thanks for your response.

    No. and I do not know why "robot.ini" file is missing.

    I want to know about the following:

    Does the FANUC socket server support more than one socket client?

    I am sending positional data to the robot as a string from the socket client in the following format:

    PR_id, X, Y, Z, W, P, R

    (20,137.8,70.4,79.8,50.3,-15.0,-180.5,0.0)

    how to convert this string to XYZWPR. The converted value goes to PR[20] and the robot will move to that position.

    Is there an easier way to do this?

  • mahboobelahi93
    Reactions Received
    1
    Trophies
    2
    Posts
    82
    • October 28, 2021 at 2:28 PM
    • #43
    Quote from SkyeFire

    I'm no expert in this area, but as I understand it, for the command-line tools to work, you need to have built a virtual controller in RoboGuide that had the same software version, and all of the options, as the robot you're trying to compile code to.

    I encountered the same kind of issue, when I had only built a basic virtual controller with the right core version, but without adding the Fanuc options that the real robot had. The command-line tools would compile and decompile "generic" code, but would fail on any line that was tied to a specific Fanuc option.

    Hi SkyFire,

    Thanks for your reply,

    Actually my roboguide trial license has expired, this could be the reason for not having successful compilation. I do have a work cell with v8.30 in roboguide but the license has expired.

  • mahboobelahi93
    Reactions Received
    1
    Trophies
    2
    Posts
    82
    • October 29, 2021 at 3:43 PM
    • #44
    Quote from mahboobelahi93

    I am sending positional data to the robot as a string from the socket client in the following format:

    PR_id, X, Y, Z, W, P, R

    (20,137.8,70.4,79.8,50.3,-15.0,-180.5,0.0)

    Hi all,

    I have written a simple KAREL prog to convert xyzwpr data received through HTTP request like:

    http://192.168.1.1/KAREL/Mov_HTTP?id=100&x=214.384&y=-282.970&z=170.502&w=179.937&p=.712&r=89.751

    after compilation of the source file, I am getting the following error

    And when I run p-code file I get TP warning can not lock motion group, how to resolve this error/issue

    Here is the KAREL code:

    Code
    PROGRAM Mov_HTTP
    
    %ENVIRONMENT  REGOPE
    
    %ENVIRONMENT  STRNG
    %COMMENT = 'GET POS_HTPP'
    %NOLOCKGROUP
    %NOABORT=ERROR+COMMAND
    %NOPAUSE=ERROR+COMMAND+TPENABLE
    %ALPHABETIZE
    %INCLUDE KLEVKEYS
    %INCLUDE KLEVKMSK
    %INCLUDE KLEVCCDF
    %INCLUDE KLIOUOP
    %INCLUDE KLIOTYPS
    
    
    VAR
        id,XX,YY,ZZ,WW,PP,RR: STRING[10]
        con: CONFIG
        reg_ID,x,y,z,w,p,r:  REAL
        temp_pos: XYZWPR
        fFileHandle : FILE
        chOutFile: STRING[20]
        ret_code,status,prog_index: INTEGER
    ----------------------------------------------------
    -- BEGIN MyProgram                             
    ----------------------------------------------------
    BEGIN
        -- clear the TPERROR screen
        --FORCE_SPMENU(TP_PANEL,SPI_TPUSER,1)
        WRITE(CHR(137),CHR(128))
        WRITE TPERROR(CHR(128))
        WRITE('Waiting for HTTP Req...',CR)
        IF UNINIT(chOutFile) THEN
            chOutFile='TD:RESPONSE.HTM'
            WRITE('[X] INSIDE',CR)
        ENDIF
        CNV_STR_REAL(id,reg_ID)
        CNV_STR_REAL(XX,x)
        CNV_STR_REAL(YY,y)
        CNV_STR_REAL(ZZ,z)
        CNV_STR_REAL(WW,w)
        CNV_STR_REAL(PP,p)
        CNV_STR_REAL(RR,r)
        WRITE(reg_ID,x,y,z,w,p,r,CR)
        temp_pos.x = x--CNV_STR_REAL(x,XX)
        temp_pos.y = y--CNV_STR_REAL(y,YY)
        temp_pos.z = z--CNV_STR_REAL(z,ZZ)
        temp_pos.w = w--CNV_STR_REAL(w,WW)
        temp_pos.p = p--CNV_STR_REAL(p,PP)
        temp_pos.r = r--CNV_STR_REAL(r,RR)
        --CNV_STR_CONF('n',con,status)
        --temp_pos = POS(XX,YY,ZZ,WW,PP,RR,con)
       WRITE('--->',temp_pos,CR)
        SET_POS_REG(TRUNC(reg_ID),temp_pos,status,1)
        CALL_PROG('HTTP_test', prog_index)
        WRITE('Openign Foile...',CR)
        OPEN FILE fFileHandle ('RW', chOutFile) 
        WRITE fFileHandle ('OK',CR)
        wait for DOUT[101]
        CLOSE FILE fFileHandle 
    END Mov_HTTP
    Display More

    Images

    • error.PNG
      • 13.43 kB
      • 783 × 229
      • 5
  • Online
    SkyeFire
    Reactions Received
    1,039
    Trophies
    12
    Posts
    9,380
    • October 29, 2021 at 7:57 PM
    • #45
    Quote from mahboobelahi93

    Actually my roboguide trial license has expired, this could be the reason for not having successful compilation. I do have a work cell with v8.30 in roboguide but the license has expired.

    Even if you have a virtual controller built with the correct core software version, if that virtual controller lacks the options (say, iRVision) that the real robot has, this problem is liable to occur.

  • dha
    Reactions Received
    28
    Trophies
    6
    Posts
    397
    • November 2, 2021 at 7:39 AM
    • #46
    Quote from mahboobelahi93

    Hi all,

    I have written a simple KAREL prog to convert xyzwpr data received through HTTP request like:

    http://192.168.1.1/KAREL/Mov_HTTP?id=100&x=214.384&y=-282.970&z=170.502&w=179.937&p=.712&r=89.751

    after compilation of the source file, I am getting the following error

    And when I run p-code file I get TP warning can not lock motion group, how to resolve this error/issue

    Here is the KAREL code:

    Code
    PROGRAM Mov_HTTP
    
    %ENVIRONMENT  REGOPE
    
    %ENVIRONMENT  STRNG
    %COMMENT = 'GET POS_HTPP'
    %NOLOCKGROUP
    %NOABORT=ERROR+COMMAND
    %NOPAUSE=ERROR+COMMAND+TPENABLE
    %ALPHABETIZE
    %INCLUDE KLEVKEYS
    %INCLUDE KLEVKMSK
    %INCLUDE KLEVCCDF
    %INCLUDE KLIOUOP
    %INCLUDE KLIOTYPS
    
    
    VAR
        id,XX,YY,ZZ,WW,PP,RR: STRING[10]
        con: CONFIG
        reg_ID,x,y,z,w,p,r:  REAL
        temp_pos: XYZWPR
        fFileHandle : FILE
        chOutFile: STRING[20]
        ret_code,status,prog_index: INTEGER
    ----------------------------------------------------
    -- BEGIN MyProgram                             
    ----------------------------------------------------
    BEGIN
        -- clear the TPERROR screen
        --FORCE_SPMENU(TP_PANEL,SPI_TPUSER,1)
        WRITE(CHR(137),CHR(128))
        WRITE TPERROR(CHR(128))
        WRITE('Waiting for HTTP Req...',CR)
        IF UNINIT(chOutFile) THEN
            chOutFile='TD:RESPONSE.HTM'
            WRITE('[X] INSIDE',CR)
        ENDIF
        CNV_STR_REAL(id,reg_ID)
        CNV_STR_REAL(XX,x)
        CNV_STR_REAL(YY,y)
        CNV_STR_REAL(ZZ,z)
        CNV_STR_REAL(WW,w)
        CNV_STR_REAL(PP,p)
        CNV_STR_REAL(RR,r)
        WRITE(reg_ID,x,y,z,w,p,r,CR)
        temp_pos.x = x--CNV_STR_REAL(x,XX)
        temp_pos.y = y--CNV_STR_REAL(y,YY)
        temp_pos.z = z--CNV_STR_REAL(z,ZZ)
        temp_pos.w = w--CNV_STR_REAL(w,WW)
        temp_pos.p = p--CNV_STR_REAL(p,PP)
        temp_pos.r = r--CNV_STR_REAL(r,RR)
        --CNV_STR_CONF('n',con,status)
        --temp_pos = POS(XX,YY,ZZ,WW,PP,RR,con)
       WRITE('--->',temp_pos,CR)
        SET_POS_REG(TRUNC(reg_ID),temp_pos,status,1)
        CALL_PROG('HTTP_test', prog_index)
        WRITE('Openign Foile...',CR)
        OPEN FILE fFileHandle ('RW', chOutFile) 
        WRITE fFileHandle ('OK',CR)
        wait for DOUT[101]
        CLOSE FILE fFileHandle 
    END Mov_HTTP
    Display More
    Display More

    You get this kind of error, if your KAREL program, which you are compiling, is still running or it is paused.

    You can also try deleting Mov_HTTP.VR from MD.

  • mahboobelahi93
    Reactions Received
    1
    Trophies
    2
    Posts
    82
    • November 9, 2021 at 10:27 AM
    • #47

    Hi all,

    i have established socket communication between the robot's SM server and python App(SM client) but i am having trouble in handling data chunks coming from the Socket server. sample chunk:

    Code
                    WRITE file_var('uframe_Data ')
                    WRITE file_var(uframe ,'--' )
                    WRITE file_var('camframe_Data ')
                    WRITE file_var(camframe ,'--')
                    WRITE file_var('utool_Data ')
                    WRITE file_var(utool ,'--')
                    WRITE file_var('Home_POS ')
                    WRITE file_var(lpos ,'--' ,CR)
                    WRITE  file_var(
                        'Current-POS',
                        curr_X::9::2, ',',
                        curr_Y::9::2, ',',
                        curr_Z::9::2, ',',
                        curr_W::9::2, ',',
                        curr_P::9::2, ',',
                        curr_R::9::2,'--' )
    
    
    DELAY 1000
    Display More

    '--' will use as a delimiter that is used by the python app to split incoming data.I got the following list in the python application. The remaining data is missing.

    ['uframe_Data 411.096 215.795 -272.131\n .713 .059 -89.751\nN U T, 0, 0, 0', 'camframe_Data 332.167 77.494 -273.281\n .681 -.038 -89.856\nN U T, 0, 0, 0', 'utool_Data 0.000 0.000 115.000\n 0.000 0.000 0.000\nN']

    What is the correct way to receive all data from KAREL program that is responsible for handling Socket communication?

    i also tried following write commands

    Code
    DELAY 500                
    WRITE file_var('uframe_Data ')
    WRITE file_var(uframe ,CR)
    WRITE file_var('utool_Data ')
    WRITE file_var(utool ,CR)
    WRITE file_var('Home_POS ')
    WRITE file_var(lpos ,CR)
    DELAY 500

    Whit these write commands received data include a little portion of previous as well next data segment.

    I have the following two questions regarding the robot Socket server:

    1- how many clients can a robot server handle?

    2- how to check client dis-connections correctly? Can MSG_DISC() will work for it?, i have no success with handling client disconnections.

    i want when client disconnects then server stops sending data and wait for a reconnects.

  • mahboobelahi93
    Reactions Received
    1
    Trophies
    2
    Posts
    82
    • November 9, 2021 at 11:38 AM
    • #48

    Here is the received data from the robot Socket server.

    I have not set any file attribute.

    writing data to file like :

    Code
                    WRITE file_var('camera_frame')
                    WRITE file_var(camframe ,CR)
                    WRITE file_var('uframe_Data')
                    WRITE file_var(uframe ,CR)
                    WRITE file_var('utool_Data')
                    WRITE file_var(utool ,CR)
                    
                    WRITE file_var('Home_POS')
                    WRITE file_var(lpos ,CR)
    
                    WRITE  file_var(
                        'Current-POS',
                        curr_X::9::2, ',',
                        curr_Y::9::2, ',',
                        curr_Z::9::2, ',',
                        curr_W::9::2, ',',
                        curr_P::9::2, ',',
                        curr_R::9::2, CR)
    
                    DELAY 1000
    Display More

    Waiting for response.

    Thanks a lot.

  • Online
    SkyeFire
    Reactions Received
    1,039
    Trophies
    12
    Posts
    9,380
    • November 9, 2021 at 8:51 PM
    • #49

    The first suggestion I have to is run WireShark on the computer running the python app, and examine the raw packets.

  • 1Cliff
    Trophies
    3
    Posts
    12
    • November 10, 2021 at 4:34 PM
    • #50

    Even with a trial version of roboguide running out of date you can compile Karel and TPE. For Karel compilation you don't need a virtual robot created. This is only for TPE.
    The robot.ini (Project folder) has to be set correctly and the win- system paths have to be OK.

    The first message was something about missing 'ev'. I'm not familiar with vision, but you should check if the file is present in your WinOlpc / Versions / support folder.

    Here is a robot.ini of mine. Fit it to your needs (Robot, Suppport and Output only for TPE)...

    [WinOLPC_Util]

    Robot=\D\VirtualRobots\V930\Robot_1

    Version=V9.30-1

    Path=C:\Program Files (x86)\FANUC\WinOLPC\Versions\V930-1\bin

    Support=D:\VirtualRobots\V930\Robot_1\support

    Output=D:\VirtualRobots\V930\Robot_1\output

  • mahboobelahi93
    Reactions Received
    1
    Trophies
    2
    Posts
    82
    • November 12, 2021 at 10:08 AM
    • #51
    Quote from 1Cliff

    Even with a trial version of roboguide running out of date you can compile Karel and TPE. For Karel compilation you don't need a virtual robot created. This is only for TPE.
    The robot.ini (Project folder) has to be set correctly and the win- system paths have to be OK.

    The first message was something about missing 'ev'. I'm not familiar with vision, but you should check if the file is present in your WinOlpc / Versions / support folder.

    Here is a robot.ini of mine. Fit it to your needs (Robot, Suppport and Output only for TPE)...

    [WinOLPC_Util]

    Robot=\D\VirtualRobots\V930\Robot_1

    Version=V9.30-1

    Path=C:\Program Files (x86)\FANUC\WinOLPC\Versions\V930-1\bin

    Support=D:\VirtualRobots\V930\Robot_1\support

    Output=D:\VirtualRobots\V930\Robot_1\output

    Display More

    Thank you 1Cllif

  • mahboobelahi93
    Reactions Received
    1
    Trophies
    2
    Posts
    82
    • November 12, 2021 at 10:18 AM
    • #52
    Quote from SkyeFire

    The first suggestion I have to is run WireShark on the computer running the python app, and examine the raw packets.

    Hi SkyFire,

    I modified my python script like this:

    JSON_DATA[data[0]] =dict([("XYZ",[float(i) for i in data[1:4]]),
                                                    ("WPR",[float(i) for i in data[4:7]]),
                                                    ("CONFIG","NUT000")])

    now my JSON data is ok but in the console, there is still data overlap. I have checked data packets in WireShark and packet bytes are random ranging between 70-90 bytes.

    in KAREL i am accessing Frames data like:

    GET_VAR(entry, '*SYSTEM*', '$MNUFRAME[1,9]', camframe, STATUS)

      WRITE file_var('camera_frame') --12 bytes (not sure)

    WRITE file_var(camframe ,CR) --56bytes

    --- writing other frames data follows same process 

    As camfram is a POSITION data so only 56bytes +12bytes only be written and the remaining bytes of write buffer must be handled by Carriage return but for me somehow it is not working.

  • fahadroboticist
    Trophies
    1
    Posts
    1
    • June 26, 2023 at 9:19 PM
    • #53

    Hi, have you established communication using above method? please provide more details

    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
  • 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

Similar Threads

  • Keyence CV-X R30IB plus communication

    • Neilcrockett
    • July 29, 2021 at 2:26 AM
    • Fanuc Robot Forum
  • FANUC DeviceNet Communication with Delta PLC

    • shriraj lonkar
    • September 2, 2021 at 7:37 AM
    • Fanuc Robot Forum
  • Communication between Matlab and FANUC Roboguide

    • MatlabXFanuc
    • May 11, 2021 at 11:37 AM
    • Fanuc Robot Forum
  • Remote Start: Siemens PLC S1500 / Fanuc R30iB : Profinet Comm

    • MoEL
    • August 24, 2021 at 2:20 PM
    • Fanuc Robot Forum
  • OPC-UA Communication between FANUC robot and Allen-Bradley HMI (without PLC)

    • Jean-Fred B.
    • August 19, 2021 at 8:25 PM
    • Fanuc Robot Forum
  • FANUC Karel TCP Socket security

    • Milea Carmen
    • May 25, 2021 at 2:49 PM
    • Fanuc Robot Forum
  • PLC S7300 PROFIBUS COMMUNICATION WITH FANUC ROBOT

    • GIMM
    • May 13, 2021 at 4:50 PM
    • Fanuc Robot Forum
  • FANUC Robot - PC: Communication protocols

    • tboekhorst
    • October 27, 2020 at 6:28 PM
    • Fanuc Robot Forum
  • Communication between Schneider PLC and Fanuc robot

    • mathias drapier
    • May 16, 2019 at 9:09 AM
    • Fanuc Robot Forum

Tags

  • karel
  • Python
  • TCP/IP
  • socket
  • Socket Message
  • socket server
  • Karel programming
  • Position Register
  • LR mate200Di
  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