Difference
Inputs: i1
Outputs: o1
Computes the difference between the values of two consecutive messages. Emits the difference using the newest message time field.
The Difference
operator holds a message buffer of size 2 on i1
. Once the message buffer on i1
gets filled it calculates the difference of the newest message and the oldest message from the buffer and it emits a new message with the calculated difference and the time of the newest message.
Parameters
id: The id of the operator
Usage
- TypeScript
- Python
- C++
- YAML
- Json
import { Program, Difference } from "@rtbot-dev/rtbot";
const id = "id";
const program = new Program();
program.addOperator(new Difference(id));
import rtbot as rb
id = "id";
program = rb.Program()
program.addOperator(rb.Difference(id))
#include "rtbot/Difference.h"
auto id = "id";
auto op = Difference<std::uint64_t, double>(id)
# minimal RtBot program
operators:
- type: Difference
id: "id"
{
"operators": [
{ "type": "Difference", "id": "id" }
]
}