Program Generator
Introduction
Vendor-neutral simulation is a new feature in RobotStudio 2026.4 that enables simulation of TCP robots from different manufacturers without tying the simulation’s instruction model to a specific robot programming language. Robot movements, tool and work-object definitions, I/O operations, waits, and procedure calls can be defined in RobotStudio and used as the basis for generating vendor-specific program code.
The ABB.Robotics.RobotStudio.Stations.VendorNeutral namespace provides the SDK framework for this program-generation workflow. It separates the simulation’s programming intent from the syntax required by a particular controller. ProgramGeneratorService converts the procedures in a vendor-neutral RsTask into a common representation of named procedures, instructions, and associated data, then passes that representation to a generator. The generator translates it into a RobotProgram containing one or more program modules, each with a file name, source code, and optional text encoding.
Note
The vendor-neutral instruction and data classes only contain the minimal information required for simulation. The generator implementation must provide the additional information required for a working program (such as I/O mappings, tool load data etc.).
If the RobotStudio station contains at least one vendor-neutral RsTask and at least one program generator is registered, the generate program functionality will be available in the Home tab under Program:

SDK consumers can implement IProgramGenerator directly or derive from ProgramGeneratorBase. The base class provides common functionality for managing global and local declarations, collecting statements, tracking explicitly set program state, and formatting a single program module. Derived implementations supply the target language’s module and procedure structure and translate individual instructions, including any required conversions of units, coordinate representations, and controller-specific conventions.
Note
ProgramGeneratorBase generates a single program module. If the language requires multiple modules, implement IProgramGenerator directly.
Generators can be registered using ProgramGeneratorInfo and RegisterGenerator, making them available through RobotStudio’s program-export workflow. Generation can also be invoked programmatically. This extensibility allows the same vendor-neutral programming model to support different output languages, while leaving each generator responsible for mapping the supported simulation instructions to the capabilities and requirements of its target controller.
The generator can provide a settings user interface through the ShowSettings callback. Settings can be persisted using Options or Attributes.
Example
This example shows how to implement and register an ABB RAPID generator based on ProgramGeneratorBase
#nullable enable
using ABB.Robotics.Math;
using ABB.Robotics.RobotStudio.Stations.VendorNeutral;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
namespace RapidGeneratorAddin;
public class AddinClass
{
// This is the entry point which will be called when the Add-in is loaded
public static void AddinMain()
{
ProgramGeneratorService.RegisterGenerator(
new ProgramGeneratorInfo("ABB RAPID", "Generate ABB RAPID program module", ".mod",
() => new RapidProgramGenerator(), null));
}
}
internal class RapidProgramGenerator : ProgramGeneratorBase
{
#region ProgramGeneratorBase implementation
protected override string FileExtension => ".mod";
protected override string LineTerminator => "\n";
protected override IEnumerable<string> GetModuleStart(string moduleName)
{
yield return "MODULE " + moduleName;
}
protected override IEnumerable<string> GetModuleEnd(string moduleName)
{
yield return "ENDMODULE";
}
protected override IEnumerable<string> GetProcedureHeader(string procedureName)
{
yield return $"PROC {procedureName}()";
}
protected override IEnumerable<string> GetProcedureEnd(string procedureName)
{
yield return "ENDPROC";
}
protected override string GetComment(string text)
{
return "! " + text;
}
protected override void AddInstruction(ProgramInstruction instruction)
{
switch (instruction)
{
case MoveJoints move:
DeclareTool(move.Tool);
DeclareJointTarget(move.Target);
AddStatement($"MoveAbsJ {move.Target.Name},{BuildSpeed(move.Speed)},{BuildZone(move.CornerZone)},{move.Tool.Name};");
break;
case MoveToPoint move:
DeclareTool(move.Tool);
DeclareRobTarget(move.Target, move.ArmConfiguration);
SetProgramState(move.ArmConfiguration == null ? @"ConfJ \Off;" : @"ConfJ \On;", "ConfJ");
AddStatement($"MoveJ {BuildTargetRef(move.Target.Name, move.TcpOffset)},{BuildSpeed(move.Speed)},{BuildZone(move.CornerZone)},{move.Tool.Name}\\WObj:={BuildWorkObject(move.WorkObject)};");
break;
case MoveLinear move:
DeclareTool(move.Tool);
DeclareRobTarget(move.Target);
SetProgramState(@"ConfL \Off;", "ConfL");
AddStatement($"MoveL {BuildTargetRef(move.Target.Name, move.TcpOffset)},{BuildSpeed(move.Speed)},{BuildZone(move.CornerZone)},{move.Tool.Name}\\WObj:={BuildWorkObject(move.WorkObject)};");
break;
case MoveCircular move:
DeclareTool(move.Tool);
DeclareRobTarget(move.CirTarget);
DeclareRobTarget(move.ToTarget);
SetProgramState(@"ConfL \Off;", "ConfL");
AddStatement($"MoveC {move.CirTarget.Name},{move.ToTarget.Name},{BuildSpeed(move.Speed)},{BuildZone(move.CornerZone)},{move.Tool.Name}\\WObj:={BuildWorkObject(move.WorkObject)};");
break;
case WaitTime wait:
AddStatement($"WaitTime {FormatNumber(wait.Time)};");
break;
case SetSignal signal:
AddStatement($"SetDO {signal.Signal},{signal.Value};");
break;
case WaitSignal signal:
string timeout = signal.MaxTime != null ? $"\\MaxTime:={FormatNumber(signal.MaxTime.Value)}" : string.Empty;
AddStatement($"WaitDI {signal.Signal},{signal.Value}{timeout};");
break;
case CallProcedure call:
AddStatement($"{call.ProcedureName};");
break;
default:
throw new NotSupportedException($"Unknown instruction {instruction.GetType()}.");
}
}
#endregion
#region Helper methods
void DeclareTool(ToolData tool)
{
if (tool.Name == "tool0") return;
TryAddDeclaration(tool.Name, $"PERS tooldata {tool.Name} := [TRUE,[{BuildPose(tool.Cartesian)}],[1,[0,0,0.1],[1,0,0,0],0,0,0]];");
}
string BuildWorkObject(WorkObject workObject)
{
string name = workObject.Name;
if (name == "wobj0")
{
// In the vendor-neutral representation wobj0 may be non-identity since it is relative to the robot base frame
if (workObject.Cartesian.AlmostEquals(Matrix4.Identity)) return name;
name = "wobj0_";
}
TryAddDeclaration(workObject.Name, $"PERS wobjdata {name} := [FALSE,TRUE,\"\",[{BuildPose(workObject.Cartesian)}],[[0,0,0],[1,0,0,0]]];");
return name;
}
void DeclareRobTarget(CartesianTarget target, ArmConfiguration? configuration = null)
{
string configStr = configuration != null ? $"{configuration.Cf1},{configuration.Cf4},{configuration.Cf6},0" : "0,0,0,0";
TryAddDeclaration(target.Name, $"CONST robtarget {target.Name} := [{BuildPose(target.Cartesian)},[{configStr}],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];");
}
void DeclareJointTarget(JointTarget target)
{
// Assume 1-6 rotational joints
if (target.JointValues.Length > 6) throw new NotSupportedException("Max six joints supported");
string values = string.Join(",",
Enumerable.Range(0, 6).Select(i => target.JointValues.Length > i ? FormatNumber(target.JointValues[i], 180 / Math.PI) : "0"));
TryAddDeclaration(target.Name, $"CONST jointtarget {target.Name}:=[[{values}],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];");
}
string BuildTargetRef(string targetName, TargetOffset? offset = null)
{
if (offset == null) return targetName;
string function = offset.OffsetRelativeWobj ? "Offs" : "RelTool";
return $"{function}({targetName},{FormatNumber(offset.Offset.x, 1000)},{FormatNumber(offset.Offset.y, 1000)},{FormatNumber(offset.Offset.z, 1000)})";
}
static string BuildPose(Matrix4 frame)
{
var position = frame.Translation;
var orientation = frame.Quaternion;
return $"[{FormatNumber(position.x, 1000)},{FormatNumber(position.y, 1000)},{FormatNumber(position.z, 1000)}]," +
$"[{FormatNumber(orientation.q1)},{FormatNumber(orientation.q2)},{FormatNumber(orientation.q3)},{FormatNumber(orientation.q4)}]";
}
static string BuildSpeed(double speed)
{
return $"v{(int)(speed * 1000)}";
}
static string BuildZone(double cornerZone)
{
return cornerZone == 0 ? "fine" : $"z{(int)(cornerZone * 1000)}";
}
static string FormatNumber(double value, double factor = 1)
{
return (value * factor).ToString("G", CultureInfo.InvariantCulture);
}
#endregion
}