Main Content

select

Select subset of messages to read from Ibeo Data Container (IDC) file

Since R2021a

Description

Use select object function to specify a subset of messages to read from the IDC file based on message type, message ID or device ID. The select method returns an ibeoMessageReader object which can be used to read the selected messages, from the IDC file. The supported values for message type and message ID are listed below. A Lidar Toolbox™ license is required to read scan and pointCloudPlane messages.

Message Type Message IDIbeo® Data Type Name
'scan''0x2205' Ibeo FUSION SYSTEM/ECU scan data
'pointCloudPlane''0x7510'Ibeo point cloud plane
'image''0x2403'Ibeo FUSION SYSTEM/ECU image
'object''0x2281'Ibeo FUSION SYSTEM/ECU object data
'vehicleState''0x2808'Ibeo FUSION SYSTEM/ECU vehicle state
'measurementList''0x2821'Ibeo FUSION SYSTEM/ECU measurement list
'CAN''0x1002'Ibeo FUSION SYSTEM/ECU CAN messages

msgReader = select(ibeoReader,msgType) creates an ibeoMessageReader object, msgReader, that can read all messages of type, msgType, present in an ibeoFileReader object, ibeoReader.

example

msgReader = select(ibeoReader,msgID) creates an ibeoMessageReader object, msgReader. that can read all messages with ID, msgID, present in an ibeoFileReader object.

msgReader = select(___,timeRange) specifies a time range within which the ibeoMessageReader object can read messages, in addition to any combination of arguments from previous syntaxes.

msgReader = select(___,'DeviceID',deviceID) specifies a device ID corresponding to which the ibeoMessageReader object can read messages, in addition to any combination of arguments from previous syntaxes.

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);

Create an ibeoFileReader object, ibeoReader, to read the message headers from the 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 an ibeoMessageReader object, imgReader, to read all images in the first 2 minutes, by using the select function with appropriate message type and time range values.

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

Visualize the message data by reading the messages one at a time to a video player object. First, create a vision.VideoPlayer object. Then, use the hasNextMessage function to check whether imgReader contains a message after the current one. If it does, use readNextMessage function to read the images into the workspace.

videoPlayer = vision.VideoPlayer;
while hasNextMessage(imgReader)
    img = readNextMessage(imgReader);
    step(videoPlayer,img);
end
release(videoPlayer);
     

Reset the ibeoMessageReader object, imgReader, to the first message in the selection, using the reset function.

 reset(imgReader);

Input Arguments

collapse all

ibeoFileReader object, corresponding to the IDC file to be read.

Message type to read from the IDC file, specified as string scalar or character vector. Specific msgType values correspond to Ibeo data types, as illustrated in the table.

Message ID of the message type to be read from the IDC file, specified as string scalar or character vector. Specific msgID values correspond to Ibeo data types, as illustrated in the table.

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

Device IDs of messages to read, specified as a scalar or vector of nonnegative integers. For a list of device IDs that you can select, see the DeviceID column of the table stored in FileSummary property of ibeoReader.

Output Arguments

collapse all

Message reader, returned as an ibeoMessageReader object. This object reads selected messages from the IDC file.

Version History

Introduced in R2021a