Documentation ¶
Overview ¶
rosbag implements Rosbag Format Version 2.0, http://wiki.ros.org/Bags/Format/2.0. Currently, this package only implements the decoder.
Index ¶
- type Compression
- type ConnectionHeader
- type Decoder
- type MessageDefinition
- type MessageFieldDefinition
- type MessageFieldType
- type Op
- type Record
- type RecordBagHeader
- type RecordBase
- type RecordChunk
- type RecordChunkInfo
- func (record *RecordChunkInfo) ChunkPos() (uint64, error)
- func (record *RecordChunkInfo) Count() (uint32, error)
- func (record *RecordChunkInfo) EndTime() (time.Time, error)
- func (record *RecordChunkInfo) StartTime() (time.Time, error)
- func (record *RecordChunkInfo) String() (string, error)
- func (record *RecordChunkInfo) Ver() (uint32, error)
- type RecordConnection
- type RecordIndexData
- type RecordMessageData
- func (record *RecordMessageData) Conn() (uint32, error)
- func (record *RecordMessageData) ConnectionHeader() *ConnectionHeader
- func (record *RecordMessageData) String() (string, error)
- func (record *RecordMessageData) Time() (time.Time, error)
- func (record *RecordMessageData) ViewAs(v interface{}) error
- type Rosbag
- type Version
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Compression ¶
type Compression string
const ( CompressionNone Compression = "none" CompressionBZ2 Compression = "bz2" CompressionLZ4 Compression = "lz4" )
type ConnectionHeader ¶
type ConnectionHeader struct { Topic string Type string MD5Sum string MessageDefinition MessageDefinition }
type MessageDefinition ¶
type MessageDefinition struct { Type string Fields []*MessageFieldDefinition }
MessageDefinition is defined here, http://wiki.ros.org/msg
type MessageFieldDefinition ¶
type MessageFieldDefinition struct { Type MessageFieldType Name string IsArray bool // ArraySize is only used when the field is a fixed-size array. If it's a slice, ArraySize is -1 ArraySize int // Value is an optional field. It's only being used for constants Value interface{} // MsgType is only being used when type is complex. This defines the custom // message type. MsgType *MessageDefinition }
type MessageFieldType ¶
type MessageFieldType uint8
const ( MessageFieldTypeBool MessageFieldType = iota + 1 MessageFieldTypeInt8 MessageFieldTypeUint8 MessageFieldTypeInt16 MessageFieldTypeUint16 MessageFieldTypeInt32 MessageFieldTypeUint32 MessageFieldTypeInt64 MessageFieldTypeUint64 MessageFieldTypeFloat32 MessageFieldTypeFloat64 MessageFieldTypeString MessageFieldTypeTime MessageFieldTypeDuration MessageFieldTypeComplex )
type Record ¶
type Record interface { // Op parses the header, and lookup for the op field Op() (Op, error) // Header returns raw header byte slice. It contains metadata for the record Header() []byte // Data returns raw data byte slice. It contains record specific data Data() []byte // Close closes the underlying memory allocation for this record so that // the allocated memory can be reused Close() // prints contents String() (string, error) }
type RecordBagHeader ¶
type RecordBagHeader struct {
*RecordBase
}
RecordBagHeader occurs once in the file as the first record.
func (*RecordBagHeader) ChunkCount ¶
func (record *RecordBagHeader) ChunkCount() (uint32, error)
ChunkCount parses Header to get a number of chunk records in the file
func (*RecordBagHeader) ConnCount ¶
func (record *RecordBagHeader) ConnCount() (uint32, error)
ConnCount parses Header to get a number of unique connections in the file
func (*RecordBagHeader) IndexPos ¶
func (record *RecordBagHeader) IndexPos() (uint64, error)
IndexPos parses Header to get an offset of first record after the chunk section
func (*RecordBagHeader) String ¶
func (record *RecordBagHeader) String() (string, error)
type RecordBase ¶
type RecordBase struct { // Raw contains: <header_len><header><data_len><data> Raw []byte // HeaderLen contains length in bytes of the header HeaderLen uint32 // DataLen contains length in bytes of the data DataLen uint32 // contains filtered or unexported fields }
func (*RecordBase) Close ¶
func (record *RecordBase) Close()
func (*RecordBase) Data ¶
func (record *RecordBase) Data() []byte
func (*RecordBase) Header ¶
func (record *RecordBase) Header() []byte
func (*RecordBase) Op ¶
func (record *RecordBase) Op() (Op, error)
type RecordChunk ¶
type RecordChunk struct {
*RecordBase
}
RecordChunk is a record that contains one or more RecordConnection and/or RecordMessageData.
func (*RecordChunk) Compression ¶
func (record *RecordChunk) Compression() (Compression, error)
Compression parses Header to get the compression algorithm that's used for the underlying chunk data. The supported compression values are "none", "lz4", and "bz2".
func (*RecordChunk) Size ¶
func (record *RecordChunk) Size() (uint32, error)
Size parses Header to get the size in bytes of the uncompressed chunk
func (*RecordChunk) String ¶
func (record *RecordChunk) String() (string, error)
type RecordChunkInfo ¶
type RecordChunkInfo struct {
*RecordBase
}
RecordChunkInfo contains metadata about Chunks
func (*RecordChunkInfo) ChunkPos ¶
func (record *RecordChunkInfo) ChunkPos() (uint64, error)
ChunkPos parses Header to get the offset of the chunk record
func (*RecordChunkInfo) Count ¶
func (record *RecordChunkInfo) Count() (uint32, error)
Count parses Header to get the number of connections in the chunk
func (*RecordChunkInfo) EndTime ¶
func (record *RecordChunkInfo) EndTime() (time.Time, error)
EndTime parses Header to get the timestamp of latest message in the chunk
func (*RecordChunkInfo) StartTime ¶
func (record *RecordChunkInfo) StartTime() (time.Time, error)
StartTime parses Header to get the timestamp of earliest message in the chunk
func (*RecordChunkInfo) String ¶
func (record *RecordChunkInfo) String() (string, error)
func (*RecordChunkInfo) Ver ¶
func (record *RecordChunkInfo) Ver() (uint32, error)
Ver parses Header to get the version of this ChunkInfo record
type RecordConnection ¶
type RecordConnection struct {
*RecordBase
}
RecordConnection is a record that contains metadata about message data. Some of the metadata are used to encode/decode message data.
func (*RecordConnection) Conn ¶
func (record *RecordConnection) Conn() (uint32, error)
Conn parses Header to get the unique connection ID within a bag
func (*RecordConnection) ConnectionHeader ¶
func (record *RecordConnection) ConnectionHeader() (*ConnectionHeader, error)
ConnectionHeader reads the underlying data and decode it to ConnectionHeader
func (*RecordConnection) String ¶
func (record *RecordConnection) String() (string, error)
func (*RecordConnection) Topic ¶
func (record *RecordConnection) Topic() (string, error)
Topic parses Header to get the topic
type RecordIndexData ¶
type RecordIndexData struct {
*RecordBase
}
func (*RecordIndexData) Conn ¶
func (record *RecordIndexData) Conn() (uint32, error)
Conn parses Header to get the unique connection ID within a bag
func (*RecordIndexData) Count ¶
func (record *RecordIndexData) Count() (uint32, error)
Count parses Header to get the number of messages on conn in the preceding chunk
func (*RecordIndexData) String ¶
func (record *RecordIndexData) String() (string, error)
func (*RecordIndexData) Ver ¶
func (record *RecordIndexData) Ver() (uint32, error)
Ver parses Header to get the version of this Index record
type RecordMessageData ¶
type RecordMessageData struct { *RecordBase // contains filtered or unexported fields }
RecordMessageData contains the serialized message data in the ROS serialization format.
func (*RecordMessageData) Conn ¶
func (record *RecordMessageData) Conn() (uint32, error)
Conn parses Header to get the unique connection ID within a bag
func (*RecordMessageData) ConnectionHeader ¶
func (record *RecordMessageData) ConnectionHeader() *ConnectionHeader
ConnectionHeader returns the parsed ROS connection header.
func (*RecordMessageData) String ¶
func (record *RecordMessageData) String() (string, error)
func (*RecordMessageData) Time ¶
func (record *RecordMessageData) Time() (time.Time, error)
Time parses Header to get the timestamp when this message was recorded. Note that this timestamp is different from the message header timestamp from ROS. The main difference is that this timestamp is the retrieved time NOT sent time.
func (*RecordMessageData) ViewAs ¶
func (record *RecordMessageData) ViewAs(v interface{}) error
ViewAs views the underlying raw data in the given v format. When possible, View will convert raw data without making a copy. With no copy, decoding large arrays become really fast! But, this also means that any data types that are reference based can't be used after this Record is closed.
So, if the data is absolutely needed after reading this record, you MUST NOT CLOSE this record so that the underlying raw data is not overwritten by other records.