UnderAutomation
Eine Frage?

[email protected]

Kontakt
UnderAutomation
⌘Q
ABB SDK documentation
Licensing
Documentation home

Robot Web Services overview

Robot Web Services (RWS) is the REST interface of ABB robot controllers. One API covers RWS 1.0 on IRC5 and RWS 2.0 on OmniCore.

Robot Web Services (RWS) is the HTTP interface an ABB controller exposes on the network. The SDK wraps it in nine services, reachable from robot.Rws once the connection is open. Nothing has to be installed on the robot.

Quick tour

Every service is a property of robot.Rws. Read operations need no special right, they only need a valid user account.

// Identity of the controller and version of the system it runs
Console.WriteLine(robot.Rws.Controller.GetIdentity().Name);
Console.WriteLine(robot.Rws.System.GetInfo().VersionName);
// Operation mode and motors state
Console.WriteLine(robot.Rws.Panel.GetOperationMode());
Console.WriteLine(robot.Rws.Panel.GetControllerState());
// RAPID tasks and their execution state
foreach (RapidTaskItem task in robot.Rws.Rapid.GetTasks())
Console.WriteLine($"{task.Name} : {task.ExecutionState}");
// I/O signals
foreach (IoSignalItem signal in robot.Rws.Io.GetSignals())
Console.WriteLine($"{signal.Name} = {signal.LogicalValue}");
// Current position of the robot
Console.WriteLine(robot.Rws.MotionSystem.GetRobTarget("ROB_1"));

The nine services

ServiceWhat it doesPage
robot.Rws.ControllerController identity, clock and time zone, network configuration, restart, backup and restore, safety stateController
robot.Rws.PanelOperation mode, motors on and off, speed ratio, collision detectionControl panel
robot.Rws.RapidRAPID tasks, program execution, modules, variables and symbolsRAPID tasks
robot.Rws.IoDigital, analog and group signals, I/O devices and networksI/O
robot.Rws.MotionSystemRobot position, jogging, kinematics, mechanical units, calibrationMotion system
robot.Rws.FileFile system of the controller, download and uploadFile system
robot.Rws.ElogEvent log of the controllerEvent log
robot.Rws.MastershipWrite lock of the controllerMastership
robot.Rws.SystemSystem version, options, products, robot types, energy countersSystem

The RAPID service is large, so it is documented on three pages: tasks and execution, variables and symbols, modules and programs.

Two versions, one API

RWS exists in two versions. RWS 1.0 runs on IRC5 controllers with RobotWare 6, RWS 2.0 on OmniCore controllers with RobotWare 7. The version is chosen at connection time with the RwsVersion enum, and the SDK handles the differences internally.

Your code stays the same on both. A few operations only exist on one of the two, they are marked on each page with an availability badge. See IRC5 or OmniCore: which RWS version for the comparison.

Mastership, the write lock

Reading is always allowed. Writing is not: the controller gives the right to change a domain to one client at a time, and this right is called the mastership. Take it before a write, give it back right after, so the operator can still use the teach pendant. A write attempted without it fails with the HTTP status code 403.

// Reading never needs the mastership
var value = robot.Rws.Rapid.GetSymbolValue("RAPID/T_ROB1/user/reg1");
// Writing does. Take it as late as possible and give it back in a finally block
robot.Rws.Mastership.Request(MastershipDomain.Rapid);
try
{
robot.Rws.Rapid.SetSymbolValue("RAPID/T_ROB1/user/reg1", "5");
}
finally
{
robot.Rws.Mastership.Release(MastershipDomain.Rapid);
}

Two calls take the mastership for you, Panel.SetSpeedRatio and Controller.Restart. The full rules are on the Mastership page.

Errors

Every failure of an RWS call is reported as an RwsException. It carries the HTTP status code in StatusCode, and the error the controller described in RwsErrorCode, RwsErrorMessage and ResponseBody.

try
{
robot.Rws.Io.SetSignalValue("Local", "PANEL", "DO_Gripper", 1);
}
catch (RwsException ex)
{
// StatusCode is the HTTP status code the controller answered
if (ex.StatusCode == 403)
Console.WriteLine("Mastership is held elsewhere, or the user account lacks the grant");
else if (ex.StatusCode == 404)
Console.WriteLine("This signal does not exist on this controller");
else
Console.WriteLine($"RWS error {ex.StatusCode} : {ex.RwsErrorMessage}");
}
StatusUsual meaning
400The controller refused the value, for example a speed ratio out of range
403Mastership is held elsewhere, or the user account lacks the UAS grant
404The resource does not exist on this controller, often a wrong RwsVersion
500The controller could not run the operation in its current state
503The controller has no free session left

A parsing failure is reported as an RwsException too, so a single catch covers the whole SDK.

Synchronous and asynchronous

Every service method exists twice. The synchronous version is always available. The asynchronous one has the same name followed by Async, returns a Task and takes an optional CancellationToken.

// Synchronous, available on every target framework
var options = robot.Rws.System.GetOptions();
// Asynchronous, same name with the Async suffix and an optional cancellation token
var products = await robot.Rws.System.GetProductsAsync();
using (var cts = new CancellationTokenSource(TimeSpan.FromSeconds(5)))
{
var energy = await robot.Rws.System.GetEnergyAsync(cts.Token);
Console.WriteLine(energy.AccumulatedEnergy);
}

The asynchronous methods are not compiled for .NET Framework 3.5 and 4.0, which have no async and await. Everything else works on those versions.

Sessions

Each connection uses one session on the controller. An OmniCore accepts around 70 of them at the same time. An application that connects in a loop without calling Disconnect exhausts them, and every following request then answers 503. Connect once, keep the object, disconnect when your application closes.

View as Markdown

Integrieren Sie Roboter von Universal Robots, Fanuc, Yaskawa, ABB oder Staubli ganz einfach in Ihre .NET-, Python-, LabVIEW- oder Matlab-Anwendungen

UnderAutomation
KontaktLegal

© All rights reserved.