---
title: "Start, stop and select a robot program from a PC"
description: "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."
---

# Start, stop and select a robot program from a PC

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](/robotics/documentation/get-started-net) or [Get started with Python](/robotics/documentation/get-started-python).
- The connection settings of each controller. See [Connect to your robot](/robotics/documentation/connect).
- The license of each brand you connect, or the 30 day trial. See [Licensing](/robotics/documentation/license).
- The program is on the controller. To send it from the PC, see [Transfer files](/robotics/documentation/how-to-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](/robotics/documentation/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.

Routes of each method in the default order. The first route is used, the next ones are fallbacks. (manual) marks a route that you enable yourself.

| Method | Fanuc | Yaskawa | Universal Robots | ABB | Stäubli |
| --- | --- | --- | --- | --- | --- |
| Program.List | CGTP (Cgtp), FTP | High Speed Ethernet Server, Ethernet Server, FTP | SFTP | Robot Web Services | SOAP, Files |
| Program.Select | CGTP (Cgtp) | High Speed Ethernet Server, Ethernet Server | Dashboard Server, REST API | Robot Web Services | SOAP |
| Program.Start | CGTP (Cgtp), CGTP (CgtpKcl), Telnet | High Speed Ethernet Server, Ethernet Server | Dashboard Server, REST API | Robot Web Services | SOAP |
| Program.Pause | CGTP (Cgtp), CGTP (CgtpKcl), Telnet | High Speed Ethernet Server, Ethernet Server | Dashboard Server, REST API | Robot Web Services | SOAP |
| Program.Resume | CGTP (CgtpKcl), Telnet | High Speed Ethernet Server, Ethernet Server | Dashboard Server, REST API | Robot Web Services | SOAP |
| Program.Stop | CGTP (Cgtp), CGTP (CgtpKcl), Telnet | Not available | Dashboard Server, REST API | Robot Web Services | SOAP |
| Program.ReadExecution | SNPX, CGTP (CgtpKcl), Telnet, FTP | High Speed Ethernet Server, Ethernet Server | Dashboard Server, REST API | Robot Web Services | SOAP |
| Methods of this article | **7 of 7** | **6 of 7** | **7 of 7** | **7 of 7** | **7 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.

**C# : ProgramAllBrands**
```csharp
using UnderAutomation.Robotics.Controllers;

public class ProgramAllBrands
{
    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();
        }
        /**/
    }
}
```

**Python : ProgramAllBrands**
```python
from underautomation.robotics.controllers.robot_controller import RobotController
from underautomation.robotics.controllers.robot_connection_parameters import RobotConnectionParameters
from underautomation.robotics.controllers.program_feature import ProgramFeature

##
# One line per controller: the brand, the address and the native name of a program
cell = [
    ("fanuc", "192.168.0.1", "MAIN"),
    ("yaskawa", "192.168.0.2", "TEST"),
    ("universalrobots", "192.168.0.3", "main"),
    ("abb", "192.168.125.1", "T_ROB1/Module1/main"),
    ("staubli", "192.168.0.254", "myApp"),
]

for brand, address, program in cell:
    # The same code for each controller of this cell
    robot = RobotController()
    robot.connect(RobotConnectionParameters.create(brand, address, ""))

    # ABB: take the RAPID mastership with the ABB SDK through robot.native before the start
    robot.program.select(program)
    # An empty name starts the selected program
    robot.program.start("")

    for execution in robot.program.read_execution():
        print(f"{robot.brand.name} {execution.program}, line {execution.line}, {execution.status.name}")

    # A brand without stop: pause keeps the program at its line
    if robot.program.is_available(ProgramFeature.Stop):
        robot.program.stop()
    else:
        robot.program.pause()

    robot.disconnect()
##
```

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.

**C# : ProgramList**
```csharp
using UnderAutomation.Robotics.Controllers;

public class ProgramList
{
    static void Main()
    {
        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();
    }
}
```

**Python : ProgramList**
```python
from underautomation.robotics.controllers.robot_controller import RobotController
from underautomation.robotics.controllers.robot_connection_parameters import RobotConnectionParameters

robot = RobotController()
robot.connect(RobotConnectionParameters.create("fanuc", "192.168.0.1", ""))

##
for program in robot.program.list():
    print(f"{program.name} {program.comment}")
##

robot.disconnect()
```

## 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.

| Brand | Native name | Example | Conditions on the controller | Brand article |
| --- | --- | --- | --- | --- |
| Fanuc | Name of the program, as the pendant shows it. | `MAIN` | Remote 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](/fanuc/documentation/run-program-remotely) |
| Yaskawa | Name of the job, without extension. | `TEST` | Remote 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](/yaskawa/documentation/how-to-run-program) |
| Universal Robots | Name or path of the `.urp` program, without extension. | `main` | On e-Series and PolyScope X, the robot is in remote control. | [Run a program](/universal-robots/documentation/how-to-run-program) |
| ABB | Routine to start: task, module and routine, or module and routine in the first motion task. | `T_ROB1/Module1/main`, `Module1/main` | Automatic mode, and the RAPID mastership taken with the ABB SDK through `robot.Native`. See [Mastership](/abb/documentation/rws-mastership). | [Start and stop a RAPID program](/abb/documentation/start-stop-rapid-program) |
| Stäubli | Name of the VAL 3 application, or its project path. | `myApp`, `Disk://myApp/myApp.pjx` | The user of the connection can start applications. `Select` loads the application, `Start` starts it. | [Run a program](/staubli/documentation/how-to-run-program) |

The page [Program](/robotics/documentation/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](/robotics/documentation/errors) explains each exception.

## What to read next

- [Program](/robotics/documentation/program): every method of the Program service.
- [Monitor the state of a robot controller](/robotics/documentation/how-to-monitor-state): follow the mode, the servo power and the execution.
- [Read and reset robot alarms](/robotics/documentation/how-to-read-reset-alarms): restart after an alarm.