How to Use FANUC PC Developer's Kit (PCDK)

How to Use FANUC PC Developer's Kit (PCDK)

FANUC offers an easy way to command and configure a robot from a PC using their PC Developer's Kit (PCDK).The kit allows a PC to access variables, registers, IO, programs, positions, and alarms on the robot. Most of the help documentation already covers Visual Basic, so I'll explain how to get started with C#.


First step is to install Visual Studio. Visual Studio Community is free and works perfectly for this application.

After installing Visual Studio, go through the PCDK installer. 

Getting Started with FANUC PCDK

Next, start up Visual Studio and create a new Console Application. I called mine "FanucTest".

FANUC Console application

After clicking OK, right click on the "References" in the solution, and click "Add Reference".

FANUC project references

Under COM, find FANUC Robotics Controller Interface. Select it and click OK.

FANUC COM Reference

Now to begin writing code!

Connecting to a Robot

Add the following highlighted lines to your code to connect to your robot. If this runs, you've successfully installed PCDK and you're ready to communicate with your robot. 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using FRRobot;      //uses the robot reference we just added

namespace FanucTest
    class Program
        static void Main(string[] args)
            Console.WriteLine("Press any key to continue...");

            //Create a robot object
            FRCRobot mobjRobot = new FRCRobot();
            //Connect to your robot
            bool connected = mobjRobot.IsConnected;





Updating a Position Register

To finish off this hello world program, add the following lines of code to update a position register. We're accessing position register 1 below and updating the values. 

  //See help topics "Efficient Access to Positions"
            FRCSysPositions sysPositions = mobjRobot.RegPositions;
            FRCSysPosition sysPosition = sysPositions[1];
            FRCSysGroupPosition sysGroupPosition = sysPosition.Group[1];
            FRCXyzWpr xyzWpr = sysGroupPosition.Formats[FRETypeCodeConstants.frXyzWpr];
            //Prepare updated X,Y,Z,W,P, and R values of position register 1
            xyzWpr.X = 475;
            xyzWpr.Y = -275;
            xyzWpr.Z = -231;
            xyzWpr.W = -176;
            xyzWpr.P = 0;
            xyzWpr.R = 0;
                //Update position register 1


To learn how to do more with the robot, check out the PCDK help documentation. Depending on your version of Windows, you might need to install another program to view the help documentation. 

Learn more about DMC's Manufacturing and Automation Intelligence services.


# Damir
Is there a way to install DLL files on target machine without PCDK?

On my computer where I develop I have roboguide installed and NET application with FRRobot.dll works fine. But when I copy app to target computer I have problem with DLLs
# B
FANUC PC Developer's Kit (PCDK) is available by contacting FANUC.

For reference, here is how I am reading IO signals with PCDK in C#.


dynamic IOType;
IOType = mobjRobot.IOTypes[FREIOTypeConstants.frUOPOutType, Type.Missing];

// OPOUT[18] UO[3] PROGRUN is the program run output. This output turns on when a program is running.
mobjUOPIOSignal_PROGRUN = (FRCUOPIOSignal)IOType.Signals["3", Type.Missing];

bool bRunning = (Convert.ToInt32(mobjUOPIOSignal_PROGRUN.Value) == 1);
Yung-Chuan Huang
# Yung-Chuan Huang
where can i get FANUC PC Developer's Kit (PCDK)?
# JColl
Use a dynamic IOTypes to access the signals

dynamic IOTypes = mobjRobot.IOTypes[FREIOTypeConstants.frDInType];

FRCIOSignals mIOSignals = IOTypes.Signals;

FRCIOSignal mIOSignal = mIOSignals[sigIndex];
# Frank
Hi Eloi,

We found during development in C# that some of the IO wasn't accessible, but was accessible in VB. As an example,

help documentation provides this working VB code:

Dim objDigInputs As FRCIOSignals
Set objDigInputs = mobjRobot.IOTypes(frDInType).Signals

but the C# equivalent below can't get the .Signals IO

FRCIOSignals objDigInputs;
objDigInputs = mobjRobot.IOTypes[FREIOTypeConstants.frDInType].Signals

For our application, we wanted to access flags, but were unable to do so in a straightforward manner, so we used registers instead (which could be accessed in C#). We haven't verified this, but another engineer suspected the way the Fanuc DLL was set up only allowed VB code to function correctly and intellisense in C# was getting in the way.

If you still run into issues and can't use other IO variables instead, I would recommend contacting Fanuc, as they have great support and might be able to give you a solution.
# Eloi
I am having issues getting the API to be fully compatible with C#. I can't access IO variables because one of the properties in the IOTypesClass is not defined. Do you guys know why?

Post a comment

Name (required)

Email (required)

Enter the code shown above: