### Subscription Setup and Event Listening (Pseudo-code) Source: https://developercenter.robotstudio.com/api/RWS A pseudo-code example illustrating the sequence of steps to set up a subscription and begin receiving events. It covers HTTP POST for subscription, retrieving websocket URL, and establishing a secure websocket connection. ```pseudo String Payload="resources=1&1=/rw/iosystem/signals/Virtual1/Board1/do1;state&1-p=1" HttpConnection.Connect("https://127.0.0.1") HttpResponse = HttpConnection.Post("/subscription", Payload); InitialEventsXml = HttpResponse.GetBody() WebSocketUrl = HttpResponseGetHeader("Location") WebSocketConnection.addHeader(HttpResponseGetCookies()) WebSocketConnection.Connect(WebSocketUrl,WebSocketSubProtocol='rws_subscription') EventsXml = WebSocketConnection.Receive() ``` -------------------------------- ### Hello Controller Example (JSON) Source: https://developercenter.robotstudio.com/api/rwsApi/examples Example showing how to get a 'Hello Controller' response in JSON format via Robot Web Services. This is ideal for machine-to-machine communication and integration with JavaScript applications. ```json { "message": "Hello from Robot Controller!", "status": "success" } ``` -------------------------------- ### Launch and Close Views using ITpsViewLaunchServices (C#) Source: https://developercenter.robotstudio.com/api/fpsdk/html/89cb7792-22bd-12cc-ebb1-a3c480c08656 Example demonstrating the implementation of ITpsViewSetup to access and utilize the ITpsViewLaunchServices interface. It shows how to obtain the service instance during installation and use its methods like LaunchView and CloseView. ```csharp using System; using ABB.Robotics; using ABB.Robotics.Tps.Taf; using ABB.Robotics.Tps.Windows.Forms; [assembly: TpsView("TpsViewApp", "tpu-Operator32.gif", "tpu-Operator16.gif", "TpsViewApp.dll", "TpsViewApp.TpsViewApp", StartPanelLocation.Left, TpsViewType.Dynamic)] namespace TpsViewApp { public class TpsViewApp : GTPUMasterDialog, ITpsViewSetup { private ABB.Robotics.Tps.Taf.ITpsViewLaunchServices _iTpsSite; public void Uninstall() { // TODO: Add TpsViewApp.Uninstall implementation } public bool Install(object sender, object data) { // Save the sender object for later use of the ITpsViewLaunchServices _iTpsSite = sender as ABB.Robotics.Tps.Taf.ITpsViewLaunchServices; // With _iTpsSite handler you can access _iTpsSite.LaunchView and _iTpsSite.CloseView return true; } } } ``` -------------------------------- ### Get ProcessTemplateName Example Source: https://developercenter.robotstudio.com/api/robotstudio/api/ABB.Robotics.RobotStudio.Stations.RsMoveInstruction This example demonstrates how to retrieve and log information about a Move Instruction, including its ProcessDefinitionName, ProcessTemplateName, and Instruction Arguments. It also shows how to access specific arguments like CirPointArg, ToJointPosArg, ToolArg, ToPointArg, ViaPointArg, and WObjArgument, as well as retrieving ProcessTemplate details. ```APIDOC ## Get ProcessTemplateName Example ### Description This example demonstrates how to retrieve and log information about a Move Instruction, including its ProcessDefinitionName, ProcessTemplateName, and Instruction Arguments. It also shows how to access specific arguments like CirPointArg, ToJointPosArg, ToolArg, ToPointArg, ViaPointArg, and WObjArgument, as well as retrieving ProcessTemplate details. ### Method N/A (This is a code example, not a direct API endpoint call) ### Endpoint N/A ### Parameters N/A ### Request Example ```csharp Project.UndoContext.BeginUndoStep("RsMoveInstructionProperties"); try { Station station = Station.ActiveStation; // Create a move instruction in the constructor examples. RsMoveInstruction myMove = (RsMoveInstruction)station.ActiveTask.FindPathProcedureFromModuleScope("myPath", "").Instructions[0]; // Set the color of the move instruction to yellow. myMove.Color = Color.Yellow; // Make the thickness of the move instruction twice as thick. myMove.Thickness = myMove.Thickness * 2; // Output some info regarding the move instruction. Logger.AddMessage(new LogMessage("The Move Instruction has ProcessDefinitionName '" + myMove.ProcessDefinitionName + "'")); Logger.AddMessage(new LogMessage("The Move Instruction has ProcessTemplateName '" + myMove.ProcessTemplateName + "'")); Logger.AddMessage(new LogMessage("The Move Instruction '" + myMove.Name + "' has '" + myMove.InstructionArguments.Count + "' Instruction Arguments")); RsInstructionArgument myCirPointArg = myMove.GetCirPointArgument(); if (myCirPointArg != null) { Logger.AddMessage(new LogMessage("CirPointArg Name: '" + myCirPointArg.Name + "' Value: '" + myCirPointArg.Value + "'")); } RsProcessTemplate myProcTempl = myMove.GetProcessTemplate(); if (myProcTempl != null) { Logger.AddMessage(new LogMessage("ProcessTemplate Name: '" + myProcTempl.Name + "' ActiveMotionType: '" + myProcTempl.ActiveMotionType + "'")); } RsInstructionArgument myToJointPosArg = myMove.GetToJointPosArgument(); if (myToJointPosArg != null) { Logger.AddMessage(new LogMessage("ToJointPosArg Name: '" + myToJointPosArg.Name + "' Value: '" + myToJointPosArg.Value + "'")); } RsInstructionArgument myToolArg = myMove.GetToolArgument(); if (myToolArg != null) { Logger.AddMessage(new LogMessage("ToolArg Name: '" + myToolArg.Name + "' Value: '" + myToolArg.Value + "'")); } RsInstructionArgument myToPointArg = myMove.GetToPointArgument(); if (myToPointArg != null) { Logger.AddMessage(new LogMessage("ToPointArgument Name: '" + myToPointArg.Name + "' Value: '" + myToPointArg.Value + "'")); } RsInstructionArgument myViaPointArg = myMove.GetViaPointArgument(); if (myViaPointArg != null) { Logger.AddMessage(new LogMessage("ViaPointArg Name: '" + myViaPointArg.Name + "' Value: '" + myViaPointArg.Value + "'")); } RsInstructionArgument myWObjArgument = myMove.GetWObjArgument(); if (myWObjArgument != null) { Logger.AddMessage(new LogMessage("WObjArgument Name: '" + myWObjArgument.Name + "' Value: '" + myWObjArgument.Value + "'")); } } catch { Project.UndoContext.CancelUndoStep(CancelUndoStepType.Rollback); throw; } finally { Project.UndoContext.EndUndoStep(); } ``` ### Response N/A (This is a code example, not a direct API endpoint call) #### Success Response (200) N/A #### Response Example N/A ``` -------------------------------- ### Get Coedge Properties Example (C#) Source: https://developercenter.robotstudio.com/api/robotstudio/api/ABB.Robotics.RobotStudio.Stations.Coedge Demonstrates how to create a box, retrieve a coedge from it, and then access and log properties such as the associated body, edge, reversed status, start vertex, and end vertex. This example utilizes UndoContext for transaction management. ```csharp Project.UndoContext.BeginUndoStep("CoedgeProperties"); try { Station station = Station.ActiveStation; // Create a box. Part myPart = new Part(); myPart.Name = "MyPart"; station.GraphicComponents.Add(myPart); Body box = Body.CreateSolidBox( new Matrix4(Vector3.XVector, 0.0), new Vector3(0.1, 0.1, 0.1)); box.Name = "MyBox"; myPart.Bodies.Add(box); // Get a coedge from the box. Coedge myCoedge = box.Shells[0].Faces[0].Loops[0].Coedges[0]; myCoedge.Edge.Name = "MyEdge"; // Output some info of the coedge. Logger.AddMessage(new LogMessage($"The body of the coedge is: {myCoedge.Body.Name}")); Logger.AddMessage(new LogMessage($"The edge of the coedge is: {myCoedge.Edge.Name}")); Logger.AddMessage(new LogMessage($"The coedge is reversed: {myCoedge.Reversed}")); Logger.AddMessage(new LogMessage( $"The start vertex of the coedge is: ({myCoedge.StartVertex.Position.ToString(numDecimals: 8, separator: ", ")})")); Logger.AddMessage(new LogMessage( $"The end vertex of the coedge is: ({myCoedge.EndVertex.Position.ToString(numDecimals: 8, separator: ", ")})")); } catch { Project.UndoContext.CancelUndoStep(CancelUndoStepType.Rollback); throw; } finally { Project.UndoContext.EndUndoStep(); } ``` -------------------------------- ### Get Controller Start Time Source: https://developercenter.robotstudio.com/api/pcsdk/api/ABB.Robotics.Controllers.Controller Gets the system clock time from the last time the controller was started. This can be used for diagnostics. ```csharp public DateTime StartTime { get; } ``` -------------------------------- ### System Operations - Get list of installed systems Source: https://developercenter.robotstudio.com/api/rwsApi/ctrl_system_page Retrieves a list of all installed systems on the Robot controller. ```APIDOC ## GET /rw/system/list ### Description Retrieves a list of all installed systems on the Robot controller. ### Method GET ### Endpoint /rw/system/list ### Response #### Success Response (200) - **systems** (array) - A list of installed system names. #### Response Example ```json { "systems": [ "System1", "System2" ] } ``` ``` -------------------------------- ### Discover Robot Web Services using Bonjour Command Line Tools Source: https://developercenter.robotstudio.com/api/RWS Demonstrates how to discover Robot Web Services instances using the 'dns-sd' command-line tool. It shows commands for browsing services and resolving discovered instances to obtain hostnames or IP addresses. This is useful for custom client development or manual service inspection. ```bash dns-sd -B _http._tcp,rws > Timestamp A/R Flags if Domain Service Type Instance Name > 12:09:48.363 Add 3 11 local. _http._tcp. RobotWebServices_ABB_Testrack > 12:09:48.364 Add 2 11 local. _http._tcp. RobotWebServices_Sys_1035 _Resolve the above RC instance_ dns-sd -L "RobotWebServices_ABB_Testrack" _http._tcp > 12:11:10.857 RobotWebServices_ABB_Testrack._http._tcp.local. can be reached at ABB_Testrack.local.:80 (interface 11) _Resolve the above VC instance_ dns-sd -L "RobotWebServices_Sys_1035" _http._tcp > 12:12:27.451 RobotWebServices_Sys_1035._http._tcp.local. can be reached at IN-L-KBXI011934.local.:80 (interface 11) ``` ```bash # First lookup the name using the following: dns-sd -L "RobotWebServices_Sys_1035" _http._tcp > Lookup RobotWebServices_1035._http._tcp.local 8:23:25.300 RobotWebServices_Sys_1035._http._tcp.local. can be reached at IN-L-KBXI011934.local.:8888 (interface 12) # Then use the looked up name as below: dns-sd –Q IN-L-KBXI011934.local. > Timestamp A/R Flags if Name T C Rdata 15:19:26.307 Add 2 12 IN-L-KBXI011934.local. 1 1 **10.140.188.52** ``` -------------------------------- ### Create Move Instructions using RobotStudio API (C#) Source: https://developercenter.robotstudio.com/api/robotstudio/api/ABB.Robotics.RobotStudio.Stations.RsInstructionCollection Demonstrates creating various move instructions (Linear, Circular, Joint) within a RobotStudio task. It involves setting up WorkObjects, ToolData, RobTargets, and PathProcedures. This example requires the RobotStudio environment and relevant libraries. ```csharp Project.UndoContext.BeginUndoStep("RsMoveInstructionCreate"); try { #region RsMoveInstructionCreateStep1 Station station = Station.ActiveStation; #endregion // First import a robot (a mechanism) and add it to the station. #region RsMoveInstructionCreateStep2 GraphicComponentLibrary mechLib = GraphicComponentLibrary.Load("IRB140_6_81_C_G_03.rslib", true); Mechanism mechGfx = (Mechanism)mechLib.RootComponent.CopyInstance(); mechGfx.Name = "IRB140_6_81_C_G_03"; station.GraphicComponents.Add(mechGfx); #endregion // Set the active task to the mechanism task. #region RsMoveInstructionCreateStep3 station.ActiveTask = mechGfx.Task; #endregion // Create a WorkObject and add it to the ActiveTask. #region RsMoveInstructionCreateStep4 RsWorkObject myWobj = new RsWorkObject(); myWobj.Name = station.ActiveTask.GetValidRapidName("myWobj", "_", 1); station.ActiveTask.DataDeclarations.Add(myWobj); #endregion // Create a ToolData and add it to the ActiveTask. #region RsMoveInstructionCreateStep5 RsToolData myTool = new RsToolData(); myTool.Name = station.ActiveTask.GetValidRapidName("myTool", "_", 1); station.ActiveTask.DataDeclarations.Add(myTool); #endregion // Create a new RobTarget and add it to the ActiveTask. #region RsMoveInstructionCreateStep6 RsRobTarget toPoint = new RsRobTarget(); toPoint.Name = station.ActiveTask.GetValidRapidName("myRobTarget", "_", 1); station.ActiveTask.DataDeclarations.Add(toPoint); #endregion // Create a graphic representation of the RobTarget and RsTarget. #region RsMoveInstructionCreateStep7 RsTarget myRsTarget = new RsTarget(myWobj, toPoint); myRsTarget.Name = toPoint.Name; station.ActiveTask.Targets.Add(myRsTarget); #endregion // Create a PathProcedure. #region RsMoveInstructionCreateStep8 RsPathProcedure myPath = new RsPathProcedure("myPath"); station.ActiveTask.PathProcedures.Add(myPath); #endregion // Create a linear move instruction using the move definition and the default template. #region RsMoveInstructionCreateStep9 RsMoveInstruction myMoveL = new RsMoveInstruction (station.ActiveTask, "Move", "Default", MotionType.Linear, myWobj.Name, toPoint.Name, myTool.Name); myPath.Instructions.Add(myMoveL); #endregion // Create a new RobTarget to use as cirPoint and add it to the ActiveTask. #region RsMoveInstructionCreateStep10 RsRobTarget cirPoint = new RsRobTarget(); cirPoint.Name = station.ActiveTask.GetValidRapidName("myRobTarget", "_", 1); cirPoint.Frame.X = cirPoint.Frame.X + 0.10; cirPoint.Frame.Z = cirPoint.Frame.Z + 0.10; station.ActiveTask.DataDeclarations.Add(cirPoint); #endregion // Create a graphic representation of the RobTarget and RsTarget. #region RsMoveInstructionCreateStep11 RsTarget myRsTarget_2 = new RsTarget(myWobj, cirPoint); myRsTarget_2.Name = cirPoint.Name; station.ActiveTask.Targets.Add(myRsTarget_2); #endregion // Create a circular move instruction. #region RsMoveInstructionCreateStep12 RsMoveInstruction myMoveCirc = new RsMoveInstruction(station.ActiveTask, "Move", "Default", myWobj.Name, cirPoint.Name, toPoint.Name, myTool.Name); myPath.Instructions.Add(myMoveCirc); #endregion // Create a joint target to be able to create a MoveAbsJ move instruction. #region RsMoveInstructionCreateStep13 RsJointTarget myJointTarget = new RsJointTarget(); myJointTarget.Name = station.ActiveTask.GetValidRapidName("myJointTarget", "_", 1); station.ActiveTask.DataDeclarations.Add(myJointTarget); #endregion // Set the robot axis values. #region RsMoveInstructionCreateStep14 RobotAxisValues rbAxis = new RobotAxisValues(); rbAxis.Rax_1 = 70.0000000000001; rbAxis.Rax_2 = -30; rbAxis.Rax_3 = 30; rbAxis.Rax_4 = -55.0000000000001; rbAxis.Rax_5 = 40; rbAxis.Rax_6 = 10; myJointTarget.SetRobotAxes(rbAxis, false); #endregion // Create a MoveAbsJ move instruction (this only makes sense if there is a mechanism in the station). #region RsMoveInstructionCreateStep15 RsMoveInstruction myMoveAbsJ = ``` -------------------------------- ### Get IO Signals Example Response Source: https://developercenter.robotstudio.com/api/rwsApi/ios_signals_get_page An example of the XML response returned by the 'Get IO Signals' endpoint. It lists individual IO signals with their properties such as name, type (e.g., DO, DI), category, current value, and simulation state. ```xml io
``` -------------------------------- ### Get Start Vertex of a Wire (C#) Source: https://developercenter.robotstudio.com/api/robotstudio/api/ABB.Robotics.RobotStudio.Stations.Wire Retrieves the 'Vertex' object that marks the start of the 'Wire'. This is a read-only property. ```csharp public Vertex StartVertex { get; } ``` -------------------------------- ### Example Build Output (Text) Source: https://developercenter.robotstudio.com/api/robotstudio/articles/How-To/SmartComponent/SC_BuildSmartComponent This is an example of the output you might see when compiling a SmartComponent using the LibraryCompiler.exe from a command prompt. It shows the compiler version, the command executed, and the success message indicating the creation of the .rslib file. ```text ABB Robotics LibraryCompiler 24.2.10789.0 Command line: "C:\Program Files (x86)\ABB\RobotStudio 2024\bin\LibraryCompiler.exe" SmartComponent1.xml Compiling C:\Users\JohnDoe\source\Repos\SmartComponent1\SmartComponent1\SmartComponent1.xml Added 'en' resources to SmartComponent1 Created C:\Users\JohnDoe\source\Repos\...\SmartComponent1.rslib ``` -------------------------------- ### Install ITpsViewSetup Interface for Launch Services (C#) Source: https://developercenter.robotstudio.com/api/fpsdk/html/c1a469cc-57dc-44ae-8494-80bcef7c095f This C# code demonstrates how to implement the ITpsViewSetup interface to capture the ITpsViewLaunchServices object. This object is crucial for interacting with the launch service to open and close views. The sender argument, when cast to ITpsViewLaunchServices, provides the necessary methods. ```csharp //declaration private ITpsViewLaunchServices iTpsSite; ...... //Install method of the TpsView class bool ITpsViewSetup.Install(object sender,object data) { if (sender is ITpsViewLaunchServices) { // Save the sender object for later use this.iTpsSite = sender as ITpsViewLaunchServices; return true; } return false; } ``` -------------------------------- ### Get MomentOfInertia Example Source: https://developercenter.robotstudio.com/api/robotstudio/api/ABB.Robotics.RobotStudio.Stations.Body This example demonstrates how to create a part with a solid box body and log its properties, including the moment of inertia. ```APIDOC ## GET /websites/developercenter_robotstudio_api/examples ### Description Retrieves an example demonstrating the creation of a part with a solid box body and logging its properties, including center of gravity, color, moment of inertia, surface area, volume, and transform. ### Method GET ### Endpoint /websites/developercenter_robotstudio_api/examples ### Parameters None ### Request Example None ### Response #### Success Response (200) - **code** (string) - The C# code snippet for the example. #### Response Example ```csharp Project.UndoContext.BeginUndoStep("BodyProperties"); try { Station station = Station.ActiveStation; // Create a part to contain the bodies. Part p = new Part(); p.Name = "My_Part"; station.GraphicComponents.Add(p); // Create a solid box. Matrix4 matrix_origo = new Matrix4(new Vector3(Axis.X), 0.0); Vector3 size = new Vector3(0.5, 0.5, 0.5); Body b1 = Body.CreateSolidBox(matrix_origo, size); b1.Name = "Box"; p.Bodies.Add(b1); // Log a summary of the bodies properties. Logger.AddMessage(new LogMessage($"The body '{b1.Name}' has the following properties:")); Logger.AddMessage(new LogMessage($"Center of gravity: x: {b1.CenterOfGravity.x}, y: {b1.CenterOfGravity.y}, z: {b1.CenterOfGravity.z}")); Logger.AddMessage(new LogMessage($"Color: {b1.Color}")); Logger.AddMessage(new LogMessage($"Moment of Inertia: " + $"x: ({b1.MomentOfInertia.x.x}, {b1.MomentOfInertia.x.y}, {b1.MomentOfInertia.x.z}), " + $"y: ({b1.MomentOfInertia.y.x}, {b1.MomentOfInertia.y.y}, {b1.MomentOfInertia.y.z}), " + $"z: ({b1.MomentOfInertia.z.x}, {b1.MomentOfInertia.z.y}, {b1.MomentOfInertia.z.z})")); Logger.AddMessage(new LogMessage($"Has '{b1.Shells.Count}' number of shells.")); Logger.AddMessage(new LogMessage($"Surface area: {b1.SurfaceArea}")); Logger.AddMessage(new LogMessage($"Transform: " + $"X: {b1.Transform.X}, Y: {b1.Transform.Y}, Z: {b1.Transform.Z}, " + $"Rx: {b1.Transform.RX}, Ry: {b1.Transform.RY}, Rz: {b1.Transform.RZ}")); Logger.AddMessage(new LogMessage($"Visibility: {b1.Visible}")); Logger.AddMessage(new LogMessage($"Volume: {b1.Volume}")); } catch { Project.UndoContext.CancelUndoStep(CancelUndoStepType.Rollback); throw; } finally { Project.UndoContext.EndUndoStep(); } ``` ``` -------------------------------- ### Hello Controller Example (HTML) Source: https://developercenter.robotstudio.com/api/rwsApi/examples Demonstrates a simple 'Hello Controller' example returning data in HTML format using Robot Web Services. This is useful for basic UI interactions or simple data display. ```html Hello Controller

Hello from Robot Controller!

This is an HTML response from the Robot Web Services.

``` -------------------------------- ### Get Installed Licenses Information - C# Source: https://developercenter.robotstudio.com/api/robotstudio/api/ABB.Robotics.RobotStudio.LicenseValidator Retrieves information about all licenses currently installed on both the client and the server. This method returns a ReadOnlyCollection of LicenseInformation objects. ```csharp ReadOnlyCollection licenses = LicenseValidator.GetInstalledLicenses(); ``` -------------------------------- ### Show RAPID Program Pointer (cURL Example) Source: https://developercenter.robotstudio.com/api/rwsApi/rapid_task_pcp_get_actions_page This cURL command demonstrates how to retrieve the current state of the RAPID program pointer. It requires authentication and targets the 'show' action for the program counter. ```bash curl --digest -u "Default User":robotics "http://localhost/rw/rapid/tasks/T_ROB1/pcp?action=show" ``` -------------------------------- ### Start RAPID Execution (HTTP POST) Source: https://developercenter.robotstudio.com/api/rwsApi/rapid_execution_get_actions_page Initiates RAPID program execution. This POST request allows specifying various execution modes and cycle options. ```HTTP POST http://localhost/rw/rapid/execution?action=start Content-Type: application/x-www-form-urlencoded regain=continue&execmode=continue&cycle=forever&condition=none&stopatbp=disabled&alltaskbytsp=true ``` -------------------------------- ### Get List of Installed Systems (REST API) Source: https://developercenter.robotstudio.com/api/rwsApi/ctrl_systems_page_get Retrieves a list of all installed systems on the robot controller. This operation uses a GET request to the '/ctrl/system' endpoint. The response is an XML document listing each system, typically within a 'ctrl-system-li' element. ```shell curl --digest -u "Default User":robotics "http://localhost/ctrl/system" ``` -------------------------------- ### Initialize RobotStudio Controller and Access Configuration Source: https://developercenter.robotstudio.com/api/pcsdk/api/ABB.Robotics.Controllers.ConfigurationDomain.Instance This code demonstrates how to initialize a connection to a RobotStudio controller and access its configuration database. It requires the ABB.Robotics and ABB.Robotics.Controllers namespaces. ```csharp using ABB.Robotics; using ABB.Robotics.Controllers; using ABB.Robotics.Controllers.ConfigurationDomain; // Create an instance to connect to your controller. Controller _ctrl = new Controller("/10.140.60.29"); ConfigurationDatabase _database = _ctrl.Configuration; Instance objInstance; ``` -------------------------------- ### Get StartIndex Source: https://developercenter.robotstudio.com/api/pcsdk/api/ABB.Robotics.Controllers.RapidDomain.TextRange Returns a static integer representing the start index. This constant is likely used as a base or default starting point in index-based operations. ```csharp public static int StartIndex { get; } ``` -------------------------------- ### Example cURL Request for Showing Execution State Source: https://developercenter.robotstudio.com/api/rwsApi/rapid_execution_get_actions_page A sample cURL command to demonstrate how to authenticate and request the RAPID execution state. ```Shell curl --digest -u "Default User":robotics "http://localhost/rw/rapid/execution?action=show" ``` -------------------------------- ### GET /rw - Get RobotWare Services Source: https://developercenter.robotstudio.com/api/rwsApi/rwservices_system_page Retrieves a list of available RobotWare services. The content of the list depends on which services are installed on the controller. ```APIDOC ## GET /rw ### Description Returns a list of links to RobotWare services. The content of the list depends on which services are installed. ### Method GET ### Endpoint /rw ### Parameters #### Query Parameters - **See Common URL parameters** (N/A) - N/A - Common URL parameters as defined in the API documentation. #### Request Body None ### Request Example ```bash curl --digest -u "Default User":robotics "http://localhost/rw" ``` ### Response #### Success Response (200) - **Links** (array) - Contains links to various RobotWare services like cfg, devices, dipc, etc. #### Response Example ```xml rw
``` ### Error Response HTTP Errors, see HTTP Status codes Robot controller errors, see Robot controller return codes ### Notes Supported in bootserver mode ``` -------------------------------- ### Start RAPID Program Execution (C#) Source: https://developercenter.robotstudio.com/api/pcsdk/articles/Manual/Using-the-PC-SDK/Create-a-simple-PC-SDK-application This C# snippet demonstrates how to start RAPID program execution. It checks if the controller is in automatic mode, requests mastership of Rapid, starts the first RAPID task, and handles potential exceptions like InvalidOperationException if mastership is already held. ```csharp private void button1_Click(object sender, EventArgs e) { try { if (controller.OperatingMode == ControllerOperatingMode.Auto) { tasks = controller.Rapid.GetTasks(); using (Mastership m =Mastership.Request(controller.Rapid)) { //Perform operation tasks[0].Start(); } } else { MessageBox.Show( "Automatic mode is required to start execution from a remote client."); } } catch (System.InvalidOperationException ex) { MessageBox.Show("Mastership is held by another client." + ex.Message); } catch (System.Exception ex) { MessageBox.Show("Unexpected error occurred: " + ex.Message); } } ``` -------------------------------- ### Get RW Service Information Source: https://developercenter.robotstudio.com/api/rwsApi/_hello_controller_html_8html-example This example demonstrates how to retrieve RobotWare service information, including service name, version, and options, using JavaScript and an XMLHttpRequest. ```APIDOC ## GET /rw/system?json=1 ### Description Retrieves detailed information about the RobotWare system, including service name, version, operating system, options, and manipulator details. The response is returned in JSON format. ### Method GET ### Endpoint /rw/system?json=1 ### Parameters #### Query Parameters - **json** (integer) - Optional - Set to 1 to receive the response in JSON format. ### Request Example ```html
``` ### Response #### Success Response (200) - **_embedded** (object) - Contains the system state information. - **_state** (array) - An array containing system state details. - **name** (string) - The name of the service. - **rwversion** (string) - The RobotWare version. - **rwversionname** (string) - The name of the RobotWare version. - **options** (array) - An array of available options. - **option** (string) - The name of the option. #### Response Example ```json { "_embedded": { "_state": [ { "name": "RW6_1014", "rwversion": "6.00.1014.00", "rwversionname": "RobotWare OS and English", "options": [ { "option": "613-1 Collision Detection" }, { "option": "614-1 FTP and NFS client" }, { "option": "616-1 PC Interface" }, { "option": "628-1 Sensor Interface" } ] }, { "manipulators": [ { "name": "ABB standard manipulator" } ] } ] } } ``` ``` -------------------------------- ### Get IO Signal (Guid, string) - C# Source: https://developercenter.robotstudio.com/api/robotstudio/api/ABB.Robotics.RobotStudio.Stations.BuiltInControllerSourceSignals Retrieves a DataRecorderSignal object for an I/O signal using a system GUID and the I/O name. This method is part of the BuiltInControllerSourceSignals class. ```csharp public DataRecorderSignal GetIOSignal(Guid systemId, string ioName) ``` -------------------------------- ### Complete RobotStudio Add-In File Example Source: https://developercenter.robotstudio.com/api/robotstudio/articles/How-To/Add-Ins/Creating-an-Add-In-file Presents a fully constructed .rsaddin file, integrating all necessary elements for identifying, locating, and specifying requirements for a RobotStudio Add-In. ```xml com.mycompany.RobotStudioEmptyAddin1 General RobotStudioEmptyAddin1.dll c:\users\USER_NAME\source\Repos\RobotStudioEmptyAddin1\RobotStudioEmptyAddin1\bin\Debug 24 Station Any ``` -------------------------------- ### Complete Example: Load RAPID Module to Task (C#) Source: https://developercenter.robotstudio.com/api/pcsdk/articles/Samples/Loading-a-RAPID-module A comprehensive C# example demonstrating the entire process of loading a RAPID module to the T_ROB1 task. It includes connecting to the controller, uploading the module, loading it with replacement, and error handling by checking the EventLog. ```csharp public void LoadModuleFromFile() { try { // Step 1: Connect to the controller Guid systemId = new Guid("32943a02-bb32-4422-9cc6-af8fca1edbab"); Controller controller = new Controller(systemId); controller.Logon(UserInfo.DefaultUser); // Clears the eventlogs in the controller controller.EventLog.ClearAll(); // Gets the task with the specified name. Task tRob1 = controller.Rapid.GetTask("T_ROB1"); // Step 2: Upload module from PC string filePath = @"C:\Temp\MyModule.mod"; string controllerFilePath = Path.Combine(controller.GetEnvironmentVariable("HOME"), "MyModule.mod"); controller.FileSystem.PutFile(@"C:\Temp\MyModule.mod", controllerFilePath); bool bLoadSuccess = false; // Step 3: Load Module using (Mastership.Request(controller.Rapid)) { // Loads a RAPID module to the task in the robot controller. bLoadSuccess = tRob1.LoadModuleFromFile(controllerFilePath, RapidLoadMode.Replace); } // True if loading succeeds without any errors, otherwise false. if (!bLoadSuccess) { // Gets the available categories of the EventLog. foreach (EventLogCategory category in controller.EventLog.GetCategories()) { if (category.Name == "Common") { if (category.Messages.Count > 0) { foreach (EventLogMessage message in category.Messages) { Console.WriteLine("Program [{1}:{2}({0})] {3} {4}", message.Name, message.SequenceNumber, message.Timestamp, message.Title, message.Body); } } } } } } catch (Exception ex) { Console.WriteLine("Load Module Error:{0}", ex.Message); } } ``` -------------------------------- ### Get IO Signal ID (Guid, string) - C# Source: https://developercenter.robotstudio.com/api/robotstudio/api/ABB.Robotics.RobotStudio.Stations.BuiltInControllerSourceSignals Retrieves the unique identifier for an I/O signal using a system GUID and the I/O name. This method is part of the BuiltInControllerSourceSignals class. ```csharp public string GetIOSignalId(Guid systemId, string ioName) ``` -------------------------------- ### Get Shared RAPID Data 'nMessageID' - C# Source: https://developercenter.robotstudio.com/api/pcsdk/api/ABB.Robotics.Controllers.RapidDomain.Task Retrieves the 'nMessageID' RAPID data from the 'T_ROB1' task. This example shows how to get a specific piece of shared RAPID data. ```csharp private RapidData GetMessageID() { RapidData rData = null; Task tRob1 = null; try { using (Controller c = new Controller()) { tRob1 = c.Rapid.GetTask("T_ROB1"); if (tRob1 != null) { rData = tRob1.GetRapidData("nMessageID"); } } } catch (GeneralException ee) { // TODO: Add error handling } catch (System.Exception ee) { // TODO: Add error handling } finally { if (tRob1 != null) { tRob1.Dispose(); tRob1 = null; } } return rData; } ``` -------------------------------- ### Complete Example: Creating Multiple Solids in RobotStudio Source: https://developercenter.robotstudio.com/api/robotstudio/articles/How-To/Geometry/CreatePartUsingPrimitives/b9ad2806-04ed-45a9-93ed-485a7dd80e86 This comprehensive example demonstrates the creation of a new station, followed by the programmatic creation of various solid bodies (box, cone, cylinder, pyramid, sphere, torus). Each body is added to a Part object, which is then added to the station. Error handling with undo context is included. ```csharp public void BodyCreateSolids() { NewStation(); Project.UndoContext.BeginUndoStep("BodyCreateSolids"); try { Station station = Station.ActiveStation; // Create a part to contain the bodies. Part p = new Part(); p.Name = "My_Solid_Bodies"; station.GraphicComponents.Add(p); // Create a solid box. Matrix4 matrix_origo = new Matrix4(new Vector3(Axis.X), 0.0); Vector3 size = new Vector3(0.5, 0.5, 0.5); Body b1 = Body.CreateSolidBox(matrix_origo, size); b1.Name = "Box"; p.Bodies.Add(b1); // Create a cone. Body b2 = Body.CreateSolidCone(matrix_origo, 1.0, 1.0); b2.Name = "Cone"; p.Bodies.Add(b2); // Create a cylinder. Body b3 = Body.CreateSolidCylinder(matrix_origo, 0.5, 0.5); b3.Name = "Cylinder"; p.Bodies.Add(b3); // Create a pyramid. Body b4 = Body.CreateSolidPyramid(matrix_origo, 1.0, 1.0, 6); b4.Name = "Pyramid"; p.Bodies.Add(b4); // Create a sphere. Vector3 vector_origo = new Vector3(0.0, 0.0, 0.0); Body b5 = Body.CreateSolidSphere(vector_origo, 0.75); b5.Name = "Sphere"; p.Bodies.Add(b5); // Create a torus. Body b6 = Body.CreateSolidTorus(matrix_origo, 1.0, 0.5); b6.Name = "Torus"; p.Bodies.Add(b6); } catch { Project.UndoContext.CancelUndoStep(CancelUndoStepType.Rollback); throw; } finally { Project.UndoContext.EndUndoStep(); } } ``` -------------------------------- ### Get IO Signal Actions (curl) Source: https://developercenter.robotstudio.com/api/rwsApi/ios_signal_get_actions_page Retrieves a list of actions that can be invoked on an IO signal resource. This example uses curl to make a GET request to the specified URL. ```curl curl --digest -u "Default User":robotics "http://localhost/rw/iosystem/signals/Local/DRV_1/DRV1K1?action=show" ``` -------------------------------- ### Create and Configure Spotlight in RobotStudio Source: https://developercenter.robotstudio.com/api/robotstudio/articles/How-To/Visualization/V_Lightning Illustrates the creation of a spotlight using the CreateSpotLight method, specifying position and direction. It details how to enable shadows, activate the light, and assign a name for UI identification. The spotlight is then added to the station. Requires ABB.Robotics.RobotStudio.Environment and ABB.Robotics.RobotStudio.Stations namespaces. ```csharp Light mySpotlight = Light.CreateSpotLight(new Vector3(0, 0, 1), new Vector3(0, 0.5, -1)); mySpotlight.CastShadows = true; mySpotlight.Enabled = true; mySpotlight.Name = "spotlight"; // RobotStudio UI name station.Lights.Add(mySpotlight); ``` -------------------------------- ### Get Installed Languages (C#) Source: https://developercenter.robotstudio.com/api/fpsdk/html/fff84055-c22e-e56f-78ca-06c6aba5bb1b This method retrieves a list of installed language codes on the FlexPendant controller. The output is a collection of strings, where each string represents a language code (e.g., 'en-US', 'fr'). ```csharp public string[] GetInstalledLanguages() ``` -------------------------------- ### RWPanelSubscriber Example Source: https://developercenter.robotstudio.com/api/rwsApi/_r_w_panel_subscriber_8py-example This example program subscribes to RobotWare Panel resources (Controller State, Speed Ratio, Operation Mode) and displays changes via a WebSocket connection. It demonstrates setting up a WebSocket connection, handling inbound events, and parsing event data. ```APIDOC ## RWPanelSubscriber Example ### Description This Python script subscribes to RobotWare Panel resources such as 'Controller State', 'Speed Ratio', and 'Operation Mode'. It establishes a WebSocket connection to receive real-time event updates and displays them. The script requires Python 3.11.x, pip, and the 'requests' and 'ws4py' libraries. ### Method POST (for subscription) and WebSocket (for events) ### Endpoint - Subscription: `http:///subscription` - WebSocket: `` (obtained after successful subscription) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body (for subscription POST) - **resources** (list) - A list of resource identifiers to subscribe to. - **'1'** (string) - URL for speed ratio resource. - **'1-p'** (string) - Priority for speed ratio resource. - **'2'** (string) - URL for controller state resource. - **'2-p'** (string) - Priority for controller state resource. - **'3'** (string) - URL for operation mode resource. - **'3-p'** (string) - Priority for operation mode resource. ### Request Example (Subscription POST) ```json { "resources": ["1", "2", "3"], "1": "/rw/panel/speedratio", "1-p": "1", "2": "/rw/panel/ctrlstate", "2-p": "1", "3": "/rw/panel/opmode", "3-p": "1" } ``` ### Response #### Success Response (Subscription POST - 201 Created) - **Location** (string) - The URL for the WebSocket connection. - **Cookie** (string) - Session cookies required for the WebSocket connection. #### Response Example (Subscription POST) ``` Initial Events : Controller State : motoron Operation Mode : MANR Speed Ratio : 25 ``` #### WebSocket Event Data - The WebSocket receives event data in XML format. The script parses this XML to extract and display specific values. #### Response Example (WebSocket Event) ``` Events : Speed Ratio : 50 ``` ### Error Handling - The script prints error messages if the subscription request fails (e.g., `Error subscribing `). - WebSocket connection errors are handled by the `ws4py` library. ```