Skip to main content

Crate pictorus_blocks

Crate pictorus_blocks 

Source
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§

byte_data

Structs§

AbsBlock
Computes the absolute value of a scalar, vector, or matrix.
AdcBlock
Store data received from the ADC.
AggregateBlock
Block for performing an aggregation operation (i.e. sum, min, max) on input data.
AppTimeBlock
Outputs the elapsed application time as a scalar value.
ArgMinMaxBlock
Gets the index of the minimum or maximum value in the input.
BiasBlock
Outputs the input data with an added bias (offset).
BitShiftBlock
Shifts the bits of the input by a specified number of positions to the left or right.
BitwiseOperatorBlock
Performs a bitwise operation on the input values.
BytesJoinBlock
Joins multiple signals into a single byte slice by serializing each signal and joining them with a delimiter.
BytesLiteralBlock
Output a constant byte slice as a signal.
BytesPackBlock
Packs scalar inputs into a byte buffer according to the provided data spec.
BytesSplitBlock
Splits input bytes based on a specified delimiter and maps outputs to specific indices of the split chunks.
BytesUnpackBlock
Unpacks a byte slice into a specified number of outputs based on the provided data types and byte order.
CanReceiveBlock
Converts CAN data frames into outputs defined by the associated message in a DBC file.
CanTransmitBlock
Converts signals (as defined by the associated DBC message) to a CAN data frame.
ChangeDetectionBlock
Detects whether the input value has changed.
ClampBlock
Clamps an input based on the min and max values provided.
CompareToValueBlock
Compares the input to a scalar value.
ComparisonBlock
Performs an element-wise comparison operation on two inputs.
ComponentInputBlock
Used to signify an input port of a component.
ComponentOutputBlock
Used to signify an output port of a component.
ComponentWise
Calculate the product of all input signals component-wise.
ConstantBlock
Outputs a constant numeric value.
CounterBlock
Increments a counter every time the count input is truthy.
CrossProductBlock
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).
DataReadBlock
Reads data from a data store or variable and outputs it as a signal.
DataWriteBlock
Writes the input data to a data store or variable.
DeadbandBlock
Implements a deadband on the input signal.
DelayBlock
Delays the input signal by N steps.
DelayControlBlock
Debounce or throttle an input signal.
DerivativeBlock
Compute the discrete derivative of a signal using a sliding window of samples.
DeterminantBlock
A block that calculates the determinant of a square matrix.
DotProductBlock
Calculate the dot product of two same-sized vectors.
EquationBlock
Run a user-defined equation that returns a single value.
ExponentBlock
Raises the input to a specified power (coefficient), and optionally preserves the sign of the input.
FrequencyFilterBlock
Perform a frequency filter operation on a signal, either as a low pass or high pass filter.
GainBlock
Multiplies the input by a gain factor.
GpioInputBlock
Stores the data from a GPIO input pin and outputs it as a signal.
GpioOutputBlock
Buffer data to be passed to a GPIO pin.
I2cInputBlock
I2C Input Block buffers data read from an I2C peripheral.
I2cOutputBlock
I2C Output Block buffers data to write to an I2C peripheral.
IirFilterBlock
Block for applying an Infinite Impulse Response (IIR) filter to an input signal.
IntegralBlock
Performs a discrete integration of the input signal.
Inverse
Standard matrix inversion for square matrices.
JsonDumpBlock
Serializes a set of input signals into a JSON blob.
JsonLoadBlock
Deserializes bytes encoded as JSON into the specified output signals.
LogicalBlock
Performs logical operations on inputs.
Lookup1DBlock
Performs a 1D lookup against a set of break points and data points.
Lookup2DBlock
Performs a 2D lookup against two sets of break points and a 2D table of data points.
MatrixInverseBlock
Inverts a matrix using either a standard inverse or a pseudo-inverse based on the method specified.
MatrixMultiply
Calculate the product of all input signals using matrix multiplication.
MinMaxBlock
Calculates the minimum or maximum of the inputs.
NotBlock
A block that performs a logical or bitwise NOT operation on the input.
ParseEnumError
Error raised when parsing an enum from a string fails.
PidBlock
Performs PID (Proportional, Integral, Derivative) control against an error signal.
ProductBlock
Calculates the product of all of its input signals.
PwmBlock
Buffers frequency and duty cycle to a PWM peripheral.
QuantizeBlock
Quantizes the input to the nearest integer multiple of the provided interval.
RampBlock
Outputs a signal that ramps up linearly from a specified start time at a specified rate.
RandomNumberBlock
Generates random numbers from a normal distribution with specified mean and standard deviation.
RateLimitBlock
Emits the input signal, but constraining the rate of change of the signal as specified by the Rising and Falling rates.
RustCodeBlock
Run a basic user-defined Rust function that returns a single value.
SawtoothwaveBlock
Outputs a sawtooth wave signal with specified amplitude, frequency, phase, and bias.
SerialReceiveBlock
Parses incoming serial data by configuring the start / end delimiters and the number of bytes to read.
SerialTransmitBlock
Encodes data for transmission over the serial interface, by prepending the start delimiter and appending the end delimiter to the data.
SinewaveBlock
Outputs a sinewave signal with specified amplitude, frequency, phase, and bias.
SlidingWindowBlock
Concatenates samples into a signle output of length N.
SpiReceiveBlock
Buffers data received from an SPI interface.
SpiTransmitBlock
Stores data to be sent over SPI and outputs it as a signal.
SquarewaveBlock
Outputs a square wave signal with specified amplitude, on duration, off duration, phase, and bias.
StringFormatBlock
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.
SwitchBlock
Switches between multiple input signals based on a condition.
TimerBlock
The Timer block allows timekeeping around discrete events - either by Stopwatch mode or Countdown mode.
TransferFunctionBlock
Implements a transfer function H(z) = Y(z) / X(z) over the input signal.
TransposeBlock
Outputs the transpose of the input signal.
TrianglewaveBlock
Outputs a triangle wave signal with specified amplitude, frequency, phase, and bias.
TrigonometryBlock
UdpReceiveBlock
Buffers data read from a UDP socket.
UdpTransmitBlock
Buffers data to be sent to a UDP port.
VectorIndexBlock
Extracts a set of values from an input matrix based on the linear index, and outputs them in the order of the indices.
VectorMergeBlock
Merges vectors and scalars into a single vector.
VectorNormBlock
Emits a norm (scalar magnitude) of the input vector.
VectorReshapeBlock
Reshapes an input signal to a specified output shape.
VectorSliceBlock
Returns a fixed-size slice of the input matrix starting from the specified row and column.
VectorSortBlock
Sorts all elements of the input signal into a vector output.

Traits§

IsValid
Trait for blocks that can have stale/invalid ouput.
Scalar
A re-export of the pictorus_traits::Scalar trait to allow for easier blanket implementations