Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

TeamMessageCollection Class Reference

Represents a collection of all actual team messages received from other robots and has the ability to send to them too. More...

#include <TeamMessageCollection.h>

Collaboration diagram for TeamMessageCollection:

Collaboration graph
[legend]
List of all members.

Public Types

enum  { robotTimeoutTime = 4000, masterTimeoutTime = 2000, masterClaimTimeoutTime = 1500 }
 Timeout-constants for the processMasterSync method. More...

enum  { maxNumberOfTeamMessages = Player::numOfPlayerNumbers-1 }
 the maximum number of team-messages More...


Public Member Functions

 TeamMessageCollection ()
 Constructor.

const TeamMessageoperator[] (int index) const
 Constant access operator to a certain team message.

void processMessages ()
 This method processes the incomming messages to calculate time-offsets for the time syncronisation, to find out which Robot is Master and to find out if one robot is missing.

void setOutTeamMessages (TeamMessage &tm)
 The function sets the internal references to the outgoing TeamMessages.

void setInTeamMessages (TeamMessage &tm)
 The function sets an internal reference to an incoming TeamMessage.

void send (const RobotPose &robotPose, bool sendNow=false) const
 This function sets the robotPose field in the outgoing TeamMessage that is represented by the target.

void send (const BehaviorTeamMessage &behaviorTeamMessage, bool sendNow=false) const
 This function sets the BehaviorTeamMessage field in the outgoing TeamMessage that is represented by the target.

void send (const PlayersPercept &playersPercept, bool sendNow=false) const
 This function sets the BehaviorTeamMessage field in the outgoing TeamMessage that is represented by the target.

void send (const SeenBallState &seenBallState, bool sendNow=false) const
 This function sets the PlayersPercept in the outgoing TeamMessage.

void send (const SensorBehaviorTeamMessage &sensorBehaviorTeamMessage, bool sendNow=false) const
 This function sets the SensorBehaviorTeamMessage in the outgoing TeamMessage.

void send (const OdometryData &odometryData, bool sendNow=false) const
 This function sets the SensorBehaviorTeamMessage in the outgoing TeamMessage.

void send (const MultipleBallPerceptList &multipleBallPerceptList, bool sendNow=false) const
 This function sets the SensorBehaviorTeamMessage in the outgoing TeamMessage.

void send (const GT2005ParticleContainerSend &gt2005ParticleContainerSend, bool sendNow=false) const
 This function sets the SensorBehaviorTeamMessage in the outgoing TeamMessage.

void send (const RobotPoseCollection &robotPoseCollection, bool sendNow=false) const
 This function sets the SensorBehaviorTeamMessage in the outgoing TeamMessage.

void send (const ObstaclesModel &obstaclesModel, bool sendNow=false) const
 This function sets the ObstaclesModel in the outgoing TeamMessage.

bool processOutMessages ()
 This function processes the outgoing messages.

int getDelay () const
 get the delay between two subsequent sends

void setDelay (int delay)
 set the delay between two subsequent sends

void set (TeamMessageMessageCollection *)

Public Attributes

int numberOfTeamMessages
 count of actual TeamMessages


Protected Member Functions

void processTimeStamps ()
 This method is called by processMessages() to find out the time-offsets between the robots.

void processMessagePlayerRole ()
 This method is calls by processMessages() to set the fields of the teamMessageForTarget[] array.


Protected Attributes

int delay
 the delay between two subsequent sends

const TeamMessageteamMessages [maxNumberOfTeamMessages]
 pointer to the incomming teamMessages

TeamMessageoutTeamMessages [maxNumberOfTeamMessages]
 pointer to outgoing teamMessages

int teamMessagesForActualTeamMessages [maxNumberOfTeamMessages]
 Array to translate teamMessage number for backwards compability.

unsigned lastSendingTimeStamp
 TimeStamp when sending the last TeamMessage.

unsigned teamMessageTimeStamp [maxNumberOfTeamMessages]
 TimeStamps of the latest incoming TeamMessages.

unsigned incomingTimeStamp [maxNumberOfTeamMessages]
 Local TimeStamp of the latest incoming TeamMessages.

RingBuffer< signed long, 100 > offsets [maxNumberOfTeamMessages]
 Ringbuffer to save the last 100 time offsets for the 3 TeamMessages.

signed long timeOffsetSum [maxNumberOfTeamMessages]
 Sum of all the values in the ringBuffers.

bool messagesSent
 set true if the messages have been sent

bool sendNow
 pointer to a bool which shows that the robot has to send the messages

long lastSendTime
 time when *sendNow was last true

int numberOfInTeamMessages
int numberOfOutTeamMessages

Detailed Description

Represents a collection of all actual team messages received from other robots and has the ability to send to them too.

Definition at line 26 of file TeamMessageCollection.h.


Member Enumeration Documentation

anonymous enum
 

Timeout-constants for the processMasterSync method.

Enumeration values:
robotTimeoutTime 
masterTimeoutTime 
masterClaimTimeoutTime 

Definition at line 33 of file TeamMessageCollection.h.

anonymous enum
 

the maximum number of team-messages

Enumeration values:
maxNumberOfTeamMessages 

Definition at line 37 of file TeamMessageCollection.h.


Constructor & Destructor Documentation

TeamMessageCollection::TeamMessageCollection  ) 
 

Constructor.

Definition at line 15 of file TeamMessageCollection.cpp.

References RingBuffer< signed long, 100 >::add(), delay, RingBuffer< signed long, 100 >::init(), lastSendingTimeStamp, lastSendTime, maxNumberOfTeamMessages, messagesSent, numberOfInTeamMessages, numberOfOutTeamMessages, offsets, sendNow, teamMessages, teamMessagesForActualTeamMessages, teamMessageTimeStamp, and timeOffsetSum.

Here is the call graph for this function:


Member Function Documentation

const TeamMessage& TeamMessageCollection::operator[] int  index  )  const [inline]
 

Constant access operator to a certain team message.

Only actual team-messages are given back. (TeamMessage.isActual() == true)

Parameters:
index The index of the team message.
Returns:
The team message with the requested index.

Definition at line 53 of file TeamMessageCollection.h.

References teamMessages, and teamMessagesForActualTeamMessages.

void TeamMessageCollection::processMessages  ) 
 

This method processes the incomming messages to calculate time-offsets for the time syncronisation, to find out which Robot is Master and to find out if one robot is missing.

Definition at line 148 of file TeamMessageCollection.cpp.

References TeamMessage::isActual(), numberOfInTeamMessages, numberOfOutTeamMessages, numberOfTeamMessages, outTeamMessages, processTimeStamps(), TeamMessage::resetSendMarkers(), teamMessages, and teamMessagesForActualTeamMessages.

Referenced by Cognition::main().

Here is the call graph for this function:

void TeamMessageCollection::setOutTeamMessages TeamMessage tm  ) 
 

The function sets the internal references to the outgoing TeamMessages.

Parameters:
tm the outgoing teammessage

Definition at line 171 of file TeamMessageCollection.cpp.

References numberOfOutTeamMessages, and outTeamMessages.

Referenced by Cognition::Cognition().

void TeamMessageCollection::setInTeamMessages TeamMessage tm  ) 
 

The function sets an internal reference to an incoming TeamMessage.

Parameters:
tm The TeamMessage

Definition at line 178 of file TeamMessageCollection.cpp.

References numberOfInTeamMessages, and teamMessages.

Referenced by Cognition::Cognition().

void TeamMessageCollection::send const RobotPose robotPose,
bool  sendNow = false
const
 

This function sets the robotPose field in the outgoing TeamMessage that is represented by the target.

Parameters:
robotPose The RobotPose to be sent
sendNow bool o indicate that the message needs to be sent now (default = false)

Definition at line 185 of file TeamMessageCollection.cpp.

References numberOfOutTeamMessages, outTeamMessages, TeamMessage::robotPose, and TeamMessage::sendRobotPose.

Referenced by GT2005TeamBallLocator::execute().

void TeamMessageCollection::send const BehaviorTeamMessage behaviorTeamMessage,
bool  sendNow = false
const
 

This function sets the BehaviorTeamMessage field in the outgoing TeamMessage that is represented by the target.

Parameters:
behaviorTeamMessage The BehaviorTeamMessage to be sent
sendNow bool o indicate that the message needs to be sent now

Definition at line 205 of file TeamMessageCollection.cpp.

References TeamMessage::behaviorTeamMessage, numberOfOutTeamMessages, outTeamMessages, and TeamMessage::sendBehaviorTeamMessage.

void TeamMessageCollection::send const PlayersPercept playersPercept,
bool  sendNow = false
const
 

This function sets the BehaviorTeamMessage field in the outgoing TeamMessage that is represented by the target.

Parameters:
seenBallPosition The SeenBallPosition to be sent
sendNow bool o indicate that the message needs to be sent now

Definition at line 215 of file TeamMessageCollection.cpp.

References numberOfOutTeamMessages, outTeamMessages, TeamMessage::playersPercept, and TeamMessage::sendPlayersPercept.

void TeamMessageCollection::send const SeenBallState seenBallState,
bool  sendNow = false
const
 

This function sets the PlayersPercept in the outgoing TeamMessage.

Parameters:
playersPercept The PlayersPercept to be sent
sendNow bool o indicate that the message needs to be sent now

Definition at line 195 of file TeamMessageCollection.cpp.

References numberOfOutTeamMessages, outTeamMessages, TeamMessage::seenBallState, and TeamMessage::sendSeenBallState.

void TeamMessageCollection::send const SensorBehaviorTeamMessage sensorBehaviorTeamMessage,
bool  sendNow = false
const
 

This function sets the SensorBehaviorTeamMessage in the outgoing TeamMessage.

Parameters:
sensorBehaviorTeamMessage The SensorBehaviorTeamMessage to be sent
sendNow bool to indicate that the message needs to be sent now

Definition at line 225 of file TeamMessageCollection.cpp.

References numberOfOutTeamMessages, outTeamMessages, TeamMessage::sendSensorBehaviorTeamMessage, and TeamMessage::sensorBehaviorTeamMessage.

void TeamMessageCollection::send const OdometryData odometryData,
bool  sendNow = false
const
 

This function sets the SensorBehaviorTeamMessage in the outgoing TeamMessage.

Parameters:
odometryData The OdometryData to be sent
sendNow bool to indicate that the message needs to be sent now

Definition at line 245 of file TeamMessageCollection.cpp.

References numberOfOutTeamMessages, TeamMessage::odometryData, outTeamMessages, and TeamMessage::sendOdometryData.

void TeamMessageCollection::send const MultipleBallPerceptList multipleBallPerceptList,
bool  sendNow = false
const
 

This function sets the SensorBehaviorTeamMessage in the outgoing TeamMessage.

Parameters:
multipleBallPerceptList The MultipleBallPerceptList to be sent
sendNow bool to indicate that the message needs to be sent now

Definition at line 235 of file TeamMessageCollection.cpp.

References TeamMessage::multipleBallPerceptList, numberOfOutTeamMessages, outTeamMessages, and TeamMessage::sendMultipleBallPerceptList.

void TeamMessageCollection::send const GT2005ParticleContainerSend gt2005ParticleContainerSend,
bool  sendNow = false
const
 

This function sets the SensorBehaviorTeamMessage in the outgoing TeamMessage.

Parameters:
gt2005ParticleContainerSend The GT2005ParticleContainerSend to be sent
sendNow bool to indicate that the message needs to be sent now

Definition at line 255 of file TeamMessageCollection.cpp.

References TeamMessage::gt2005ParticleContainerSend, numberOfOutTeamMessages, outTeamMessages, and TeamMessage::sendGT2005ParticleContainerSend.

void TeamMessageCollection::send const RobotPoseCollection robotPoseCollection,
bool  sendNow = false
const
 

This function sets the SensorBehaviorTeamMessage in the outgoing TeamMessage.

Parameters:
robotPoseCollection The RobotPoseCollection to be sent
sendNow bool to indicate that the message needs to be sent now

Definition at line 265 of file TeamMessageCollection.cpp.

References numberOfOutTeamMessages, outTeamMessages, TeamMessage::robotPoseCollection, and TeamMessage::sendRobotPoseCollection.

void TeamMessageCollection::send const ObstaclesModel obstaclesModel,
bool  sendNow = false
const
 

This function sets the ObstaclesModel in the outgoing TeamMessage.

Parameters:
obstaclesModel The obstaclesModel to be sent
sendNow bool to indicate that the message needs to be sent now

Definition at line 276 of file TeamMessageCollection.cpp.

References numberOfOutTeamMessages, TeamMessage::obstaclesModel, outTeamMessages, and TeamMessage::sendObstaclesModel.

bool TeamMessageCollection::processOutMessages  ) 
 

This function processes the outgoing messages.

Returns:
A bool that is true when the messages should be send.

Definition at line 286 of file TeamMessageCollection.cpp.

References delay, SystemCall::getCurrentSystemTime(), lastSendTime, messagesSent, numberOfOutTeamMessages, outTeamMessages, sendNow, and TeamMessage::timeStamp.

Here is the call graph for this function:

int TeamMessageCollection::getDelay  )  const
 

get the delay between two subsequent sends

Definition at line 311 of file TeamMessageCollection.cpp.

References delay.

void TeamMessageCollection::setDelay int  delay  ) 
 

set the delay between two subsequent sends

Definition at line 306 of file TeamMessageCollection.cpp.

Referenced by Cognition::handleMessage().

void TeamMessageCollection::set TeamMessageMessageCollection *   ) 
 

void TeamMessageCollection::processTimeStamps  )  [protected]
 

This method is called by processMessages() to find out the time-offsets between the robots.

It saves the time-difference in the corresponding TeamMessage accesed by operator[]

Definition at line 52 of file TeamMessageCollection.cpp.

References RingBuffer< signed long, 100 >::add(), SystemCall::getCurrentSystemTime(), RingBuffer< signed long, 100 >::getEntry(), RingBuffer< signed long, 100 >::getNumberOfEntries(), getPlayer(), Player::getPlayerNumber(), idText, TeamMessage::incomingTimeStamp, INFO, TeamMessage::lastReceivedTimeStamp, numberOfInTeamMessages, numberOfOutTeamMessages, offsets, outTeamMessages, TeamMessage::playerNumberOfSender, teamMessages, timeOffsetSum, and TeamMessage::timeStamp.

Referenced by processMessages().

Here is the call graph for this function:

void TeamMessageCollection::processMessagePlayerRole  )  [protected]
 

This method is calls by processMessages() to set the fields of the teamMessageForTarget[] array.

This array is used by the send-methods to find out which teamMessages send to a target.


Member Data Documentation

int TeamMessageCollection::numberOfTeamMessages
 

count of actual TeamMessages

Definition at line 39 of file TeamMessageCollection.h.

Referenced by GT2005TeamBallLocator::execute(), PassSymbols::getAngleToPassSender(), processMessages(), and GTStandardConverter::setData().

int TeamMessageCollection::delay [protected]
 

the delay between two subsequent sends

Definition at line 171 of file TeamMessageCollection.h.

Referenced by getDelay(), processOutMessages(), and TeamMessageCollection().

const TeamMessage* TeamMessageCollection::teamMessages[maxNumberOfTeamMessages] [protected]
 

pointer to the incomming teamMessages

Definition at line 172 of file TeamMessageCollection.h.

Referenced by operator[](), processMessages(), processTimeStamps(), setInTeamMessages(), and TeamMessageCollection().

TeamMessage* TeamMessageCollection::outTeamMessages[maxNumberOfTeamMessages] [protected]
 

pointer to outgoing teamMessages

Definition at line 173 of file TeamMessageCollection.h.

Referenced by processMessages(), processOutMessages(), processTimeStamps(), send(), and setOutTeamMessages().

int TeamMessageCollection::teamMessagesForActualTeamMessages[maxNumberOfTeamMessages] [protected]
 

Array to translate teamMessage number for backwards compability.

Definition at line 174 of file TeamMessageCollection.h.

Referenced by operator[](), processMessages(), and TeamMessageCollection().

unsigned TeamMessageCollection::lastSendingTimeStamp [protected]
 

TimeStamp when sending the last TeamMessage.

Definition at line 176 of file TeamMessageCollection.h.

Referenced by TeamMessageCollection().

unsigned TeamMessageCollection::teamMessageTimeStamp[maxNumberOfTeamMessages] [protected]
 

TimeStamps of the latest incoming TeamMessages.

Definition at line 177 of file TeamMessageCollection.h.

Referenced by TeamMessageCollection().

unsigned TeamMessageCollection::incomingTimeStamp[maxNumberOfTeamMessages] [protected]
 

Local TimeStamp of the latest incoming TeamMessages.

Definition at line 178 of file TeamMessageCollection.h.

RingBuffer<signed long,100> TeamMessageCollection::offsets[maxNumberOfTeamMessages] [protected]
 

Ringbuffer to save the last 100 time offsets for the 3 TeamMessages.

Definition at line 181 of file TeamMessageCollection.h.

Referenced by processTimeStamps(), and TeamMessageCollection().

signed long TeamMessageCollection::timeOffsetSum[maxNumberOfTeamMessages] [protected]
 

Sum of all the values in the ringBuffers.

Definition at line 182 of file TeamMessageCollection.h.

Referenced by processTimeStamps(), and TeamMessageCollection().

bool TeamMessageCollection::messagesSent [protected]
 

set true if the messages have been sent

Definition at line 185 of file TeamMessageCollection.h.

Referenced by processOutMessages(), and TeamMessageCollection().

bool TeamMessageCollection::sendNow [mutable, protected]
 

pointer to a bool which shows that the robot has to send the messages

Definition at line 186 of file TeamMessageCollection.h.

Referenced by processOutMessages(), and TeamMessageCollection().

long TeamMessageCollection::lastSendTime [protected]
 

time when *sendNow was last true

Used to send after a delay

Definition at line 187 of file TeamMessageCollection.h.

Referenced by processOutMessages(), and TeamMessageCollection().

int TeamMessageCollection::numberOfInTeamMessages [protected]
 

Definition at line 191 of file TeamMessageCollection.h.

Referenced by processMessages(), processTimeStamps(), setInTeamMessages(), and TeamMessageCollection().

int TeamMessageCollection::numberOfOutTeamMessages [protected]
 

Definition at line 192 of file TeamMessageCollection.h.

Referenced by processMessages(), processOutMessages(), processTimeStamps(), send(), setOutTeamMessages(), and TeamMessageCollection().


The documentation for this class was generated from the following files:
Generated on Mon Mar 20 22:22:06 2006 for GT2005 by doxygen 1.3.6