GT RoboCup SSL
Soccer software, robot firmware
Logger Class Reference

The Logger stores and saves the state of the game at each point in time. More...

Public Member Functions

 Logger (size_t logSize=10000)
 
bool open (QString filename)
 
void close ()
 
size_t capacity () const
 
size_t size () const
 
std::shared_ptr< Packet::LogFrame > lastFrame () const
 
void addFrame (std::shared_ptr< Packet::LogFrame > frame, bool force)
 
void addFrame (std::shared_ptr< Packet::LogFrame > frame)
 
bool readFrames (const char *filename)
 
int getFrames (int start, std::vector< std::shared_ptr< Packet::LogFrame >> &frames) const
 
int spaceUsed () const
 
bool recording () const
 
QString filename () const
 
int firstFrameNumber () const
 
int currentFrameNumber () const
 
template<typename OutputIterator >
int getFrames (int endIndex, int num, OutputIterator result) const
 
RJ::Time startTime () const
 

Detailed Description

The Logger stores and saves the state of the game at each point in time.

The log stores things such as robot and ball position and velocity as well as debug information about the current play. See the LogFrame.proto file for a full list of what is stored in the log.

This logger implements a circular buffer for recent history and writes all frames to disk.

_history is a circular buffer.

Consider a sequence number for each frame, where the first frame passed to addFrame() has a sequence number of zero and the sequence number is one greater for each subsequent frame.

_nextFrameNumber is the sequence number of the next frame to be stored by addFrame().

lastFrame() returns the sequence number of the latest available frame. It returns -1 if no frames have been stored.

You can get a copy of a frame by passing its sequence number to getFrame(). If the frame is too old to be in the circular buffer (or the sequence number is beyond the most recent available) then getFrame() will return false.

Frames are allocated as they are first needed. The size of the circular buffer limits total memory usage.


The documentation for this class was generated from the following files: