UnderAutomation
Any question?

[email protected]

Contact us
UnderAutomation
⌘Q

Migrate from a brand SDK

Replace UnderAutomation.Fanuc or another brand SDK with UnderAutomation.Robotics: same namespaces, same types, same license key. Versions, error CS0433, then the common API step by step.

  • Before you start
  • Replace the reference
  • NuGet
  • DLL
  • Python
  • Recompile
  • Same license key
  • Maintenance of the key
  • Versions of the brands
  • Error CS0433
  • Keep both DLLs with extern alias
  • Add the common API step by step
  • What to read next

This page is for a project that already uses an UnderAutomation brand SDK (Fanuc, Yaskawa, Universal Robots, ABB or Stäubli) and moves to UnderAutomation.Robotics. Robotics contains the five brand SDKs with the same namespaces and the same types: you replace the reference, recompile, and keep your license key.

Replace the reference to the brand SDK with a reference to Robotics. The code and the license key stay the same.Replace the reference to the brand SDK with a reference to Robotics. The code and the license key stay the same.
Replace the reference to the brand SDK with a reference to Robotics. The code and the license key stay the same.

Before you start

Check four points:

  • The maintenance of your license key covers the release date of Robotics. See Maintenance.
  • The release of Robotics contains your brand SDK in the version you use, or a later one. See Versions of the brands.
  • Your project references Robotics or the brand SDK, not both: they contain the same types. See Error CS0433.
  • A key of one brand does not unlock the other brands. Each brand you connect needs its own key after the trial.

Replace the reference

NuGet

Remove the package of the brand and add Robotics:

Bash
dotnet remove package UnderAutomation.Fanuc
dotnet add package UnderAutomation.Robotics

With the Package Manager console of Visual Studio:

PowerShell
Uninstall-Package UnderAutomation.Fanuc
Install-Package UnderAutomation.Robotics

In the project file, the change is one line:

XML
<!-- Before -->
<PackageReference Include="UnderAutomation.Fanuc" Version="*" />
<!-- After -->
<PackageReference Include="UnderAutomation.Robotics" Version="*" />

Do the same for every brand package of the solution: UnderAutomation.Yaskawa, UnderAutomation.UniversalRobots, UnderAutomation.ABB, UnderAutomation.Staubli. Robotics replaces all of them.

DLL

If your project references the DLL directly, remove the reference to UnderAutomation.Fanuc.dll and add a reference to UnderAutomation.Robotics.dll, from the folder of the same target (net35, net48, netstandard2.0...). Where to download the DLL: see Get started with .NET.

Python

Uninstall the package of the brand first, then install Robotics:

Bash
pip uninstall UnderAutomation.Fanuc
pip install UnderAutomation.Robotics

Only one UnderAutomation package can be installed in a Python environment: each package writes the same file, underautomation/__init__.py. Uninstall every brand package of the environment before you install Robotics. The import lines of your code do not change, for example from underautomation.fanuc.fanuc_robot import FanucRobot.

Recompile

The code does not change. The namespaces (UnderAutomation.Fanuc, UnderAutomation.Yaskawa...) and the types (FanucRobot, YaskawaRobot, UR, AbbController, StaubliController) are the same in Robotics.

Rebuild the whole solution. .NET identifies a type by its name and by its assembly, so a project compiled against UnderAutomation.Fanuc.dll does not run with UnderAutomation.Robotics.dll until it is compiled again. Rebuild also your own libraries that used the brand SDK, and replace their reference in the same way.

Same license key

Keep the RegisterLicense call of each brand, with the same licensee and the same key. Robotics checks the key of each brand with the license code of this brand.

static void Main()
{
// Same call and same key as with UnderAutomation.Fanuc
FanucRobot.RegisterLicense("YourCompanyName", "YOUR_LICENSE_KEY");
LicenseInfo info = FanucRobot.LicenseInfo;
if (info.State == LicenseState.MaintenanceNeeded)
{
// The maintenance of the key ends before the release date of this version of Robotics
Console.WriteLine($"Maintenance until {info.MaintenanceExpirationDate}, release date {info.ProductReleaseDate}");
}
}
}
Click to see the full code

Maintenance of the key

A key can use the releases published before the end of its maintenance. For Robotics, the date that counts is the release date of Robotics, not the date of the brand SDK that you used before. If the maintenance of your key ends before the release date of Robotics, the license state is MaintenanceNeeded: renew the maintenance, or stay on the brand SDK. The license states are described in Licensing.

Versions of the brands

Each release of Robotics contains one release of each brand SDK. The version of the brand in Robotics must be equal to or later than the version of the brand SDK you used before. With an older version, a member added later to the brand SDK is missing, and code that uses it does not compile.

The release notes of each release of Robotics give, in a table, the version of each brand SDK that it contains, with a link to the release of this brand. Example: a project that uses UnderAutomation.Fanuc 7.1.0 needs a release of Robotics that contains Fanuc 7.1.0 or later.

Error CS0433

A project that references a brand SDK and Robotics at the same time does not compile. Each type of the brand is defined in both DLLs:

error CS0433: The type 'FanucRobot' exists in both 'UnderAutomation.Fanuc, Version=7.1.0.0, ...' and 'UnderAutomation.Robotics, Version=...'

Remove the reference to the brand SDK. It can also come from another package or project of the solution: dotnet list package --include-transitive lists the packages that each project gets, also through another package.

Two brand SDKs in one project, for example UnderAutomation.Fanuc and UnderAutomation.Yaskawa, can also give CS0433: it occurs when your code uses one of the common types UnderAutomation.Robotics.* that both DLLs define, for example CartesianPose. Robotics replaces both with one reference.

The brand packages of the next releases log the build warning UA0001 when a project references two of these SDKs, or a brand SDK together with Robotics, and link this section. If you keep both on purpose with an extern alias, add <NoWarn>UA0001</NoWarn> to the project to silence it.

Keep both DLLs with extern alias

In the rare case where your project must keep the brand SDK, for example because a library that you cannot recompile needs UnderAutomation.Fanuc.dll, give an alias to the brand SDK. In the project file:

XML
<PackageReference Include="UnderAutomation.Fanuc" Version="*" Aliases="FanucSdk" />
<PackageReference Include="UnderAutomation.Robotics" Version="*" />

For a DLL reference, add <Aliases>FanucSdk</Aliases> to the Reference item. The names of the brand SDK then need the alias, the names without alias come from Robotics:

// First line of the file, before the using directives
extern alias FanucSdk;
using UnderAutomation.Fanuc;
// FanucRobot of UnderAutomation.Robotics
FanucRobot.RegisterLicense("YourCompanyName", "YOUR_LICENSE_KEY");
FanucRobot robot = new FanucRobot();
// FanucRobot of UnderAutomation.Fanuc, through its alias.
// This DLL has its own license state: register the key there too.
FanucSdk::UnderAutomation.Fanuc.FanucRobot.RegisterLicense("YourCompanyName", "YOUR_LICENSE_KEY");
FanucSdk::UnderAutomation.Fanuc.FanucRobot oldRobot = new FanucSdk::UnderAutomation.Fanuc.FanucRobot();
}
}
Click to see the full code

The two FanucRobot types are different types, and each DLL has its own license state. Use this only for the transition: the application then contains the brand code twice.

Add the common API step by step

After the migration, your code works as before. You can then use the common API, RobotController, next to it, one feature at a time:

  1. Create a RobotController and connect it with the connection parameters class of the brand SDK. The brand comes from the type of the parameters.
  2. Write the new code with the services of the common API: Info, State, Program, Variable, Io, Alarm, Motion, File...
  3. For your existing code, take the brand object from robot.Native instead of creating a second connection. It is the object of the brand SDK, on the same connection.
  4. Move the calls of the brand SDK to the common API when you need them on another brand.
static void Main()
{
// Same license call as before
FanucRobot.RegisterLicense("YourCompanyName", "YOUR_LICENSE_KEY");
// The connection parameters class of the brand SDK, given to the common API
ConnectionParameters parameters = new ConnectionParameters("192.168.0.1");
RobotController robot = new RobotController();
robot.Connect(parameters);
// New code: the common API
RobotControllerInfo info = robot.Info.Read();
Console.WriteLine($"{info.Model}, {info.SoftwareVersion}");
foreach (ProgramExecution execution in robot.Program.ReadExecution())
Console.WriteLine($"{execution.Task}: {execution.Program}, line {execution.Line}");
// Existing code: the FanucRobot of the brand SDK, on the same connection
FanucRobot fanuc = (FanucRobot)robot.Native;
if (fanuc.Cgtp.Enabled)
{
var r1 = fanuc.Cgtp.ReadNumericRegisterWithComment(1);
Console.WriteLine($"R[1] = {r1}");
}
robot.Disconnect();
}
Click to see the full code
BrandConnection parametersType of robot.Native
FanucUnderAutomation.Fanuc.ConnectionParametersFanucRobot
YaskawaUnderAutomation.Yaskawa.ConnectParametersYaskawaRobot
Universal RobotsUnderAutomation.UniversalRobots.ConnectParametersUR
ABBUnderAutomation.ABB.ConnectionParametersAbbController
StäubliUnderAutomation.Staubli.ConnectionParametersStaubliController

robot.Native is of type object: cast it to the type of the brand. It is null when the controller is not connected. It uses the protocols that the connection opened, so test that the protocol you need is open before you call it, as in the code above.

The connection checks the license of the brand of the controller: the RegisterLicense call of the brand is the same as before. The result objects of the common API (RobotControllerInfo, ProgramExecution, IoValue...) also keep the brand object they come from, in their Native property.

A method that a brand does not have throws FeatureNotSupportedException, and IsAvailable returns false before the call. The Routing page gives, for each method, the protocol used on each brand.

What to read next

  • Licensing: the trial, the license key of each brand, the license states.
  • Common API: the services of RobotController.
  • Routing: which protocol each method uses on each brand.
  • Connect to your robot: the connection parameters of each brand.