Run a job
Select a job of a Yaskawa controller, switch the servo on, start it and wait for its end from C# or Python. Settings of the controller and frequent errors.
This article shows how to start a job of a Yaskawa Motoman controller from a PC, in C# or Python, and wait for its end. It gives a complete program that checks the mode, resets an alarm, selects the job, switches the servo on and starts it.
Prerequisites
- The SDK is connected to the controller: see Connect to your robot.
- The controller is in play mode and accepts the remote commands, and the job selection is permitted: see Prepare the controller.
- The job exists on the controller. To send it from the PC, see Transfer files and backups.
Steps
| Step | Method |
|---|---|
| Check the mode | GetStatusInformation(): Play, CommandRemote |
| Reset an alarm | AlarmReset(AlarmResetType.Reset) |
| Select the job and its line | SelectJob(name, line) |
| One cycle or continuous | SwitchingCommand(SwitchingCommands.Cycle) |
| Servo on | ServoCommand(OnOffCommandType.Servo, true) |
| Start | StartJob() |
| Follow | GetExecutingJobInformation(), GetStatusInformation().Running |
Example
using UnderAutomation.Yaskawa;using UnderAutomation.Yaskawa.HighSpeedEServer;public class HowToRunProgram{static void Main(){var robot = new YaskawaRobot();robot.Connect("192.168.0.1");// 1. Check the mode: play and remoteRobotStatusData status = robot.HighSpeedEServer.GetStatusInformation();if (!status.Play || !status.CommandRemote)throw new InvalidOperationException("Set the controller in play mode and remote mode");// 2. Reset a pending alarmif (status.Alarming)robot.HighSpeedEServer.AlarmReset(AlarmResetType.Reset);// 3. Select the job at its first line, one cycle, servo on, startrobot.HighSpeedEServer.SelectJob("WELD01", 0);robot.HighSpeedEServer.SwitchingCommand(SwitchingCommands.Cycle);robot.HighSpeedEServer.ServoCommand(OnOffCommandType.Servo, true);robot.HighSpeedEServer.StartJob();// 4. Wait for the end of the jobdo{Thread.Sleep(200);RobotJobData job = robot.HighSpeedEServer.GetExecutingJobInformation();Console.WriteLine($"{job.Name} line {job.Line}");status = robot.HighSpeedEServer.GetStatusInformation();}while (status.Running);Console.WriteLine(status.Alarming ? "Stopped on an alarm" : "Job done");robot.Disconnect();}}
The program stops with an error if the controller is not in play mode or not in remote mode. Then it runs the job once, prints its line every 200 ms, and says at the end whether the job ended or stopped on an alarm.
Stop a job
Hold the robot with ServoCommand(OnOffCommandType.Hold, true): the robot stops on its path. Release the hold and call StartJob() to continue, or switch the servo off to end. See Jobs.
Troubleshooting
Command remote not set: the remote mode is off. See Prepare the controller.Incorrect mode: the controller is in teach mode. Turn the mode key to play.SelectJobis refused: the name has the.JBIextension, the job does not exist, orJOB SELECT WHEN REMOTE AND PLAYis not permitted.Servo OFF: callServoCommand(OnOffCommandType.Servo, true)beforeStartJob().
What to read next
- Jobs: the reference of the job methods.
- Read and reset alarms.