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. General Category - Robot Forum
  4. General Discussion of Industrial Robots Only
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

Establishing Ethernet Communication and Ping Between PC and ROBOGUIDE Virtual Fanuc Robot

  • mey_88
  • March 7, 2025 at 2:50 PM
  • Thread is Unresolved
  • mey_88
    Posts
    7
    • March 7, 2025 at 2:50 PM
    • #1

    Hello,

    I want to connect a PC to a Fanuc robot via an Ethernet port and establish communication using .NET/KAREL. For testing the program, I think the first step is to be able to ping the robot I created in ROBOGUIDE from my PC.

    I created a virtual Ethernet port on my PC and set up a random robot controller in ROBOGUIDE. I can ping my PC's virtual Ethernet port from ROBOGUIDE, but I cannot ping the robot from my PC. Has anyone tried this before? Is what I'm attempting even possible?

    Thank you in advance for the information.

    For reference, here are the details of the robot I created:
    H552 HandlingTool
    H521 English Dictionary
    R796 Ascii Program Loader
    R784 Ethernet/IP Adapter
    R785 Ethernet/IP Scanner
    R632 KAREL, R641 PC Interface
    R648 User Socket Msg
    FVRC Virtual Robot
    H782 ARC Mate 100iD

  • SkyeFire
    Reactions Received
    1,060
    Trophies
    12
    Posts
    9,456
    • March 7, 2025 at 3:30 PM
    • #2

    I'm not an expert on this, but from previous experience, RoboGuide's virtual robots tend to "take over" your PC's regular NIC. The key difference is that they occupy specific ports. And if your RG sim has multiple robots, they all share the host PC's IP address, but have unique ports. This is the opposite of how real-world Fanucs work, where they all use the same ports (normally) for the same functions, but all have unique IPs (assuming they are on the same network).

  • hermann
    Reactions Received
    412
    Trophies
    9
    Posts
    2,624
    • March 7, 2025 at 6:11 PM
    • #3
    Quote from mey_88

    For testing the program, I think the first step is to be able to ping the robot I created in ROBOGUIDE from my PC....

    You must be more specific.

    Roboguide runs on a PC, which PC?

    From which PC do you want to ping Roboguide? Is it one PC for all, or are there two PCs involved?

  • mey_88
    Posts
    7
    • March 10, 2025 at 7:28 AM
    • #4

    I want to ping from the PC where I run RoboGuide. There won’t be two PCs involved. Let me try to explain what I want to do, as I might not have explained it correctly in my first question.

    For example, in the past, I established communication with a Keyence camera using a program written in .NET. The Keyence camera was connected to my PC via an Ethernet cable. According to the camera's documentation, I used a non-procedural communication method to send triggers, switch run modes, and select programs using .NET code. Now, I want to achieve similar communication with a Fanuc robot. Since we don’t physically have a robot yet, I want to test the .NET program with a Controller created in RoboGuide. On the robot side, I might need to do some programming in Karel (I have no prior experience with Karel, so I’m not sure yet), but initially, I thought we at least need to be able to ping the robot to start testing the program. Maybe this thought of mine is also wrong, I’m not sure.

    I hope I’ve been able to explain what I want to do clearly. Thank you.

  • hermann
    Reactions Received
    412
    Trophies
    9
    Posts
    2,624
    • March 10, 2025 at 8:28 AM
    • #5

    Iirc you must use 127.0.0.1 (edit: or may be the op address of the pc itself) when you want to connect to Roboguide from the pc to Roboguide running on the same pc where you run the software connecting to Roboguide. The ip address config in Roboguide is used when you want to connect to Roboguide from a different pc.

  • mey_88
    Posts
    7
    • March 10, 2025 at 8:44 AM
    • #6

    Oh, thank you very much for the quick and correct response. I set the TCP/IPv4 of the PC's virtual Ethernet port to automatic, started a new simulation, and without changing any settings, as you mentioned, I was able to ping the IP address 127.0.0.1 directly in its default state. At the same time, the robot was also able to ping the IP address 169.254.91.72, which the PC automatically obtained.

    Now, I have a question for the second step. I assume that there will be a handshaking between KAREL and .NET programs for communication from now on. Is this correct, or is there a way to establish this communication without using KAREL?

    Thank you.

  • hermann
    Reactions Received
    412
    Trophies
    9
    Posts
    2,624
    • March 10, 2025 at 9:27 AM
    • #7
    Quote from mey_88

    .. I was able to ping the IP address 127.0.0.1 directly in its default state ..

    This is normal, and happens on every PC, even when you don't have roboguide running. It is the localhost, the PC itself. But this doesn't say anything about wether the connection to roboguide will be possible or not. You must try the connection.

    Quote from mey_88

    Now, I have a question for the second step. I assume that there will be a handshaking between KAREL and .NET programs for communication from now on. Is this correct, or is there a way to establish this communication without using KAREL?

    Don't know a different possibility to connect to a .NET application.

  • SkyeFire
    Reactions Received
    1,060
    Trophies
    12
    Posts
    9,456
    • March 10, 2025 at 8:32 PM
    • #8
    Quote from hermann

    Iirc you must use 127.0.0.1 (edit: or may be the op address of the pc itself)

    That's what I experienced. Opening a web browser to 127.0.0.1 should open the virtual robot's web page, assuming there's only one virtual robot in the active RoboGuide layout. A program running on the same PC that is running RG should be able to access the robot via LocalHost, but will need to use the specific ports in the SERVICES.TXT file of the virtual robot. It should look something like this:

    Code
    RPCMAIN                   : 3002
    Telnet                    : 23
    Teach Pendant             : 9099
    FTP                       : 21
    CGTP Web Server           : 3080
    TP_INPUT Server           : 60028
    Robot Discovery Method    : 60029
    Web Server                : 80
    Console/SMON              : 9101
    ROBOGUIDE (pid)           : 15200
    Virtual Robot (pid)       : 46752
    Robot Server (pid)        : 30500
    Robot Server HostName     : 127.0.0.1:3002
    Display More
  • mey_88
    Posts
    7
    • March 13, 2025 at 4:58 PM
    • #9

    The information you sent was very helpful, thank you! Below, I’ve copied the connection and data sending parts of the .NET program. This program connects via IP: 127.0.0.1 and Port: 80, but I think I couldn’t properly set up the TCP_SERVER listening process in KAREL. Because the .NET program gets stuck at the line "Dim bytesRead As Integer = stream.Read(buffer, 0, buffer.Length)".

    In this case, it seems like the .NET program isn’t receiving any data from the robot.

    I’m not sure if this is due to the lack of a physical connection or if there’s an error in the KAREL code.


    Private Sub ConnectToRobot()
    robotIP = IP_txt.Text
    port = Port_txt.Text
    Try
    client = New TcpClient(robotIP, port)
    stream = client.GetStream()
    connected = True
    MessageBox.Show("Connection Established!", "Info", MessageBoxButtons.OK, MessageBoxIcon.Information)
    Catch ex As Exception
    MessageBox.Show("Connection Error: " & ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
    End Try
    End Sub

    Private Sub SendDataToRobot()
    If Not connected Then
    MessageBox.Show("Initialise the connection first!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning)
    Return
    End If

    Try
    Dim r3 As String = r3_txt.Text.PadLeft(4, "0"c)
    Dim r4 As String = r4_txt.Text.PadLeft(4, "0"c)

    Dim message As String = r3 & r4
    Dim data As Byte() = Encoding.ASCII.GetBytes(message)
    stream.Write(data, 0, data.Length)

    Dim buffer(3) As Byte
    Dim bytesRead As Integer = stream.Read(buffer, 0, buffer.Length)
    Dim response As String = Encoding.ASCII.GetString(buffer, 0, bytesRead)

    r5_txt.Text = response
    Catch ex As Exception
    MessageBox.Show("Data send/receive error: " & ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
    End Try
    End Sub

  • PnsStarter
    Reactions Received
    95
    Trophies
    6
    Posts
    337
    • March 13, 2025 at 5:07 PM
    • #10

    Hi mey_88,

    just fly through this post...

    So, you would like to communicate via SM(SocketMessaging)?

    But in general PORT 80 is the robots web server port... So opening that port on robot side for SM is not "possible"

    Currently you are trying to get the "Homepage" as Integer's ?!?

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

  • mey_88
    Posts
    7
    • March 14, 2025 at 10:39 AM
    • #11

    But in general PORT 80 is the robots web server port... -> I didn’t know this information, thank you very much. You are also absolutely right in your last comment. I will try to write a program in KAREL using SM commands.

  • Alfred
    Reactions Received
    8
    Trophies
    2
    Posts
    34
    • July 2, 2025 at 11:41 AM
    • New
    • #12

    You can take a look at this library, which implements several TCP protocols native to Fanuc controllers (Telnet, Ftp, SNPX, ...). This library also works with ROBOGUIDE simulated robots.

    You can:

    • Read the robot's status (position, alarms, I/O)
    • Send or download program files
    • Read and write variables and registers
    • Reset alarms
    • Move the robot,
    • Other feature...


    Documentation : https://underautomation.com/fanuc

    Github : https://github.com/underautomation/Staubli.NET

    Example :

    C#
    using UnderAutomation.Fanuc;
    
    // Create a new Fanuc robot instance
    FanucRobot robot = new FanucRobot();
    
    // Set connection parameters
    ConnectionParameters parameters = new ConnectionParameters("192.168.0.1");
    parameters.Telnet.Enable = true;
    parameters.Telnet.TelnetKclPassword = "TELNET_PASS";
    parameters.Ftp.Enable = true;
    parameters.Snpx.Enable = true;
    
    // Reset alarms
    robot.Telnet.Reset();
    
    // Run a program
    robot.Telnet.Run("MyProgram");
    robot.Telnet.Pause("MyProgram");
    robot.Telnet.Hold("MyProgram");
    robot.Telnet.Continue("MyProgram");
    robot.Telnet.Abort("MyProgram", force: true);
    
    // Set a variable
    robot.Telnet.SetVariable("$RMT_MASTER", 1);
    
    // Set an output port (example: DOUT port 2 = 0)
    robot.Telnet.SetPort(KCLPorts.DOUT, 2, 0);
    
    // Read a register
    Position posReg1 = robot.Snpx.PositionRegisters.Read(1);
    float numReg5 = robot.Snpx.NumericRegisters.Read(5);
    string strReg10 = robot.Snpx.StringRegisters.Read(10);
    
    // Write a register
    posReg1.CartesianPosition.X = 100;
    robot.Snpx.PositionRegisters.Write(1, posReg1);
    robot.Snpx.NumericRegisters.Write(2, 123.45f);
    robot.Snpx.StringRegisters.Write(3, "Hello, world!");
    
    IOState ioState = robot.Ftp.GetIOState();
    
    // Read a variable
    var variableFiles = robot.Ftp.GetAllVariables();
    foreach (var variableFile in variableFiles)
      foreach (var variable in variableFile.Variables)
        Console.WriteLine($"{variable.Name} = {variable.Value}");
    
    // Read system variable $RMT_MASTER
    int remoteMode = robot.Ftp.KnownVariableFiles.GetSystemFile().RmtMaster;
    
    // Read safety status
    SafetyStatus safetyStatus = robot.Ftp.GetSafetyStatus();
    Console.WriteLine($"Emergency Stop: {safetyStatus.ExternalEStop}");
    Console.WriteLine($"Teach Pendant Enabled: {safetyStatus.TPEnable}");
    Display More

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
  • Ethernet
  • Communication
  • .net framework

Users Viewing This Thread

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