UnderAutomation
有问题吗?

[email protected]

联系我们
UnderAutomation
⌘Q
本页面仅提供英文版本。

Files and backup

List, download, upload and delete the job and data files of a Yaskawa controller, and download its CMOS backup.

  • List the files
  • Download a file
  • Upload a file
  • Delete a file
  • CMOS backup
  • Timeouts
  • Try it in the demo application
  • Reference

This page shows how to transfer files between a PC and a Yaskawa Motoman controller with the SDK: list, download, upload and delete jobs and data files, and download the CMOS backup. The file transfers use the UDP port 10041 of the High Speed Ethernet Server.

List the files

GetFileList(pattern) lists the files whose name matches a pattern with *.

var robot = new YaskawaRobot();
robot.Connect("192.168.0.1");
// Job files
string[] jobs = robot.HighSpeedEServer.GetFileList("*.JBI").Files;
// Variable data and condition files
string[] dat = robot.HighSpeedEServer.GetFileList("*.DAT").Files;
string[] cnd = robot.HighSpeedEServer.GetFileList("*.CND").Files;
foreach (string file in jobs)
Console.WriteLine(file);
robot.Disconnect();
}
Click to see the full code
PatternFiles
*.JBIJobs
*.DATData files, for example the variables
*.CNDCondition files
*.PRMParameter files

Download a file

GetFile(name) downloads a file. Content is the text of the file, ContentRaw its bytes. The optional callback gives the progress of large files.

var robot = new YaskawaRobot();
robot.Connect("192.168.0.1");
// Download a file, with an optional progress callback
RobotFileContentData file = robot.HighSpeedEServer.GetFile("WELD01.JBI", progress =>
{
Console.WriteLine($"{progress.FileName}: {progress.DownloadedBytes} bytes");
});
// Text content, and the raw bytes for a binary file
File.WriteAllText("WELD01.JBI", file.Content);
File.WriteAllBytes("WELD01.copy.JBI", file.ContentRaw);
robot.Disconnect();
}
Click to see the full code

Upload a file

LoadFile(name, content) sends a text file to the controller. A job sent this way appears in the job list of the controller, ready to select.

var robot = new YaskawaRobot();
robot.Connect("192.168.0.1");
string content = File.ReadAllText("WELD01.JBI");
// Send the file to the controller, with an optional progress callback
robot.HighSpeedEServer.LoadFile("WELD01.JBI", content, progress =>
{
Console.WriteLine($"{progress.LoadedBytes} / {progress.TotalBytes} bytes");
});
robot.Disconnect();
}
Click to see the full code
  • To replace a file that exists on the controller, the parameters RS029 and RS214 must be 1. See Connect to your robot.
  • The controller checks the syntax of a job when it receives it. A job with an error is refused, with the reason in the message of the InvalidDataAnswerException.

Delete a file

DeleteFile(name) deletes a file of the controller. There is no undo: download the file first if you may need it.

var robot = new YaskawaRobot();
robot.Connect("192.168.0.1");
// Delete a job file of the controller. There is no undo
robot.HighSpeedEServer.DeleteFile("WELD01.JBI");
robot.Disconnect();
}
Click to see the full code

CMOS backup

BatchDataBackup() makes the controller write its CMOS backup (jobs, parameters, settings) to /SPDRV/CMOSBK.BIN. Then GetFile downloads it.

var robot = new YaskawaRobot();
robot.Connect("192.168.0.1");
// Ask the controller to write its CMOS backup to /SPDRV/CMOSBK.BIN.
// It takes several seconds
robot.HighSpeedEServer.BatchDataBackup();
// Download the backup as binary
RobotFileContentData backup = robot.HighSpeedEServer.GetFile("/SPDRV/CMOSBK.BIN");
File.WriteAllBytes("CMOSBK.BIN", backup.ContentRaw);
robot.Disconnect();
}
Click to see the full code
  • The backup takes several seconds. While it runs, a download of the file fails with an InvalidDataAnswerException: wait and try again.
  • The command needs the automatic backup function with the RAM disk as device. In management mode, select SETUP > AUTO BACKUP SET and set DEVICE to RAMDISK. If this menu is missing, start the controller in maintenance mode and set AUTOBACKUP to USED in SYSTEM > SETUP > OPTION FUNCTION.

Timeouts

The file transfers wait FileTimeoutMilliseconds (4000 ms by default) for each answer of the controller. Increase it if large files fail on a slow network. See Connect to your robot.

Try it in the demo application

Everything on this page can be tried without writing code, in the Files page of the demo application.

Files page of the Yaskawa SDK demo application

The demo application is open source. The C# source of this page is FileControl.cs.

Reference

Methods of HighSpeedEServerClientBase :
C#
// Performs a backup of the robot's CMOS. The CMOS.BIN file is copied locally in the robot controller to "/SPDRC/CMOSBK.BIN". The operation can take several seconds to complete. After this command, the backup file can be downloaded using GetFile("/SPDRC/CMOSBK.BIN"). To enable this command : in "MANAGEMENT MODE", select {SETUP} - {AUTO BACKUP SET} and set "DEVICE" to "RAMDISK". If this menu is not available, Reboot the controller in Maintenance Mode and set System / Setup / OPTION FUNCTION / AUTOBACKUP to "Used", then do a "Safety board flash reset" from File / Initialize
RobotDataHeader BatchDataBackup(string file = "/SPDRV/CMOSBK.BIN");
// Deletes a file from the robot controller's file system. Use with caution as deleted files cannot be recovered.
RobotDataHeader DeleteFile(string name);
// Downloads (saves) a file from the robot controller to the PC. Large files are received in multiple blocks and automatically reassembled. Special use case : to download CMOS.BIN, first perform a CMOS backup using BatchDataBackup, then use GetFile with the backup file path.
RobotFileContentData GetFile(string name, HighSpeedEServerClientBase.GetFileProgressDelegate onGetFileProgress = null);
// Retrieves a list of files matching a pattern from the robot controller. Supports wildcards for matching multiple files.
RobotFileListData GetFileList(string pattern);
// Uploads (loads) a file from the PC to the robot controller. Large files are automatically split into 479-byte chunks for transmission.
RobotDataHeader[] LoadFile(string name, string content, HighSpeedEServerClientBase.LoadFileProgressDelegate onLoadFileProgress = null);
Class
RobotFileListDatainherits RobotData
C#

Contains the result of a file listing operation on the robot controller. Returns an array of file names matching the specified pattern.

MemberTypeDescription
Files
Property
read only
string[]
Gets the array of file names returned by the listing operation. File names include extensions (e.g., "MYJOB.JBI", "SYSTEM.SYS").
Headers
Property
read only
List<RobotDataHeader>
Gets the list of response headers from multi-block transfers. File listings may span multiple UDP packets for large directories.
Class
RobotFileContentDatainherits RobotData
C#

Contains the content of a file downloaded from the robot controller. Provides methods for parsing structured file content such as job files and parameter files.

MemberTypeDescription
Content
Property
read only
string
Gets the text content of the downloaded file.
ContentRaw
Property
read only
byte[]
Gets the text content of the downloaded file.
FileName
Property
read only
string
Gets the name of the downloaded file.
Headers
Property
read only
List<RobotDataHeader>
Gets the list of response headers from multi-block transfers. Large files are transferred in multiple UDP packets.
GetParam(string, int, int)
Method
int
Class
LoadFileProgress
C#

Contains progress information for file upload (LoadFile) operations. Used with the LoadFileProgressDelegate callback to track upload progress.

MemberTypeDescription
Completed
Property
read only
bool
Gets whether the file upload has completed successfully.
FileName
Property
read only
string
Gets the name of the file being uploaded.
LoadedBytes
Property
read only
int
Gets the number of bytes uploaded so far.
TotalBytes
Property
read only
int
Gets the total size of the file in bytes.
Class
GetFileProgress
C#

Contains progress information for file download (GetFile) operations. Used with the GetFileProgressDelegate callback to track download progress.

MemberTypeDescription
Completed
Property
read only
bool
Gets whether the file download has completed successfully.
DownloadedBytes
Property
read only
int
Gets the number of bytes downloaded so far.
FileName
Property
read only
string
Gets the name of the file being downloaded.

轻松将 Universal Robots、Fanuc、Yaskawa、ABB 或 Staubli 机器人集成到您的 .NET、Python、LabVIEW 或 Matlab 应用程序中

UnderAutomation
联系我们Legal

© All rights reserved.