Jobs
List the jobs of a Yaskawa controller through the Ethernet Server, select and start a job, wait for its end in one call, set the master job and delete jobs.
This page shows how to list, select, start and follow the jobs of a Yaskawa Motoman controller through the Ethernet Server, and how to wait for the end of a job in one call. It covers the YRC1000 and YRC1000micro controllers.
List the jobs
GetJobDirectory(filter) returns the names of the jobs, without the .JBI extension. The filter accepts *: "*" (default) lists every job, "VISION*" the jobs whose name starts with VISION. GetExecutingJobInformation() reads the job that is executed, with its line and step.
var robot = new YaskawaRobot();robot.Connect(parameters);// Names of every job, without extensionHostControlJobDirectoryData all = robot.EServer.GetJobDirectory();foreach (string name in all.JobNames)Console.WriteLine(name);// Jobs whose name starts with VISIONHostControlJobDirectoryData vision = robot.EServer.GetJobDirectory("VISION*");// Executing job: name, line and stepHostControlJobData job = robot.EServer.GetExecutingJobInformation();Console.WriteLine($"{job.Name}, line {job.Line}, step {job.Step}");robot.Disconnect();}
On a YRC1000micro with 7 jobs, GetJobDirectory() answers in about 20 ms.
Start a job and wait for its end
Prerequisites
- The controller is in play mode and in remote mode.
- No alarm is active, no hold is on.
- The job exists on the controller. To send a job, see FTP.
Example
var robot = new YaskawaRobot();robot.Connect(parameters);// Play mode, remote mode, no alarmrobot.EServer.SelectJob("PICK", 0); // job and linerobot.EServer.SetServo(true);robot.EServer.StartJob();// Blocks until the job ends, or 60 sbool completed = robot.EServer.WaitForJobCompletion(60);Console.WriteLine(completed ? "Job completed" : "Job stopped or timeout");robot.Disconnect();}
SelectJob(name, line)selects the job and the line to start from (0 to 9999).SetServo(true)switches the servo power on.StartJob()starts the selected job.StartJob(name)selects and starts a job in one call.WaitForJobCompletion(seconds)blocks until the job ends. It returnstruewhen the job completed,falsewhen it was stopped or when the time is over.-1waits without limit, the maximum is 32767 s.
WaitForJobCompletion throws a HostControlException when the job stops because of a hold, an alarm or the servo power. Catch it to know why the job did not end.
Master job and tasks
var robot = new YaskawaRobot();robot.Connect(parameters);// Master job: the job of the master task, selected at startuprobot.EServer.SetMasterJob("MAIN");// Start a job by its name, without SelectJob firstrobot.EServer.StartJob("MAIN");// Task of the next job commands (0 = master task, 1 to 15 = sub tasks)robot.EServer.SetTask(0);// Delete a job of the controller: there is no undorobot.EServer.DeleteJob("OLDJOB");robot.Disconnect();}
| Method | Effect |
|---|---|
SetMasterJob(name) | Sets the master job and selects it for execution |
SetTask(task) | Task of the next job commands: 0 is the master task, 1 to 15 the sub tasks |
DeleteJob(name) | Deletes a job. "*" deletes every job. There is no undo |
Download the jobs before you delete them: see Transfer files and backups.
Relative jobs
ConvertToRelativeJob(name, coordinateSystem) converts a job to a relative job in a frame, and ConvertToStandardJob converts it back. They need the relative job function on the controller.
Reference
Methods of HostControlClientBase :// Converts a specified job to a relative job of a specified coordinate system. Requires the relative job function on the robot controller.HostControlResponse ConvertToRelativeJob(string jobName, HostControlCoordinateSystem coordinateSystem);// Converts a specified job to a standard job (pulse job). Requires the relative job function on the robot controller.HostControlResponse ConvertToStandardJob(string jobName, int convertingMethod, int referencePositionVariable);// Deletes a specified job from the robot controller.HostControlResponse DeleteJob(string jobName);// Reads information about the currently selected and executing job (program). Returns job name, current line, and step.HostControlJobData GetExecutingJobInformation();// Reads the job directory listing from the robot controller.HostControlJobDirectoryData GetJobDirectory(string jobNameFilter = "*");// Sets the job name and line number for execution.HostControlResponse SelectJob(string jobName, int line);// Sets a specified job as the master job and execution job.HostControlResponse SetMasterJob(string jobName);// Changes the current task selection.HostControlResponse SetTask(int task);// Starts job execution. Starts the currently selected job, or starts a specific job if specified.HostControlResponse StartJob(string jobName = null);// Waits for the current job to complete or the specified timeout to elapse. No response is sent until the job completes or the timeout expires.bool WaitForJobCompletion(int timeoutSeconds = -1);
Contains job directory listing data. Retrieved using the RJDIR command.
| Member | Type | Description |
|---|---|---|
JobNames Property read only | List<string> | Gets or sets the list of job names in the directory. |
Contains information about the currently executing job (program). Retrieved using the RJSEQ command.
| Member | Type | Description |
|---|---|---|
Line Property read only | int | Gets or sets the current line number within the job (0-9999). |
Name Property read only | string | Gets or sets the name of the currently executing job. |
Step Property read only | int | Gets or sets the current step number within the job (1-9998). |
What to read next
- Run a job: the same task with the High Speed Ethernet Server, and the frequent errors.
- Variables and I/O: exchange data with the job.