Expand description
This crate contains all of the blocks available in the Pictorus UI.
These blocks are implemented using the traits defined in the pictorus-traits
crate.
§Block Types
There are currently two categories of blocks defined in this crate:
- Core Blocks - These are blocks that are available on all platforms.
- Standard Blocks - These blocks are only available on platforms that support the standard library.
§Implementing Custom Blocks
The blocks in this crate can be helpful as a starting point for implementing a custom block, but are likely to be much more complex than required for a typical use case. The blocks in this crate typically support a wide variety of input/output types, and as such, need to use more complex patterns like macros and recursive traits to cover all possible cases. If you are implementing a custom block for a specific case, you can likely create a much simpler implementation by restricting the input/output types you need to support. We will be adding more examples of simple custom blocks in the future.
Modules§
Structs§
- AbsBlock
- Computes the absolute value of a scalar, vector, or matrix.
- AdcBlock
- Store data received from the ADC.
- Aggregate
Block - Block for performing an aggregation operation (i.e. sum, min, max) on input data.
- AppTime
Block - Outputs the elapsed application time as a scalar value.
- ArgMin
MaxBlock - Gets the index of the minimum or maximum value in the input.
- Bias
Block - Outputs the input data with an added bias (offset).
- BitShift
Block - Shifts the bits of the input by a specified number of positions to the left or right.
- Bitwise
Operator Block - Performs a bitwise operation on the input values.
- Bytes
Join Block - Joins multiple signals into a single byte slice by serializing each signal and joining them with a delimiter.
- Bytes
Literal Block - Output a constant byte slice as a signal.
- Bytes
Pack Block - Packs scalar inputs into a byte buffer according to the provided data spec.
- Bytes
Split Block - Splits input bytes based on a specified delimiter and maps outputs to specific indices of the split chunks.
- Bytes
Unpack Block - Unpacks a byte slice into a specified number of outputs based on the provided data types and byte order.
- CanReceive
Block - Converts CAN data frames into outputs defined by the associated message in a DBC file.
- CanTransmit
Block - Converts signals (as defined by the associated DBC message) to a CAN data frame.
- Change
Detection Block - Detects whether the input value has changed.
- Clamp
Block - Clamps an input based on the min and max values provided.
- Compare
ToValue Block - Compares the input to a scalar value.
- Comparison
Block - Performs an element-wise comparison operation on two inputs.
- Component
Input Block - Used to signify an input port of a component.
- Component
Output Block - Used to signify an output port of a component.
- Component
Wise - Calculate the product of all input signals component-wise.
- Constant
Block - Outputs a constant numeric value.
- Counter
Block - Increments a counter every time the count input is truthy.
- Cross
Product Block - Performs the cross product of two 3D vectors, either 1x3 or 3x1.
- DacBlock
- Buffer data to be sent to a DAC (Digital-to-Analog Converter).
- Data
Read Block - Reads data from a data store or variable and outputs it as a signal.
- Data
Write Block - Writes the input data to a data store or variable.
- Deadband
Block - Implements a deadband on the input signal.
- Delay
Block - Delays the input signal by N steps.
- Delay
Control Block - Debounce or throttle an input signal.
- Derivative
Block - Compute the discrete derivative of a signal using a sliding window of samples.
- Determinant
Block - A block that calculates the determinant of a square matrix.
- DotProduct
Block - Calculate the dot product of two same-sized vectors.
- Equation
Block - Run a user-defined equation that returns a single value.
- Exponent
Block - Raises the input to a specified power (coefficient), and optionally preserves the sign of the input.
- Frequency
Filter Block - Perform a frequency filter operation on a signal, either as a low pass or high pass filter.
- Gain
Block - Multiplies the input by a gain factor.
- Gpio
Input Block - Stores the data from a GPIO input pin and outputs it as a signal.
- Gpio
Output Block - Buffer data to be passed to a GPIO pin.
- I2cInput
Block - I2C Input Block buffers data read from an I2C peripheral.
- I2cOutput
Block - I2C Output Block buffers data to write to an I2C peripheral.
- IirFilter
Block - Block for applying an Infinite Impulse Response (IIR) filter to an input signal.
- Integral
Block - Performs a discrete integration of the input signal.
- Inverse
- Standard matrix inversion for square matrices.
- Json
Dump Block - Serializes a set of input signals into a JSON blob.
- Json
Load Block - Deserializes bytes encoded as JSON into the specified output signals.
- Logical
Block - Performs logical operations on inputs.
- Lookup1D
Block - Performs a 1D lookup against a set of break points and data points.
- Lookup2D
Block - Performs a 2D lookup against two sets of break points and a 2D table of data points.
- Matrix
Inverse Block - Inverts a matrix using either a standard inverse or a pseudo-inverse based on the method specified.
- Matrix
Multiply - Calculate the product of all input signals using matrix multiplication.
- MinMax
Block - Calculates the minimum or maximum of the inputs.
- NotBlock
- A block that performs a logical or bitwise NOT operation on the input.
- Parse
Enum Error - Error raised when parsing an enum from a string fails.
- PidBlock
- Performs PID (Proportional, Integral, Derivative) control against an error signal.
- Product
Block - Calculates the product of all of its input signals.
- PwmBlock
- Buffers frequency and duty cycle to a PWM peripheral.
- Quantize
Block - Quantizes the input to the nearest integer multiple of the provided interval.
- Ramp
Block - Outputs a signal that ramps up linearly from a specified start time at a specified rate.
- Random
Number Block - Generates random numbers from a normal distribution with specified mean and standard deviation.
- Rate
Limit Block - Emits the input signal, but constraining the rate of change of the signal as specified by the Rising and Falling rates.
- Rust
Code Block - Run a basic user-defined Rust function that returns a single value.
- Sawtoothwave
Block - Outputs a sawtooth wave signal with specified amplitude, frequency, phase, and bias.
- Serial
Receive Block - Parses incoming serial data by configuring the start / end delimiters and the number of bytes to read.
- Serial
Transmit Block - Encodes data for transmission over the serial interface, by prepending the start delimiter and appending the end delimiter to the data.
- Sinewave
Block - Outputs a sinewave signal with specified amplitude, frequency, phase, and bias.
- Sliding
Window Block - Concatenates samples into a signle output of length N.
- SpiReceive
Block - Buffers data received from an SPI interface.
- SpiTransmit
Block - Stores data to be sent over SPI and outputs it as a signal.
- Squarewave
Block - Outputs a square wave signal with specified amplitude, on duration, off duration, phase, and bias.
- String
Format Block - Formats a string, interpolating input values into it.
- SumBlock
- Sums (adds or subtracts) all inputs together.
- Svd
- Singular Value Decomposition (SVD) for pseudo-inverse of matrices.
- Switch
Block - Switches between multiple input signals based on a condition.
- Timer
Block - The Timer block allows timekeeping around discrete events - either by Stopwatch mode or Countdown mode.
- Transfer
Function Block - Implements a transfer function
H(z) = Y(z) / X(z)over the input signal. - Transpose
Block - Outputs the transpose of the input signal.
- Trianglewave
Block - Outputs a triangle wave signal with specified amplitude, frequency, phase, and bias.
- Trigonometry
Block - UdpReceive
Block - Buffers data read from a UDP socket.
- UdpTransmit
Block - Buffers data to be sent to a UDP port.
- Vector
Index Block - Extracts a set of values from an input matrix based on the linear index, and outputs them in the order of the indices.
- Vector
Merge Block - Merges vectors and scalars into a single vector.
- Vector
Norm Block - Emits a norm (scalar magnitude) of the input vector.
- Vector
Reshape Block - Reshapes an input signal to a specified output shape.
- Vector
Slice Block - Returns a fixed-size slice of the input matrix starting from the specified row and column.
- Vector
Sort Block - Sorts all elements of the input signal into a vector output.