This SDK (Software Development Kit) is still being finalized, and we welcome your feedback!
The .NET library Underautomation.Fanuc.dll
implements the following features :
There's nothing to install on the robot, nor any Fanuc options to have, since this SDK uses protocols that have long been natively present on Fanuc robot controllers.
All you need to do is set up the controller correctly, especially when it comes to authentication passwords, please read the following document.
PCDK or Robot IF (Interface) are official solutions provided by Fanuc.
This SDK was developed to tackle the lack of modernity and the significant price of Fanuc libraries.
This SDK | PCDK or Robot IF | |
---|---|---|
Technology | 100% managed .NET assembly | ActiveX |
Portability | No dependencies, the DLL can be moved | Requires installation with a setup program, especially for license management |
Network ports | Telnet (TCP 23) and FTP (TCP 21) | Specific native ports |
Price and conditions | 990€ or $1190 Pay once, forever, no periodic royalties No matter :
| Contact Fanuc to find out your terms of use |
You can download a demo app for Windows that implements all features (do not forget to unlock the zip file before extracting it : right click on the file, properties and uncheck the lock checkbox) : FanucSDK_DesktopExample.zip
The sources of this examples are available in open source on Github : https://github.com/underautomation/fanuc
If you need the DLL for any version of .NET, .NET framework or .NET core, you can find it here : FanucSDK.zip
Telnet KCL lets you send commands to the robot, such as reset alarms, write variables, set an IO, etc.
This feature is natively available on all Fanuc robots, without any option needed.
Select "CONFIG"
Put this file on a USB key : passpwd_KCL.xml, plug it into the pendant and import it with this last screen
<?xml version="1.0"?>
<PASSWORD>
<PWD level="0" const="1" access="1"/>
</PASSWORD>
Start ROBOGUIDE and open a new cell. Show the teach pendant
Go to menu SETUP / Port Init
In the same way as step 5 of TELNET, go to Goto menu SETUP / Host Comm, choose FTP and add a USERNAME and a PASSWORD. It may be necessary to perform a cold start.
The IDE most commonly used to develop in .NET is Visual Studio.
It is therefore possible to add a reference to the DLL UnderAutomation.Fanuc.dll
(a Nugget package will one day be available).
Then, you can import the namespace UnderAutomation.Fanuc
and create a new FanucRobot
.
using UnderAutomation.Fanuc;
var robot = new FanucRobot();
The Connect()
method takes a ConnectionParameters
object as parameter, which contains the list of services to be used during this connection, as well as authentication information.
var parameters = new ConnectionParameters();
parameters.Address = "192.168.0.1";
parameters.RemoteCommands.Enable = true;
parameters.RemoteCommands.TelnetKclPassword = "telnet pass";
parameters.MemoryAccess.Enable = true;
parameters.MemoryAccess.FtpUser = "ftp username";
parameters.MemoryAccess.FtpPassword = "ftp password";
// Connect to the robot with previous parameters
var robot = new FanucRobot();
robot.Connect(parameters);
If the Address
property of the ConnectionParameters
is a local path, the SDK will read the `services.txt
file in this folder. You therefore need to specify the path to the robot folder, which is inside the ROBOGUIDE cell folder.
The SDK will then connect via localhost to the ports in this file.
parameters.Address = @"C:\path to the robot directory";
Also, if the Address
property is a shared UNC path (like \\myserver\path to the robot directory), the SDK will read the "services.txt" file, but also connect to the machine hosting this share.
This happens if ROBOGUIDE is installed on another PC. You'll need to ensure that firewalls and antivirus software allow access to the necessary TCP ports.
This directory must also be accessible from Windows Explorer (you need to be logged in).
The Telnet KCL port supports only one connection at a time. If a client is already connected, next clients will not be able to connect. This limitation does not apply to Memory Access via FTP.
Remote control via Telnet KCL can be used to send commands to the robot, such as resetting alarms, running a program, etc.
/// Enables servo power after an error condition has shut off servo power, provided the cause of the error has been cleared.
/// The command also clears the message line on the CRT/KB display. The error message remains displayed if the error condition still exists.
/// The Reset() command has no effect on a program that is being executed. It has the same effect as the FAULT RESET button on the operator panel and the RESET function key on the teach pendant RESET screen.
robot.RemoteCommands.Reset();
/// Assigns the specified value to the specified variable. You can assign constant values or variable values, but the value must be of the data type that has been declared for the variable.
/// You can assign values to system variables with KCL write access, to program variables, or to standard and user-defined variables and fields. You can assign only one ARRAY element.
/// Use brackets ([]) after the variable name to specify an element.
/// Certain data types like positions and vectors might have more than one value specified.
robot.RemoteCommands.SetVariable("VariableName", NewValue);
The following port types can be handled :
public enum KCLPorts {
DIN,
DOUT,
RDO,
OPOUT,
TPOUT,
WDI,
WDO,
AIN,
AOUT,
GIN,
GOUT
}
The SDK allows to simulate, unsimulate and set port values.
/// Assigns the specified value to a specified input or output port. SET PORT can be used either physical Or simulated output ports, but only With simulated input ports.
robot.RemoteCommands.SetPort(KCLPorts.DOUT, 2, 0);
/// Simulating I/O allows you to test a program that uses I/O. Simulating I/O does not actually send output signals or receive input signals.
/// When simulating a port value, you can specify its initial simulated value or allow the initial value to be the same as the physical port value. If no value is specified, the current physical port value is used.
robot.RemoteCommands.Simulate(KCLPorts.DIN, 3, 1);
robot.RemoteCommands.Unsimulate(KCLPorts.DIN, 3);
robot.RemoteCommands.UnsimulateAll();
To enable the SDK to control the programs, the following variables must have the correct configuration values:
Also go to Menu / NEXT / SYSTEM / Config and make sure "42 Remote / local setup" is on "1 Remote" (it can also be set to 3 or 4 if the external IO or Panel is in remote config)
// BTW, you can use the SDK to write these values, for example just after your app has connected to the robot
robot.RemoteCommands.SetVariable("$REMOTE_CFG.$REMOTE_TYPE", 1);
robot.RemoteCommands.SetVariable("$RMT_MASTER", 1);
You can run, pause, hold, abort or clear any TP or Karel program that is stored in the robot memory.
/// Executes the specified program (TP or Karel). The program must be loaded in memory
/// If no program is specified the default program is run. If uninitialized variables are encountered, program execution is paused.
/// Execution begins at the first executable line.
/// RUN is a motion command; therefore, the device from which it is issued must have motion control. If a RUN command is issued in a command file, it is executed as a NOWAIT command.
/// Therefore, the statement following the RUN command will be executed immediately after the RUN command is issued without waiting for the program, specified by the RUN command, to end.
robot.RemoteCommands.Run("MyPrg");
/// Aborts the specified running or paused task. If prog_ name is not specified, the default program Is used.
/// Execution of the current program statement Is completed before the task aborts except for the current motion, DELAY, WAIT, Or READ statements, which are canceled.
robot.RemoteCommands.Abort("MyPrg", force: true);
robot.RemoteCommands.AbortAll(force: true);
/// Pauses the specified running task. If program is not specified, the default program is used.
/// Execution of the current motion segment and the current program statement is completed before the task is paused.
/// Condition handlers remain active. If the condition handler action is NOPAUSE and the condition is satisfied, task execution resumes.
/// If the statement is a WAIT FOR and the wait condition is satisfied while the task is paused, the statement following the WAIT FOR is executed immediately when the task is resumed.
/// If the statement is a DELAY, timing will continue while the task is paused.
/// If the delay time is finished while the task is paused, the statement following the DELAY is immediately executed when the task is resumed.
/// If the statement is a READ, it will accept input even though the task is paused.
/// The Continue() command resumes execution of a paused task.
/// When a task is paused, the CYCLE START button on the operator panel has the same effect as the KCL> CONTINUE command.
robot.RemoteCommands.Pause(cbPrograms.Text, force: true);
/// Pauses the specified or default program that is being executed and holds motion at the current position (after a normal deceleration).
/// Use the Continue() command Or the CYCLE START button On the Operator panel To resume program execution.
robot.RemoteCommands.Hold("MyPrg");
/// Continues program execution of the specified task (or all paused tasks if program argument is null) that has been paused by a hold, pause, or test run operation.
/// If the program Is aborted, the program execution Is started at the first executable line.
/// When a task Is paused, the CYCLE START button on the operator panel has the same effect as the Continue() command.
/// Continue is a motion command; therefore, the device from which it Is issued must have motion control.
robot.RemoteCommands.Continue("MyPrg");
/// Clears the program data from memory for the specified or default program.
robot.RemoteCommands.ClearProgram("MyPrg");
/// Clears the variable and type data associated with the specified or default program from memory.
/// Variables And types that are referenced by a loaded program are Not cleared.
robot.RemoteCommands.ClearVars("MyPrg");
Memory Access provides access to internal controller files, as well as fast parsing and decoding, including .va variable files and .dg diagnostic files.
The SDK lets you send files, download files, rename, delete and more.
Here are some examples :
robot.MemoryAccess.DirectFileHandling.DownloadFileFromController(@"C:\temp\MyPrg.tp", "md:/MyPrg.tp);
robot.MemoryAccess.DirectFileHandling.UploadFileToController(@"C:\temp\MyPrg.tp", "md:/MyPrg.tp);
robot.MemoryAccess.DirectFileHandling.DeleteFile("md:/MyPrg.tp");
robot.MemoryAccess.DirectFileHandling.CreateDirectory("md:/NewDirectory");
robot.MemoryAccess.DirectFileHandling.DeleteDirectory("md:/NewDirectory");
Variables are read in bulk.
Variables are read in bulk with Memory Access (note that KCL also allows variables to be read one by one). Variables are also written by KCL, see previous chapter.
robot.MemoryAccess.KnownVariableFiles
allows access to known and commonly used variables on robots.
// Enumerates variables files
FtpListItem[] VariablesFiles = robot.MemoryAccess.EnumerateVariableFiles();
// Get all variables declared in the controller
var allVariables = robot.MemoryAccess.GetAllVariables();
// Get all variables declared in one specific file
var variables = robot.MemoryAccess.GetVariablesFromFile("myFile.va");
// For known variables, you can access it directly.
// Example with $RMT_MASTER :
int RmtMaster = robot.MemoryAccess.KnownVariableFiles.GetSystemFile().RmtMaster;
// Example with CellGrp
CartesianPositionVariable cellFrame = robot.MemoryAccess.KnownVariableFiles.GetSysframeFile().CellGrp[0].CellFrame;
// cellFrame.X => 0.2
// cellFrame.Y => -0.1
// cellFrame.Z => 0
// cellFrame.Configuration.ArmFront => Back
// cellFrame.Configuration.WristFlip => NoFlip
The Windows desktop sample allows you to read and write any variable.
SafetyStatus safetyStatus = robot.MemoryAccess.GetSafetyStatus();
public class SafetyStatus
{
/// External emergency stop active
public bool ExternalEStop { get; internal set; }
/// Emergency stop active by SOP signal
public bool SOPEStop { get; internal set; }
/// Emergency stop active on teach peandant
public bool TPEStop { get; internal set; }
public bool HandBroken { get; internal set; }
public bool OverTravel { get; internal set; }
public bool LowAirAlarm { get; internal set; }
public bool FenceOpen { get; internal set; }
public bool BeltBroken { get; internal set; }
/// Teach pendant is enabled
public bool TPEnable { get; internal set; }
/// The deadman switch of the teach pendant is active
public bool TPDeadman { get; internal set; }
public bool SVOFFDetect { get; internal set; }
public bool NonTeacherEnb { get; internal set; }
}
The SDK rovides a list of IO states. Telnet KCL allows you to write or simulate their status.
IOState ioState = robot.MemoryAccess.GetIOState();
The SDK allows you to retrieve the robot arm's current position in both joint and Cartesian form, in the world frame and in user frames, with a single function call.
CurrentPosition currentPosition = robot.MemoryAccess.GetCurrentPosition();
Robot Interface (Also known as RobotIF, SNPX, or SRTP) allows for quick reading and writing of data on the robot, including:
TCP port Robot IF Server (by default 60008) should be accessible on your controller. If R650 FRA params is selected (Option "FANUC America Corp." in "Advanced" tab of ROBOGUIDE "Worcell creation wizard - Step 7 Robot options"), R553 "HMI Device SNPX" is needed. If R651 FRL Params is selected (Option "FANUC Ltd." in this "Advanced" tab), no option is needed.
Not all functions have been documented yet, but you can take a look at the Winforms project source which implements all these features.
// Example :
Position register1 = robot.Snpx.PositionRegisters.Read(1);
bool UI1 = robot.Snpx.UI.Read(1);
SNPX use case :
You have 30 trial days. But you can email UnderAutomation to request an additional trial period. You will then be provided with a temporary trial license key.
Once you've purchased a license to use the SDK, you'll be emailed a unique license key that will allow you to remove the limitation on use. You can then use the SDK in all you pieces of software no matter the number of redistribuable, the number of developpers in your team or the number of robots.
FanucRobot.RegisterLicense("licensee name", "Secret key provided by UnderAutomation");