AuboStudio SDK 0.6.3

Public 成员函数 | Private 成员函数 | Private 属性 | 友元 | 所有成员列表
arcs::aubo_scope::ScriptWriter类 参考

This interface provides support for generating Script code. 更多...

`#include <script_writer.h>`

## Public 成员函数
| ScriptWriter (ScriptWriter &f)
| ScriptWriter (ScriptWriter &&f)
virtual | ~ScriptWriter ()
void | setLabel (int lineno, const std::string &comment)
void | appendLine (const std::string &script_line)
| Adds a single line of script code using auto-indentation. 更多...
void | appendVectorDouble (const std::vector< double > &value)
void | appendRaw (const std::string &script)
| Adds script code appending the script code as is without using auto-indentation. 更多...
std::string | generateScript ()
| Generate a string with the full script code. 更多...
void | writeChildren ()
void | assign (VariablePtr variable, const std::string &expression, bool sync=false)
void | assign (const std::string &variableName, const ExpressionPtr &expression, bool sync=false)
void | assign (VariablePtr variable, const ExpressionPtr &expression, bool sync=false)
void | incrementVariable (const std::string &variable_name)
| Add 1 to the variable value. 更多...
void | note (const std::string &expression)
| Add a note. 更多...
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 | defineFunction (const std::string &func_name)
void | anonyFunction (const std::string &func_name)
void | setRobotIndex (int robot_index)
void | returnMethod ()
| Return from method. 更多...
void | end ()
| Insert an end. 更多...
void | lineFeed ()
| Insert an empty line. 更多...
void | setPayload (double mass, double x, double y, double z)
void | setTcp (const std::vector< double > &pose)
void | ifCondition (const ExpressionPtr &expression)
| Start an if-conditional. 更多...
void | ifNotCondition (const ExpressionPtr &expression)
| Start a negated if-conditional 更多...
void | elseIfCondition (const ExpressionPtr &expression)
| Adds an else-if branch. 更多...
void | elseCondition ()
| Adds an else branch. 更多...
void | forCondition (int count, int step)
| Starts a for-loop with tow loop invariants. 更多...
void | whileTrue ()
| Starts a while true loop. 更多...
void | whileCondition (const ExpressionPtr &expression)
| Starts a while-loop with a loop invariant. 更多...
void | whileNot (const ExpressionPtr &expression)
| Starts a while-loop with a negated loop invariant. 更多...
void | defineThread (const std::string &thread_name, bool loop_or_not)
| Start a thread definition with a given thread name. 更多...
void | runThread (const std::string &thread_name)
| Start a previously defined thread. 更多...
void | killThread (const std::string &thread_name)
| killThread 更多...
std::string | getResolvedVariable (const std::string &variable_name)
void | increaseIndent ()
void | decreaseIndent ()

## Private 成员函数
| ScriptWriter ()

## Private 属性
void * | d_ { nullptr }

## 友元
class | DataSwitch

## 详细描述

This interface provides support for generating Script code.

在文件 script_writer.h 第 16 行定义.

## 构造及析构函数说明

## ◆ ScriptWriter() [1/3]

arcs::aubo_scope::ScriptWriter::ScriptWriter | ( | ScriptWriter & | f | ) |

## ◆ ScriptWriter() [2/3]

arcs::aubo_scope::ScriptWriter::ScriptWriter | ( | ScriptWriter && | f | ) |

## ◆ ~ScriptWriter()

virtual arcs::aubo_scope::ScriptWriter::~ScriptWriter | ( |  | ) |
| virtual

## ◆ ScriptWriter() [3/3]

arcs::aubo_scope::ScriptWriter::ScriptWriter | ( |  | ) |
| private

## 成员函数说明

## ◆ anonyFunction()

void arcs::aubo_scope::ScriptWriter::anonyFunction | ( | const std::string & | func_name | ) |

## ◆ appendLine()

void arcs::aubo_scope::ScriptWriter::appendLine | ( | const std::string & | script_line | ) |

Adds a single line of script code using auto-indentation.

参数

  script_line | single line of script code to append.

## ◆ appendRaw()

void arcs::aubo_scope::ScriptWriter::appendRaw | ( | const std::string & | script | ) |

Adds script code appending the script code as is without using auto-indentation.

参数

  script | script code to append.

## ◆ appendVectorDouble()

void arcs::aubo_scope::ScriptWriter::appendVectorDouble | ( | const std::vector< double > & | value | ) |

## ◆ assign() [1/3]

void arcs::aubo_scope::ScriptWriter::assign | ( | const std::string & | variableName,
|  | const ExpressionPtr & | expression,
|  | bool | sync = `false`
| ) |  |

Variable assignment. Assigns the variable without a local or global qualifier. See the Script Manual for the scoping rules.

参数

  variableName | name of the variable, not null.
  expression | expression that is assigned to the variable, not null.

## ◆ assign() [2/3]

void arcs::aubo_scope::ScriptWriter::assign | ( | VariablePtr | variable,
|  | const ExpressionPtr & | expression,
|  | bool | sync = `false`
| ) |  |

Variable assignment.

参数

  variable | the variable to assign an expression to, not null.
  expression | expression that is assigned to the variable, not null.

## ◆ assign() [3/3]

void arcs::aubo_scope::ScriptWriter::assign | ( | VariablePtr | variable,
|  | const std::string & | expression,
|  | bool | sync = `false`
| ) |  |

## ◆ decreaseIndent()

void arcs::aubo_scope::ScriptWriter::decreaseIndent | ( |  | ) |

## ◆ defineFunction()

void arcs::aubo_scope::ScriptWriter::defineFunction | ( | const std::string & | func_name | ) |

参数

  name | Define a function of name name.

## ◆ defineThread()

void arcs::aubo_scope::ScriptWriter::defineThread | ( | const std::string & | thread_name,
|  | bool | loop_or_not
| ) |  |

Start a thread definition with a given thread name.

参数

  threadName | the name of the new thread.
  loop_or_not | the new thread loops or not.

## ◆ elseCondition()

void arcs::aubo_scope::ScriptWriter::elseCondition | ( |  | ) |

Adds an else branch.

## ◆ elseIfCondition()

void arcs::aubo_scope::ScriptWriter::elseIfCondition | ( | const ExpressionPtr & | expression | ) |

Adds an else-if branch.

参数

  expression | the expression of the "else-if"-sentence.

## ◆ end()

void arcs::aubo_scope::ScriptWriter::end | ( |  | ) |

Insert an end.

## ◆ forCondition()

void arcs::aubo_scope::ScriptWriter::forCondition | ( | int | count,
|  | int | step
| ) |  |

Starts a for-loop with tow loop invariants.

参数

  count | the loop counts.
  step | the loop step.

## ◆ generateScript()

std::string arcs::aubo_scope::ScriptWriter::generateScript | ( |  | ) |

Generate a string with the full script code.

返回
  the resulting script as a string.

## ◆ getResolvedVariable()

std::string arcs::aubo_scope::ScriptWriter::getResolvedVariable | ( | const std::string & | variable_name | ) |

Returns a registered variable name that can be used in a script.

A variable is registered if it has been stored in a DataModel instance or used for the configuration of a built-in AuboScope program node.

Please note: The name of a variable in the script can be different from the value of Variable#getDisplayName(). You should not use the value of Variable#getDisplayName() in a script.

参数

  variable | a registered Variable. Not `null`.

返回
  variable name that can be used in a script.

异常

  IllegalArgumentException | if the `variable` was not registered in the data model or used for the configuration of a built-in AuboScope program node.
  ClassCastException | if the `variable` was not created by domain/variable/VariableFactory.

## ◆ ifCondition()

void arcs::aubo_scope::ScriptWriter::ifCondition | ( | const ExpressionPtr & | expression | ) |

Start an if-conditional.

参数

  expression | the expression of the if-sentence. Not `null`.

## ◆ ifNotCondition()

void arcs::aubo_scope::ScriptWriter::ifNotCondition | ( | const ExpressionPtr & | expression | ) |

Start a negated if-conditional

参数

  expression | the expression of the negated if-sentence.

## ◆ increaseIndent()

void arcs::aubo_scope::ScriptWriter::increaseIndent | ( |  | ) |

## ◆ incrementVariable()

void arcs::aubo_scope::ScriptWriter::incrementVariable | ( | const std::string & | variable_name | ) |

Add 1 to the variable value.

参数

  variable | the variable to increment. Not `null`.

## ◆ killThread()

void arcs::aubo_scope::ScriptWriter::killThread | ( | const std::string & | thread_name | ) |

killThread

参数

  thread_name |

## ◆ lineFeed()

void arcs::aubo_scope::ScriptWriter::lineFeed | ( |  | ) |

Insert an empty line.

## ◆ note()

void arcs::aubo_scope::ScriptWriter::note | ( | const std::string & | expression | ) |

Add a note.

参数

  expression | the note expression.

## ◆ returnMethod()

void arcs::aubo_scope::ScriptWriter::returnMethod | ( |  | ) |

Return from method.

## ◆ runThread()

void arcs::aubo_scope::ScriptWriter::runThread | ( | const std::string & | thread_name | ) |

Start a previously defined thread.

参数

  threadName | The name of the thread that will be started.

## ◆ setLabel()

void arcs::aubo_scope::ScriptWriter::setLabel | ( | int | lineno,
|  | const std::string & | comment
| ) |  |

## ◆ setPayload()

void arcs::aubo_scope::ScriptWriter::setPayload | ( | double | mass,
|  | double | x,
|  | double | y,
|  | double | z
| ) |  |

Sets the mass and Center of Gravity (CoG) of the payload.

This function must be called, when the payload weight or weigh distribution changes significantly, i.e when the robot arm picks up or puts down a heavy workpiece.

参数

  payloadMass | in kilograms
  centerOfGravityX | displacement from the tool-mount in meters.
  centerOfGravityY | displacement from the tool-mount in meters.
  centerOfGravityZ | displacement from the tool-mount in meters.

## ◆ setRobotIndex()

void arcs::aubo_scope::ScriptWriter::setRobotIndex | ( | int | robot_index | ) |

## ◆ setTcp()

void arcs::aubo_scope::ScriptWriter::setTcp | ( | const std::vector< double > & | pose | ) |

Set the Tool Center Point (TCP).

Sets the transformation from the tool output flange coordinate system to the TCP as a pose.

参数

  x | Position part.
  y | Position part.
  z | Position part.
  rx | Rotation part.
  ry | Rotation part.
  rz | Rotation part.

## ◆ sleep()

void arcs::aubo_scope::ScriptWriter::sleep | ( | double | seconds | ) |

Sleep for a number of seconds.

参数

  seconds | amount of time to sleep in seconds.

## ◆ sync()

void arcs::aubo_scope::ScriptWriter::sync | ( |  | ) |

Uses up the remaining "physical" time a thread has in the current frame.

## ◆ whileCondition()

void arcs::aubo_scope::ScriptWriter::whileCondition | ( | const ExpressionPtr & | expression | ) |

Starts a while-loop with a loop invariant.

参数

  expression | the loop invariant.

## ◆ whileNot()

void arcs::aubo_scope::ScriptWriter::whileNot | ( | const ExpressionPtr & | expression | ) |

Starts a while-loop with a negated loop invariant.

参数

  expression | the loop invariant that will be negated.

## ◆ whileTrue()

void arcs::aubo_scope::ScriptWriter::whileTrue | ( |  | ) |

Starts a while true loop.

## ◆ writeChildren()

void arcs::aubo_scope::ScriptWriter::writeChildren | ( |  | ) |

Use this method when generating script code for a node that has children nodes.globalVariable

A simple example:

    writer.ifCondition(expression)
    writer.writeChildren()          // let children nodes generate code.
    writer.end()

In most cases you prglobalVariableobably only want to call {} once, but it is possible to call it multiple times and thus have children nodes generate their code multiple times.

## 友元及相关函数文档

## ◆ DataSwitch

friend class DataSwitch
| friend

在文件 script_writer.h 第 282 行定义.

## 类成员变量说明

## ◆ d_

void* arcs::aubo_scope::ScriptWriter::d_ { nullptr }
| private

在文件 script_writer.h 第 284 行定义.

该类的文档由以下文件生成:

- include/aubo_caps/domain/script/script_writer.h