Variable
Inputs: i1
Outputs: o1
Controls: c1
The Variable
operator is a special operator designed to store stateful computations.
The Variable
has one data input port i1
, one control port c1
and one output port o1
.
Messages received through the data input port are considered definitions for the values
of the variable from the time of the message up to the next different message time.
Messages received through the control port c1
will trigger the emission of the value
of the variable, according with the time present in the control message, through o1
.
Parameters
id: The id of the operator
value: The default value of the variable
Usage
- TypeScript
- Python
- C++
- YAML
- Json
import { Program, Variable } from "@rtbot-dev/rtbot";
const id = "id";
const value = 1.618;
const program = new Program();
program.addOperator(new Variable(id, value));
import rtbot as rb
id = "id";
value = 1.618;
program = rb.Program()
program.addOperator(rb.Variable(id, value))
#include "rtbot/Variable.h"
auto id = "id";
auto value = 1.618;
auto op = Variable<std::uint64_t, double>(id, value)
# minimal RtBot program
operators:
- type: Variable
id: "id"
value: 1.618
{
"operators": [
{ "type": "Variable", "id": "id", "value": 1.618 }
]
}