UnderAutomation
質問ですか?

[email protected]

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

Start, stop and select a robot program from a PC

Select, start and pause a program on Fanuc, Yaskawa, Universal Robots, ABB and Stäubli controllers with one code, and stop it where the controller has a stop: program names and modes of each brand, C# and Python examples.

  • Prerequisites
  • Brand support
  • Example
  • Start a program on each controller of a cell
  • List the programs
  • What changes from one brand to another
  • Errors
  • What to read next

This article shows how to select, start and pause a robot program from a PC on Fanuc, Yaskawa, Universal Robots, ABB and Stäubli controllers, and stop it where the controller has a stop, with one code in C# or Python. Only the address of the controller and the native name of the program change from one brand to another: the table at the end gives the names and the modes of each brand.

Prerequisites

  • UnderAutomation.Robotics in your project. See Get started with .NET or Get started with Python.
  • The connection settings of each controller. See Connect to your robot.
  • The license of each brand you connect, or the 30 day trial. See Licensing.
  • The program is on the controller. To send it from the PC, see Transfer files.
  • The mode of the controller that accepts a start from the network, and the servo power when the program moves the robot. See the table at the end and State.
  • A program that you start moves the robot as if the operator started it. Keep the cell safe: nobody in the working area, a person at the emergency stop for the first tests.

Brand support

Each cell gives the protocol that the method uses on this brand, in the default order. The table is generated from the route data of the library. "Not available" means that the brand has no route for the method: the call throws FeatureNotSupportedException, and IsAvailable returns false before the call. (manual) marks a route that you enable yourself in the connection parameters.

Programs
MethodFanucYaskawaUniversal RobotsABBStäubli
Program.ListCGTP (Cgtp), FTPHigh Speed Ethernet Server, Ethernet Server, FTPSFTPRobot Web ServicesSOAP, Files
Program.SelectCGTP (Cgtp)High Speed Ethernet Server, Ethernet ServerDashboard Server, REST APIRobot Web ServicesSOAP
Program.StartCGTP (Cgtp), CGTP (CgtpKcl), TelnetHigh Speed Ethernet Server, Ethernet ServerDashboard Server, REST APIRobot Web ServicesSOAP
Program.PauseCGTP (Cgtp), CGTP (CgtpKcl), TelnetHigh Speed Ethernet Server, Ethernet ServerDashboard Server, REST APIRobot Web ServicesSOAP
Program.ResumeCGTP (CgtpKcl), TelnetHigh Speed Ethernet Server, Ethernet ServerDashboard Server, REST APIRobot Web ServicesSOAP
Program.StopCGTP (Cgtp), CGTP (CgtpKcl), TelnetNot availableDashboard Server, REST APIRobot Web ServicesSOAP
Program.ReadExecutionSNPX, CGTP (CgtpKcl), Telnet, FTPHigh Speed Ethernet Server, Ethernet ServerDashboard Server, REST APIRobot Web ServicesSOAP
Methods of this article7 of 76 of 77 of 77 of 77 of 7

Example

Start a program on each controller of a cell

The example connects to the controllers of a cell one after the other. It selects a program, starts it, reads the execution state, then stops it. Select selects the program, so that Start without a name starts it. ReadExecution returns one ProgramExecution per task: the program, the line and the status.

A brand without Stop returns false for IsAvailable(ProgramFeature.Stop). The example then calls Pause, which keeps the program at its line.

static void Main()
{
// One line per controller: the brand, the address and the native name of a program
var cell = new[]
{
(Brand: "fanuc", Address: "192.168.0.1", Program: "MAIN"),
(Brand: "yaskawa", Address: "192.168.0.2", Program: "TEST"),
(Brand: "universalrobots", Address: "192.168.0.3", Program: "main"),
(Brand: "abb", Address: "192.168.125.1", Program: "T_ROB1/Module1/main"),
(Brand: "staubli", Address: "192.168.0.254", Program: "myApp"),
};
foreach (var controller in cell)
{
// The same code for each controller of this cell
RobotController robot = new RobotController();
robot.Connect(RobotConnectionParameters.Create(controller.Brand, controller.Address));
// ABB: take the RAPID mastership with the ABB SDK through robot.Native before the start
robot.Program.Select(controller.Program);
robot.Program.Start();
foreach (ProgramExecution execution in robot.Program.ReadExecution())
Console.WriteLine($"{robot.Brand} {execution.Program}, line {execution.Line}, {execution.Status}");
// A brand without Stop: Pause keeps the program at its line
if (robot.Program.IsAvailable(ProgramFeature.Stop))
robot.Program.Stop();
else
robot.Program.Pause();
robot.Disconnect();
}
}
}
Click to see the full code

In Python, the names are in snake_case: robot.program.select(...), robot.program.read_execution(), robot.program.is_available(...). An empty name (start("")) starts the selected program.

List the programs

List returns the programs of the controller. On ABB, it lists the modules of each task, and Select takes a routine of a module.

RobotController robot = new RobotController();
robot.Connect(RobotConnectionParameters.Create("fanuc", "192.168.0.1"));
foreach (RobotProgramInfo program in robot.Program.List())
Console.WriteLine($"{program.Name} {program.Comment}");
robot.Disconnect();
}
Click to see the full code

What changes from one brand to another

The code does not change. The name of the program follows the syntax of the controller, and each controller has its own conditions for a start from the network.

BrandNative nameExampleConditions on the controllerBrand article
FanucName of the program, as the pendant shows it.MAINRemote control enabled on the controller: the system variables $RMT_MASTER and $REMOTE_CFG.$REMOTE_TYPE set to 1. See the brand article.Run a program remotely
YaskawaName of the job, without extension.TESTRemote mode and play mode to select and start a job. The controller has no remote abort of a job: Stop is not available, Pause holds the job.Run a program
Universal RobotsName or path of the .urp program, without extension.mainOn e-Series and PolyScope X, the robot is in remote control.Run a program
ABBRoutine to start: task, module and routine, or module and routine in the first motion task.T_ROB1/Module1/main, Module1/mainAutomatic mode, and the RAPID mastership taken with the ABB SDK through robot.Native. See Mastership.Start and stop a RAPID program
StäubliName of the VAL 3 application, or its project path.myApp, Disk://myApp/myApp.pjxThe user of the connection can start applications. Select loads the application, Start starts it.Run a program

The page Program gives the other methods: start at a line, cycle mode, hold, stop of one task, positions of a program. Their support depends on the brand.

Errors

  • FeatureNotSupportedException: the brand has no route for the method, for example Stop on Yaskawa.
  • RouteUnavailableException: the method has routes, but none can be used, for example because the protocol did not answer at the connection.
  • ControllerRefusedException: the controller received the command and refused it, for example because it is not in the right mode. The connection is still good.
  • RobotControllerException: the route failed. Its inner exception is the exception of the brand SDK.

The page Errors explains each exception.

What to read next

  • Program: every method of the Program service.
  • Monitor the state of a robot controller: follow the mode, the servo power and the execution.
  • Read and reset robot alarms: restart after an alarm.