Codec Reference#
This page summarizes the built-in field codecs. For constructor signatures and implementation details, see Python API.
Numeric Codecs#
integer/varintEncodes an integer bounded by
min_valueandmax_valueusing the number of bits required for that range. Values outside the configured range are clipped.fixedintEncodes an integer with an explicit
num_bitswidth. Setsignedto encode signed values.uint8,uint16,uint32,uint64Fixed-width unsigned integer aliases.
int8,int16,int32,int64Fixed-width signed integer aliases.
egintEncodes an integer with exponential-Golomb coding. This is useful when smaller values are much more common than large values.
Floating-Point Codecs#
floatQuantizes a floating-point value between
min_valueandmax_valuewith the configured decimalprecision. Encoded values are lossy and decode to the represented decimal value.linspace_float/linspaceQuantizes a floating-point value into a fixed number of evenly spaced values between
min_valueandmax_value. Configure exactly one ofresolution,num_values, ornum_bits.float32andfloat64Encodes IEEE 754 binary floating-point values with 32 or 64 bits. These are less compact than quantized float codecs but preserve ordinary float semantics.
Boolean, String, and Bytes Codecs#
bool/booleanEncodes a Python boolean as one bit.
string/asciiEncodes an ASCII string with a length prefix and a maximum configured length. Strings longer than
max_lengthare truncated unless the codec is configured to fail on overflow.bytesEncodes bytes with a length prefix and
max_lengthbound.string_enumEncodes one string selected from a configured set of allowed values.
Container Codecs#
dict/dictionaryEncodes a nested Python dictionary using a nested
fieldsmapping.msg/ros_msgEncodes a nested ROS message.
ros_typeidentifies the message class, andfieldscan override or limit the fields encoded from that message.variable_len_arrayEncodes a list with a length prefix.
max_lengthcontrols the largest representable list.element_typeandelement_paramsconfigure the element codec.fixed_len_arrayEncodes a fixed number of elements. The encoded bitstream does not include a length field, so the decoder always reads
lengthelements.optionalEncodes a boolean presence field. When true, the configured
target_fieldsare encoded immediately after the presence bit.
Special-Purpose Codecs#
pad/paddingReserves a fixed number of zero bits. Padding decodes to
None.time/rostimeEncodes ROS time values with configured seconds and nanoseconds ranges.
ccl_latlonandccl_latlon_bcdEncodes latitude and longitude values using compact formats compatible with CCL-style acoustic messages.
lzmaCompresses a byte-oriented payload with LZMA before encoding it with a length bound.
Metadata Codecs#
Metadata aliases such as src, dest, toa, and snr_in are not
ordinary payload codecs. They copy values between decoded messages and packet
metadata. See Codec Aliases for the complete alias table.