Creates a new ScriptBuilder
Optional
script: stringIf a script is specified, the new ScriptBuilder will be preloaded with that script
Optional
initialIndent: numberIf an indent is specified, the ScriptBuilder will be initialized with that indent
Private
currentPrivate
decreaseDecrease the indent.
Private
increaseIncrease the indent.
Private
scriptReadonly
typeStatic
Readonly
SINGLE_Static
Readonly
SINGLE_Add a frame with the name 'name' initialized at the specified pose expressed in the refFrame coordinate frame. This command only adds a frame to the world, it does not attach it to the ref_frame coordinate frame. Use attach_frame() to attach the newly added frame to ref_frame if desired.
name of the frame to be added. The name must not be the same as any existing world model object (frame, axis, or axis group), otherwise an exception is thrown
initial pose of the new object
Optional
refFrame: stringname of the world model object whose coordinate frame the pose is expressed in. If nothing is provided here, the default is the robot "base" frame.
Add raw script code. As this method takes raw script code that may not be indented and appends it without indenting it, it may violate the overall indentation.
this object.
The script to be appended
Add a block of statements to the builder.
this object.
A block of statements as a String.
Append the content of another script builder to this script builder
Add a statement that assigns an expression to a variable.
this object.
The name of the variable.
The expression to be assigned to the variable.
Attaches the child frame to the parent world model object. The relative transform between the parent and child will be set such that the child does not move in the world when the attachment occurs. The child cannot be "world", "tcp", or the same as parent. This will fail if child or parent is not an existing frame, or this makes the attachments form a closed chain.
name of the frame to be attached. The name must not be "world" or "tcp".
name of the object that the child frame will be attached to.
Add a while statement with a given expression. This is unbalanced, it has to be balanced by a call to #end() at the appropriate time.
this object.
The string representation of an expression.
Add a while not statement with a given expression. This is unbalanced, it has to be balanced by a call to #end() at the appropriate time.
this object.
The string representation of an expression.
Add a while statement that loops forever. This is unbalanced, it has to be balanced by a call to #end() at the appropriate time.
this object.
Insert a break statement.
this object.
Add a comment in the script.
this object.
The comment text.
Add a function definition with the given name and parameters. This is unbalanced, it has to be balanced by a call to #end() at the appropriate time.
this object.
The name of the function.
Rest
...params: string[]The parameters of the function.
Add a thread definition with given the threadName. This is unbalanced, it has to be balanced by a call to #end() at the appropriate time.
this object.
The threadName of the thread.
Delete the frame named frame from the world model. The "world", "base", and "tcp" frames cannot be deleted. Any frames that are attached to the deleted frame will be attached to the "world" frame with new frame offsets set such that the detached frame does not move in the world. This command will fail if the frame does not exist.
name of the frame to be deleted
Add an else statement. This is unbalanced, it has to be balanced by a call to #end() at the appropriate time.
this object.
Add an else if statement with a given expression. This is unbalanced, it has to be balanced by a call to #elseIfCondition(String) or #elseIfCondition(Script) or #else() or #end() at the appropriate time.
this object.
The expression that the else if statement branches on.
Add the end keyword that balances/terminates the declaration of functions, branch and loop statements.
this object.
End a block, without an end statement Used by if and elseif
this object.
Add a statement that declares a global variable and assigns it an initial value.
this object.
The name of the global variable.
An expression which is the initial value of the global variable.
Add a halt statement.
this object.
Add an if statement with a given expression. This is unbalanced, it has to be balanced by a call to #elseIfCondition(String) or #else() or #end() at the appropriate time.
this object.
The expression that the if statement branches on.
Add a statement that increments a variable with the given name.
this object.
The name of the variable.
Add a statement to kill a thread.
this object.
The thread threadHandle.
Add a statement that declares a local variable and assigns it an initial value.
this object.
The name of the local variable.
An expression which is the initial value of the local variable.
Changes the placement of the coordinate frame named name to the new placement given by pose that is defined in the refFrame coordinate frame. This will fail if name is “world”, "tcp", or if the frame does not exist. Note: to move the "tcp" frame, use the set_tcp() command instead. If being used with the part positioner product, the ref_name argument can be the name of an external axis or axis group.
the name of the frame to move
the new placement
Optional
refFrame: stringthe coordinate frame that pose is expressed in. The default value is the robot's "base" frame.
Add a call to the function that will Move to position (linear in joint-space).
this object.
joint positions (q can also be specified as a pose, then inverse kinematics is used to calculate the corresponding joint positions) as a string or number array.
Optional
acc: string | numberjoint acceleration of leading axis in rad/s2 as a string or number.
Optional
speed: string | numberjoint speed of leading axis in rad/s as a string or number (optional).
Optional
time: string | numbertime in seconds as a string or number (optional).
Optional
blendRadius: string | numberblend radius in m as a string or number (optional).
Add a call to the function that will Move to position (linear in tool-space).
this object.
target pose (pose can also be specified as joint positions, then forward kinematics is used to calculate the corresponding pose) as a string.
tool acceleration m/s2 as a string or number.
Optional
speed: string | numbertool speed in m/s as a string or number (optional).
Optional
time: string | numbertime in seconds as a string or number (optional).
Optional
blendRadius: string | numberblend radius in m as a string or number (optional).
Add a popup with the given parameters.
this object.
The popup message.
The popup title.
The popup level.
true if its a blocking popup and false otherwise.
Request a value with the given parameters.
this object.
The variable name to assign the value to
The request message.
The type: integer, float, boolean, or string
Add a return statement.
this object.
Add a statement to run a thread with the given name and assign the thread handle to a variable.
this object.
The variable that gets assigned the thread handle .
The name of the thread to be started.
Set the direction of the acceleration experienced by the robot.
x m/s^2
y m/s^2
z m/s^2
use setTargetPayload
Add a call to the function that sets the mass.
this object.
mass in kilograms as a Script.
use setTargetPayload
Add a call to the function that sets the mass and CoG.
this object.
mass in kilograms as a Script.
CoG x offset in meters
CoG y offset in meters
CoG z offset in meters
Optional
inertia: [number, number, number, number, number, number]The payload inertia matrix in kg*m^2, elements lxx,lyy lzz, lxy, lxz, lyz
Add a call to the function that sets the mass and CoG.
this object.
mass in kilograms as a Script.
CoG x offset in meters
CoG y offset in meters
CoG z offset in meters
Optional
inertia: [number, number, number, number, number, number]The payload inertia matrix in kg*m^2, elements lxx,lyy lzz, lxy, lxz, lyz
Add a call function which specifies the desired TCP
x length
y length
z length
rx angle
ry angle
rz angle
Optional
name: stringName of the TCP
Add a sleep command.
this object.
The amount of time in seconds.
Add a call to the function that will accelerate linearly in joint space and continue with constant joint speed.
this object.
array of joint speeds in rad/s.
joint acceleration in rad/s2 (of leading axis)
time in seconds before the function returns.
Add a call to the function that will accelerate linearly in Cartesian space and continue with constant tool speed.
this object.
array of tool speeds in m/s (spatial vector).
tool position acceleration m/s2.
time in seconds before the function returns.
Optional
refFrameName: stringname of reference frame
Add a stopj command. It decelerates joint speeds to zero.
this object.
The joint acceleration in rad/s2.
Add a stopl command. It decelerates tool speed to zero.
this object.
The tool acceleration in m/s2.
Add a sync command that uses up the remaining "physical" time a thread has in the current frame.
this object.
Static
CreateCreate a ScriptBuilder preloaded with the incognito program definition. This is unbalanced, it has to be balanced by a call to #end() before calling #getScript().
new ScriptBuilder.
Static
CreateCreate a ScriptBuilder preloaded with a secondary program definition. This is unbalanced, it has to be balanced by a call to #end() before calling #getScript().
new ScriptBuilder.
The name of the secondary program.
Static
formatStatic
getStatic
negateGenerated using TypeDoc
ScriptBuilder provides methods to easily generate well indented UR script programmatically. This class manages indentation automatically as the script is built step by step. But,it does not guarantee perfect formatting as there is a possibility to pass badly formatted expressions, statements or scripts.