com.ur.urcap.api.domain.script
public interface ScriptWriter
This API adds support for generating URScript code from URCaps.
Modifier and Type | Method and Description |
---|---|
void |
appendLine(String scriptLine) |
void |
appendRaw(String script) |
void |
assign(String variableName,
String expression)
Variable assignment.
|
void |
defineFunction(String name) |
void |
defineThread(String threadName)
Start a thread definition with a given thread name.
|
void |
elseCondition()
Adds an else branch.
|
void |
elseIfCondition(String expression)
Adds an else-if branch.
|
void |
end()
Insert an end.
|
String |
generateScript() |
void |
globalVariable(String variableName,
String expression)
Global variable assignment.
|
void |
ifCondition(String expression)
Start an if-conditional.
|
void |
ifNotCondition(String expression)
Start a negated if-conditional
|
void |
returnMethod()
Return from method.
|
void |
runThread(String threadHandle,
String threadName)
Start a previously defined thread.
|
void |
set_payload(double payloadMass)
Sets the payload mass.
|
void |
set_payload(double payloadMass,
double centerOfGravityX,
double centerOfGravityY,
double centerOfGravityZ)
Sets the mass and center of gravity of the payload.
|
void |
set_tcp(double x,
double y,
double z,
double rx,
double ry,
double rz)
Set the Tool Center Point.
|
void |
sleep(double seconds)
Sleep for a number of seconds
|
void |
sync()
Uses up the remaining ”physical” time a thread has in the current
frame.
|
void |
whileCondition(String expression)
Starts a while-loop with a loop invariant.
|
void |
whileNot(String expression)
Starts a while-loop with a negated loop invariant.
|
void |
whileTrue()
Starts a while true loop.
|
void |
writeChildren()
Use this method when generating code for a node that has children nodes.
|
void appendLine(String scriptLine)
scriptLine
- a single line script command and uses auto-indentation.void appendRaw(String script)
script
- append script as is, without auto-indentation.String generateScript()
void writeChildren()
Use this method when generating code for a node that has children nodes. A simple example:
writer.ifCondition(expression)
writer.writeChildren() // let children nodes generate code.
writer.end()
In most cases you probably only want to call writeChildren() once, but it is possible to call it multiple times and thus have children nodes generate their code multiple times.
void globalVariable(String variableName, String expression)
Global variable assignment.
variableName
- name of global variableexpression
- expression that is assigned to the global variablevoid assign(String variableName, String expression)
Variable assignment. This method can be used to declare local variables.
variableName
- expression
- void sleep(double seconds)
Sleep for a number of seconds
seconds
- amount of time to sleep in secondsvoid sync()
Uses up the remaining ”physical” time a thread has in the current frame.
void defineFunction(String name)
name
- Define a function of name namevoid returnMethod()
Return from method.
void end()
void set_payload(double payloadMass)
Sets the payload mass. This function must be called, when the payload weight or weight distribution changes significantly - I.e when the robot picks up or puts down a heavy workpiece.
payloadMass
- in kilogramsvoid set_payload(double payloadMass, double centerOfGravityX, double centerOfGravityY, double centerOfGravityZ)
Sets the mass and center of gravity of the payload. This function must be called, when the payload weight or weigh distribution changes significantly - I.e when the robot picks up or puts down a heavy workpiece.
payloadMass
- in kilogramscenterOfGravityX
- displacement from the tool-mount in meters.centerOfGravityY
- displacement from the tool-mount in meters.centerOfGravityZ
- displacement from the tool-mount in meters.void set_tcp(double x, double y, double z, double rx, double ry, double rz)
Set the Tool Center Point. Sets the transformation from the output flange coordinate system to the TCP as a pose.
x
- Position party
- Position partz
- Position partrx
- Rotation partry
- Rotation partrz
- Rotation partvoid ifCondition(String expression)
Start an if-conditional.
expression
- the expression of the if-sentence.void ifNotCondition(String expression)
Start a negated if-conditional
expression
- the expression of the negated if-sentencevoid elseIfCondition(String expression)
Adds an else-if branch.
expression
- the expression to "else-if" on.void elseCondition()
Adds an else branch.
void whileTrue()
Starts a while true loop.
void whileCondition(String expression)
Starts a while-loop with a loop invariant.
expression
- the loop invariant.void whileNot(String expression)
Starts a while-loop with a negated loop invariant.
expression
- the loop invariant that will be negatedvoid defineThread(String threadName)
Start a thread definition with a given thread name.
threadName
- the name of the new threadCopyright © 2016. All rights reserved.