GT RoboCup SSL
Soccer software, robot firmware
VisionReceiver Class Reference

Receives vision packets over UDP and places them in a buffer until they are read. More...

Public Member Functions

 VisionReceiver (bool sim=false, int port=SharedVisionPortSinglePrimary)
 
void stop ()
 
void getPackets (std::vector< VisionPacket *> &packets)
 Copies the vector of packets and then clears it. More...
 

Public Attributes

bool simulation
 
int port
 

Protected Member Functions

virtual void run () override
 

Protected Attributes

volatile bool _running
 
QMutex _mutex
 This mutex protects the vector of packets.
 
std::vector< VisionPacket * > _packets
 

Detailed Description

Receives vision packets over UDP and places them in a buffer until they are read.

When start() is called, a new thread is spawned that listens on a UDP port for packets. If sim = true, it tries both simulator ports until one works. Otherwise, it connects to the port specified in the constructor.

Whenever a new packet comes in (encoded as Google Protobuf), it is parsed into an SSL_WrapperPacket and placed onto the circular buffer . They remain there until they are retrieved with getPackets().

+ Inheritance diagram for VisionReceiver:
+ Collaboration diagram for VisionReceiver:

Member Function Documentation

◆ getPackets()

void VisionReceiver::getPackets ( std::vector< VisionPacket *> &  packets)

Copies the vector of packets and then clears it.

The vector contains only packets received since the last time this was called (or since the VisionReceiver was started, if getPackets has never been called).

The caller is responsible for freeing the packets after this function returns.


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