Main Content

flush

Flush the buffer created on the host computer to store Radar data for mmWaveRadar object

Since R2023b

Description

flush(rdr) clears the internal buffers created on the host computer to store Radar data for mmWaveRadar object. The internal buffers are used for following purposes:

  • To store partial data till the whole packet is received at the host.

  • To store unread data if you are using ‘ReadMode’ set to oldest. If the mmWaveRadar object is constructed with property ReadMode set as oldest, then the mmWaveRadar object stores the radar data available on the serial line till it is read by the user using the step method of mmWaveRadar object.

Calling flush() clears the stored data in the internal buffers.

Examples

Clear Buffers to Store Data for mmWaveRadar Object

Create TI mmWave Radar object with ‘ReadMode’ set as oldest.

r = mmWaveRadar('TI IWR6843ISK',ReadMode = 'oldest')

Read data from radar by calling the mmWaveRadar object. The output contains radar measurements along with timestamp corresponding to the measurements.

The first timestamp (tim1) output will be 0 indicating start of radar data streaming.

[dets,tim1] = rdr() 

dets = 
 

  1×4 cell array 

 
    {1×1 objectDetection}    {1×1 objectDetection}    {1×1 objectDetection}    {1×1 objectDetection} 

Tim1 = 

     0 

Wait for 10s and call the mmWaveRadar object again; timestamp output (tim2) for step will be 0.1 (Previous time stamp + 1/rdr.UpdateRate).

pause(10) 

[dets,tim2] = rdr() 
% Display tim2 

tim2 = 


    0.1000 

 

Subsequent call to the object will also return timestamp in the same pattern, that is, Previous time stamp + 1/rdr.UpdateRate. This is because when the Property ‘ReadMode’ of mmWaveRadar is 'oldest', mmWaveRadar object uses internal buffers to store data. When you call the object to read data from the sensor, the first accumulated data appears in output and it is removed from the buffer.

[dets,tim3] = rdr(); 
% Display tim3
tim3 

tim3 = 

    0.2000 

Flush the internal buffers using flush function. Call the mmWaveRadar object and notice the timestamp (tim4).

flush(rdr) 
[dets,tim4] = r();
% Display tim4
tim4 

tim4 = 

   33.9000 

You can notice the difference in timestamp output compared to previous calls to the mmWaveRadar object (a jump in timestamp). The jump in the value depends on how much time you waited before calling the function flush and the number of data points read before that point. The change in timestamp is because the data received between the tim3 and tim4 was flushed out by invoking flush method, and corresponding timestamp appears as the output.

Input Arguments

collapse all

The mmWaveRadar sensor object with the default or specified properties.

Version History

Introduced in R2023b

See Also