mcap_ros2

package
v1.1.10 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 9, 2025 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateDynamic

func GenerateDynamic(schemaName string, schemaText string) (map[string]DecoderFunction, error)

GenerateDynamic converts a ROS2 concatenated message definition into a map of message parsers.

func ReadMessage

func ReadMessage(schemaName string, msgDefs map[string]MessageSpecification, data []byte) (map[string]interface{}, error)

ReadMessage deserializes a ROS2 message from bytes.

Types

type CdrReader

type CdrReader struct {
	// contains filtered or unexported fields
}

CdrReader parses values from CDR data.

func NewCdrReader

func NewCdrReader(data []byte) (*CdrReader, error)

NewCdrReader creates a new CdrReader instance.

func (*CdrReader) Boolean

func (r *CdrReader) Boolean() (bool, error)

Boolean reads an 8-bit value and interprets it as a boolean.

func (*CdrReader) BooleanArray

func (r *CdrReader) BooleanArray(length int) ([]bool, error)

BooleanArray reads an array of booleans.

func (*CdrReader) ByteLength

func (r *CdrReader) ByteLength() int

ByteLength returns the number of bytes in the CDR data.

func (*CdrReader) DecodedBytes

func (r *CdrReader) DecodedBytes() int

DecodedBytes returns the number of bytes that have been decoded.

func (*CdrReader) Float32

func (r *CdrReader) Float32() (JSONFloat32, error)

Float32 reads a 32-bit floating point number.

func (*CdrReader) Float32Array

func (r *CdrReader) Float32Array(length int) ([]JSONFloat32, error)

Float32Array reads an array of float32 values.

func (*CdrReader) Float64

func (r *CdrReader) Float64() (JSONFloat64, error)

Float64 reads a 64-bit floating point number.

func (*CdrReader) Float64Array

func (r *CdrReader) Float64Array(length int) ([]JSONFloat64, error)

Float64Array reads an array of float64 values.

func (*CdrReader) Int16

func (r *CdrReader) Int16() (int16, error)

Int16 reads a signed 16-bit integer.

func (*CdrReader) Int16Array

func (r *CdrReader) Int16Array(length int) ([]int16, error)

Int16Array reads an array of int16 values.

func (*CdrReader) Int32

func (r *CdrReader) Int32() (int32, error)

Int32 reads a signed 32-bit integer.

func (*CdrReader) Int32Array

func (r *CdrReader) Int32Array(length int) ([]int32, error)

Int32Array reads an array of int32 values.

func (*CdrReader) Int64

func (r *CdrReader) Int64() (int64, error)

Int64 reads a signed 64-bit integer.

func (*CdrReader) Int64Array

func (r *CdrReader) Int64Array(length int) ([]int64, error)

Int64Array reads an array of int64 values.

func (*CdrReader) Int8

func (r *CdrReader) Int8() (int8, error)

Int8 reads a signed 8-bit integer.

func (*CdrReader) Int8Array

func (r *CdrReader) Int8Array(length int) ([]int8, error)

Int8Array reads an array of int8 values.

func (*CdrReader) SequenceLength

func (r *CdrReader) SequenceLength() (uint32, error)

SequenceLength reads a 32-bit unsigned integer.

func (*CdrReader) String

func (r *CdrReader) String() (string, error)

String reads a string prefixed with its 32-bit length.

func (*CdrReader) StringArray

func (r *CdrReader) StringArray(length int) ([]string, error)

StringArray reads an array of strings.

func (*CdrReader) StringRaw

func (r *CdrReader) StringRaw(length int) (string, error)

StringRaw reads a string of the given length.

func (*CdrReader) Uint16

func (r *CdrReader) Uint16() (uint16, error)

Uint16 reads an unsigned 16-bit integer.

func (*CdrReader) Uint16Array

func (r *CdrReader) Uint16Array(length int) ([]uint16, error)

Uint16Array reads an array of uint16 values.

func (*CdrReader) Uint32

func (r *CdrReader) Uint32() (uint32, error)

Uint32 reads an unsigned 32-bit integer.

func (*CdrReader) Uint32Array

func (r *CdrReader) Uint32Array(length int) ([]uint32, error)

Uint32Array reads an array of uint32 values.

func (*CdrReader) Uint64

func (r *CdrReader) Uint64() (uint64, error)

Uint64 reads an unsigned 64-bit integer.

func (*CdrReader) Uint64Array

func (r *CdrReader) Uint64Array(length int) ([]uint64, error)

Uint64Array reads an array of uint64 values.

func (*CdrReader) Uint8

func (r *CdrReader) Uint8() (uint8, error)

Uint8 reads an unsigned 8-bit integer.

func (*CdrReader) Uint8Array

func (r *CdrReader) Uint8Array(length int) ([]uint8, error)

Uint8Array reads an array of uint8 values.

type Constant

type Constant struct {
	Type  string
	Name  string
	Value string
}

Constant represents a constant in a ROS2 message.

type DecoderFunction

type DecoderFunction func(data []byte) (map[string]interface{}, error)

DecoderFunction is a function that decodes ROS2 message data.

type Field

type Field struct {
	Type         Type
	Name         string
	DefaultValue interface{}
}

Field represents a field in a ROS2 message.

type JSONFloat32

type JSONFloat32 float32

JSONFloat32 is a float32 that marshals to a string, handling inf and nan. TODO: inf would be represented as +Inf in JSON, and unmarshalling of that will result in a string at the moment, but that should not hurt anything at the moment.

func (JSONFloat32) MarshalJSON

func (j JSONFloat32) MarshalJSON() ([]byte, error)

type JSONFloat64

type JSONFloat64 float64

JSONFloat64 is a float64 that marshals to a string, handling inf and nan. TODO: inf would be represented as +Inf in JSON, and unmarshalling of that will result in a string at the moment, but that should not hurt anything at the moment.

func (JSONFloat64) MarshalJSON

func (j JSONFloat64) MarshalJSON() ([]byte, error)

type MessageSpecification

type MessageSpecification struct {
	PkgName   string
	MsgName   string
	Fields    []Field
	Constants []Constant
}

MessageSpecification represents a ROS2 message definition.

type Type

type Type struct {
	PkgName      string
	Type         string
	IsArray      bool
	ArraySize    *int
	IsUpperBound bool
}

Type represents a ROS2 message field type.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL