(!) Please ask about problems and questions regarding this tutorial on answers.ros.org. Don't forget to include in your question the link to this page, the versions of your OS & ROS, and also add appropriate tags.

Fifo

Description: A simple first in, first out class.

Keywords: ecl containers fifo

Tutorial Level: BEGINNER

During the construction of fifo, typically length of buffer may be important.

   1 FiFo<double> fifo(4);               // reserved only (not filled)
   2 fifo.push_back( data_incoming );

An initialised buffer can be important in variaous situation. For example, if you wish to calculate a moving average, you should wait for N (length of buffer) pieces of incoming of data. However, if you initialise the whole buffer as above, you can proceed immediately.

   1 FiFo<double> fifo_initialised(4, initial_value); // reserved and filled
   2 fifo.push_back( next_data );                // set next data
   3 // ...                                                              
   4 // calculate the average here
   5 

Wiki: ecl_containers/Tutorials/Fifo (last edited 2012-01-18 14:33:27 by DanielStonier)