Main Content

readMessages

Read messages from Ibeo Data Container (IDC) file selection

Since R2021a

Description

msgs = readMessages(msgReader) reads all messages available in the ibeoMessageReader object, msgReader. If the input MessageType property of msgReader is 'object', this syntax returns online object messages.

example

msgs = readMessages(msgReader,timeRange) reads messages that are within the specified time range, timeRange.

[___] = readMessages(___,'DeviceID',deviceID) reads messages that correspond to the specified device, deviceID, in addition to any combination of input arguments from previous syntaxes.

msgs = readMessages(msgReader,indices) reads messages at the specified linear indices, indices.

msgs = readMessages(msgReader,timestamps) reads the messages with the specified timestamps, timestamps.

[msgs,metadata] = readMessages(___) returns the metadata associated with the selected messages. If MessageType property of msgReader is 'object', then this syntax does not apply.

[rawMsgs,procMsgs] = readMessages(___) returns online object detection messages, rawMsgs, and postprocessed object detection messages, procMsgs, in the selection. To use this syntax, MessageType property of msgReader must be 'object'.

[rawMsgs,procMsgs,rawMetadata,procMetadata] = readMessages(___) returns the metadata associated with rawMsgs and procMsgs. To use this syntax, the MessageType property of msgReader must be 'object'.

Examples

collapse all

Create an ibeoFileReader object, ibeoReader, to read the message headers from an IDC file. Replace the placeholder argument sample_data.idc with the name of your IDC file as sample_data.idc file is not provided with the toolbox.

ibeoReader = ibeoFileReader('sample_data.idc')
ibeoReader =
 
  ibeoFileReader with properties:
 
       FileName: "C:/Documents/MATLAB/ibeo_data/sample_data.idc"
      StartTime: 15-Mar-2020 11:21:04.999434999
        EndTime: 15-Mar-2020 11:25:35.030095000
       Duration: 00:04:30
    FileSummary: CAN             53    msgs [0x1002]
                 scan            53    msgs [0x2205]
                 object          106   msgs [0x2281]
                 image           53    msgs [0x2403]
                 vehicleState    53    msgs [0x2808]
                 measurementList 53    msgs [0x2821]
                 pointCloudPlane 53    msgs [0x7510]
                 unsupported     53    msgs [0x6120]
                 unsupported     53    msgs [0x6970]

Create two ibeoMessageReader objects, imgReader and objReader, to read all image and object detection messages in the first 2 minutes, respectively, by using the select function with appropriate message type and time range values.

timeRange = [0 minutes(2)];
imgReader = select(ibeoReader,'image',timeRange);
objReader = select(ibeoReader,'object',timeRange);

Read the first 10 images and all object detection messages in the first 2 minutes, by using the readMessages function on the respective ibeoMessageReader objects with appropriate indices and timeRange arguments. Reading object detection messages returns both online objects and postprocessed objects along with their metadata.

imgs = readMessages(imgReader,1:10);
[rawObjs,procObjs,rawMetadata,procMetadata] = readMessages(objReader);

Input Arguments

collapse all

Message reader, specified as a ibeoMessageReader object.

Linear indices of the messages to read, specified as a vector of nonnegative integers. The maximum index value that can be specified corresponds to the number of messages in the selection, corresponding to the NumMessages property of msgReader.

Timestamps of messages to read, specified as an M-by-1 datetime or duration vector. This table lists the range of valid timestamp values based on data type:

timestamps Data TypeMinimum ValueMaximum Value
datetime vectorStartTime property of msgReaderEndTime property of msgReader
duration vector0Duration property of msgReader

Time range of messages to read, specified as duration or datetime vector of the form [startTime endTime]. If timeRange is a duration vector, the values of startTime and endTime are relative to the start time specified by the StartTime property of msgReader.

Device IDs of messages to read, specified as a scalar or vector of nonnegative integers. deviceID cannot be used along with indices or timestamps as the second argument. By default, its value is the same as the DeviceID property of the msgReader.

Output Arguments

collapse all

Messages read from the IDC file, returned as an array of structures, pointCloud array or cell array. The datatype is determined by the MessageType property of the msgReader. For more information, see Data Structure of Ibeo Messages and Metadata.

Metadata of the messages, returned as an array of structures. The fields of each structure are determined by the MessageType property of msgReader. For more information, see Data Structure of Ibeo Messages and Metadata.

Online object detection messages, returned as a cell array of array of structures. To return this argument, the MessageType property of msgReader must be 'object'. For more information, see Data Structure of Ibeo Messages and Metadata.

Postprocessed object detection messages, returned as a cell array of array of structures. To return this argument, the MessageType property of msgReader must be 'object'. For more information, see Data Structure of Ibeo Messages and Metadata.

Metadata of the online object detection messages, returned as an array of structures. To return this argument, the MessageType property of the msgReader must be 'object'. For more information, see Data Structure of Ibeo Messages and Metadata.

Metadata of the postprocessed object detection messages, returned as an array of structures. To return this argument, the MessageType property of the msgReader must be 'object'. For more information, see Data Structure of Ibeo Messages and Metadata.

More About

collapse all

Tips

When working with large numbers of messages, this has high time and system memory requirements. Consider reading smaller batches of messages, or using the readNextMessage object function to read messages one by one.

Version History

Introduced in R2021a