UnderAutomation
質問ですか?

[email protected]

お問い合わせ
UnderAutomation
⌘Q
このページは英語でのみ提供されています。

HTTP: read files from the web server

List the files of a Yaskawa controller with their description and read their text through its web server, without account and in any mode.

  • What the HTTP client does
  • Connect
  • Prerequisites
  • Enable HTTP
  • List the files
  • Read a file
  • Standalone client
  • Reference
  • What to read next

This page shows how to list the files of a Yaskawa Motoman controller and read their content through its web server, with the HTTP client of the SDK. It covers the YRC1000 and YRC1000micro controllers, and gives read only access: jobs, data files, parameters, logs.

What the HTTP client does

The controller has a web server on TCP port 80. The SDK reads the file lists and the files of this server, and gives you the names, the descriptions and the text of the files. It is the simplest way to read a file: no account, no remote mode, any mode of the controller.

NeedHTTPOther protocol
List the files of one typeYesFTP, High Speed Ethernet Server
Name and description of the data filesYesNo
Read a text file (job, data, parameter)YesFTP, High Speed Ethernet Server
Upload or delete a fileNoFTP, High Speed Ethernet Server
Binary files, CMOS backupNoFTP, High Speed Ethernet Server

Connect

Prerequisites

  • The PC reaches the controller on TCP port 80.
  • Nothing else: HTTP works in teach and in play mode, without the remote mode.

Enable HTTP

Set Http.Enable to true in ConnectParameters. Connect checks the address but does not send a request: the first method call is the first exchange.

ParameterDefaultMeaning
Http.EnablefalseOpen the HTTP client
Http.Port80TCP port of the web server
Http.TimeoutMilliseconds5000Time to wait for the answer of a request

List the files

GetFileList(fileExtension) lists the files of one type. Each FileDescription has the Name of the file and, for the data and parameter files, the Description given by the controller.

var robot = new YaskawaRobot();
robot.Connect(parameters);
// Jobs: the name only
FileDescription[] jobs = robot.Http.GetFileList(FileExtension.JOB);
// Data files: the name and the description given by the controller
foreach (FileDescription file in robot.Http.GetFileList(FileExtension.DAT))
Console.WriteLine($"{file.Name}: {file.Description}"); // VAR.DAT: VARIABLE DATA
robot.Disconnect();
}
Click to see the full code
FileExtensionFiles
JOBJobs (.JBI)
DATData files: variables, alarm history, I/O names... (.DAT)
CNDCondition files (.CND)
PRMParameter files (.PRM), for example ALL.PRM
SYSSystem files (.SYS)
LSTList files (.LST)
CSV, LOG, TXTOther text files

On a YRC1000micro, GetFileList(FileExtension.DAT) returns VAR.DAT - VARIABLE DATA, ALMHIST.DAT - ALARM HISTORY DATA, IONAME.DAT - IO NAME DATA and more.

Read a file

GetFile(name) returns the text of a file. The SDK finds the folder of the file from its extension: TEST.JBI is a job, VAR.DAT a data file.

var robot = new YaskawaRobot();
robot.Connect(parameters);
// Text of a job: the folder is deduced from the extension
string job = robot.Http.GetFile("TEST.JBI");
// Variables, alarm history, parameters...
string variables = robot.Http.GetFile("VAR.DAT");
string alarmHistory = robot.Http.GetFile("ALMHIST.DAT");
File.WriteAllText("TEST.JBI", job);
robot.Disconnect();
}
Click to see the full code

The text is the same as the file downloaded with FTP or with the High Speed Ethernet Server. A large file takes time: ALL.PRM (1.4 MB) takes about 13 s on a YRC1000micro, the same as with FTP. Increase TimeoutMilliseconds for large files.

Standalone client

HttpClient of the namespace UnderAutomation.Yaskawa.Http opens an HTTP client without YaskawaRobot. In a .NET project with implicit usings, System.Net.Http.HttpClient has the same name: write the full name, or add a using alias.

static void Main()
{
// An HTTP client without YaskawaRobot
// Full name: System.Net.Http also has an HttpClient class
var client = new UnderAutomation.Yaskawa.Http.HttpClient();
client.Connect("192.168.0.1", new HttpConnectParameters
{
Port = 80, // default
TimeoutMilliseconds = 5000, // default
});
foreach (FileDescription file in client.GetFileList(FileExtension.PRM))
Console.WriteLine(file);
client.Close();
}
}
Click to see the full code

Reference

Methods of HttpClientBase :
C#
// Marks the client as disconnected.
void Close();
// Gets the content of a file from the robot controller. The file type is deduced from the file name extension (e.g. "PICK_JOB.JBI" queries /FGET_REQUEST/ROBOT/JOB/PICK_JOB.JBI).
string GetFile(string fileName);
// Gets the list of files of the specified type available on the robot controller.
FileDescription[] GetFileList(FileExtension fileExtension);
Class
FileDescription
C#Python

Describes a file available on the robot controller.

MemberTypeDescription
FileDescription()
Constructor
Description
Property
read only
string
Description of the file, if available.
Name
Property
read only
string
File name including extension.
ToString()
Method
string
Returns the file name.
Enum
FileExtension
C#Python

Represents the file types available on a Yaskawa robot controller.

NameValueDescription
CND
2
Condition files (.CND)
CSV
6
CSV files (.CSV)
DAT
1
Data files (.DAT)
JOB
0
Job files (.JBI)
LOG
7
Log files (.LOG)
LST
5
List files (.LST)
PRM
4
Parameter files (.PRM)
SYS
3
System files (.SYS)
TXT
8
Text files (.TXT)
Class
HttpConnectParameters
C#Python

Connection parameters for HTTP communication with the robot controller.

MemberTypeDescription
HttpConnectParameters()
Constructor
Initializes a new instance of the HTTP connection parameters.
Port
Property
int
Gets or sets the HTTP port number. Default: 80.
TimeoutMilliseconds
Property
int
Gets or sets the maximum time in milliseconds to wait for a response. Default: 5000ms.
DEFAULT_PORT
Field
int
Default HTTP port (80).
DEFAULT_TIMEOUT_MILLISECONDS
Field
int
Default timeout in milliseconds for HTTP requests (5000ms).

What to read next

  • FTP: upload, download and delete files.
  • Transfer files and backups: which protocol to choose for each file task.

Universal Robots、Fanuc、Yaskawa、ABB、Staubli ロボットを .NET、Python、LabVIEW、または Matlab アプリケーションに簡単に統合

UnderAutomation
お問い合わせLegal

© All rights reserved.