#include <TeamMessageCollection.h>
Collaboration diagram for TeamMessageCollection:
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 TeamMessage & | operator[] (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 the internal references to the incoming TeamMessages. | |
void | send (const RobotPose &robotPose, bool sendNow=false) const |
This function sets the robotPose field in the outgoing TeamMessage. | |
void | send (const BehaviorTeamMessage &behaviorTeamMessage, bool sendNow=false) const |
This function sets the BehaviorTeamMessage field in the outgoing TeamMessage. | |
void | send (const SeenBallPosition &seenBallPosition, bool sendNow=false) const |
This function sets the BehaviorTeamMessage field 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 | |
Public Attributes | |
int | numberOfTeamMessages |
count of actual TeamMessages | |
Private 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. | |
Private Attributes | |
int | delay |
the delay between two subsequent sends | |
const TeamMessage * | teamMessages [maxNumberOfTeamMessages] |
pointer to the incomming teamMessages | |
TeamMessage * | outTeamMessages [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 |
Definition at line 26 of file TeamMessageCollection.h.
|
Timeout-constants for the processMasterSync method.
Definition at line 33 of file TeamMessageCollection.h. |
|
the maximum number of team-messages
Definition at line 37 of file TeamMessageCollection.h. |
|
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:
|
Constant access operator to a certain team message. Only actual team-messages are given back. (TeamMessage.isActual() == true)
Definition at line 53 of file TeamMessageCollection.h. References teamMessages, and teamMessagesForActualTeamMessages. |
|
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 93 of file TeamMessageCollection.cpp. References TeamMessage::isActual(), messagesSent, numberOfInTeamMessages, numberOfTeamMessages, outTeamMessages, processTimeStamps(), teamMessages, and teamMessagesForActualTeamMessages. Referenced by Cognition::main(). |
Here is the call graph for this function:
|
The function sets the internal references to the outgoing TeamMessages.
Definition at line 118 of file TeamMessageCollection.cpp. References numberOfOutTeamMessages, and outTeamMessages. Referenced by Cognition::Cognition(). |
|
The function sets the internal references to the incoming TeamMessages.
Definition at line 125 of file TeamMessageCollection.cpp. References numberOfInTeamMessages, and teamMessages. Referenced by Cognition::Cognition(). |
|
This function sets the robotPose field in the outgoing TeamMessage.
Definition at line 132 of file TeamMessageCollection.cpp. References numberOfOutTeamMessages, outTeamMessages, TeamMessage::robotPose, and TeamMessage::sendRobotPose. Referenced by Cognition::main(). |
|
This function sets the BehaviorTeamMessage field in the outgoing TeamMessage.
Definition at line 152 of file TeamMessageCollection.cpp. References TeamMessage::behaviorTeamMessage, numberOfOutTeamMessages, outTeamMessages, and TeamMessage::sendBehaviorTeamMessage. |
|
This function sets the BehaviorTeamMessage field in the outgoing TeamMessage.
Definition at line 142 of file TeamMessageCollection.cpp. References numberOfOutTeamMessages, outTeamMessages, TeamMessage::seenBallPosition, and TeamMessage::sendSeenBallPosition. |
|
This function processes the outgoing messages.
Definition at line 162 of file TeamMessageCollection.cpp. References delay, SystemCall::getCurrentSystemTime(), lastSendTime, messagesSent, numberOfOutTeamMessages, outTeamMessages, sendNow, and TeamMessage::timeStamp. Referenced by Cognition::main(). |
Here is the call graph for this function:
|
get the delay between two subsequent sends
Definition at line 187 of file TeamMessageCollection.cpp. References delay. |
|
set the delay between two subsequent sends
Definition at line 182 of file TeamMessageCollection.cpp. Referenced by Cognition::handleMessage(). |
|
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(), idText, TeamMessage::incomingTimeStamp, INFO, TeamMessage::lastReceivedTimeStamp, numberOfInTeamMessages, offsets, outTeamMessages, teamMessages, timeOffsetSum, and TeamMessage::timeStamp. Referenced by processMessages(). |
Here is the call graph for this function:
|
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. |
|
count of actual TeamMessages
Definition at line 39 of file TeamMessageCollection.h. Referenced by GT2004StrategySymbols::computeRole(), GT2004TeamBallLocator::execute(), GT2004PlayersLocator::execute(), processMessages(), and GTStandardConverter::setData(). |
|
the delay between two subsequent sends
Definition at line 115 of file TeamMessageCollection.h. Referenced by getDelay(), processOutMessages(), and TeamMessageCollection(). |
|
pointer to the incomming teamMessages
Definition at line 116 of file TeamMessageCollection.h. Referenced by operator[](), processMessages(), processTimeStamps(), setInTeamMessages(), and TeamMessageCollection(). |
|
pointer to outgoing teamMessages
Definition at line 117 of file TeamMessageCollection.h. Referenced by processMessages(), processOutMessages(), processTimeStamps(), send(), and setOutTeamMessages(). |
|
Array to translate teamMessage number for backwards compability.
Definition at line 118 of file TeamMessageCollection.h. Referenced by operator[](), processMessages(), and TeamMessageCollection(). |
|
TimeStamp when sending the last TeamMessage.
Definition at line 120 of file TeamMessageCollection.h. Referenced by TeamMessageCollection(). |
|
TimeStamps of the latest incoming TeamMessages.
Definition at line 121 of file TeamMessageCollection.h. Referenced by TeamMessageCollection(). |
|
Local TimeStamp of the latest incoming TeamMessages.
Definition at line 122 of file TeamMessageCollection.h. |
|
Ringbuffer to save the last 100 time offsets for the 3 TeamMessages.
Definition at line 125 of file TeamMessageCollection.h. Referenced by processTimeStamps(), and TeamMessageCollection(). |
|
Sum of all the values in the ringBuffers.
Definition at line 126 of file TeamMessageCollection.h. Referenced by processTimeStamps(), and TeamMessageCollection(). |
|
set true if the messages have been sent
Definition at line 129 of file TeamMessageCollection.h. Referenced by processMessages(), processOutMessages(), and TeamMessageCollection(). |
|
pointer to a bool which shows that the robot has to send the messages
Definition at line 130 of file TeamMessageCollection.h. Referenced by processOutMessages(), and TeamMessageCollection(). |
|
time when *sendNow was last true Used to send after a delay Definition at line 131 of file TeamMessageCollection.h. Referenced by processOutMessages(), and TeamMessageCollection(). |
|
Definition at line 135 of file TeamMessageCollection.h. Referenced by processMessages(), processTimeStamps(), setInTeamMessages(), and TeamMessageCollection(). |
|
Definition at line 136 of file TeamMessageCollection.h. Referenced by processOutMessages(), send(), setOutTeamMessages(), and TeamMessageCollection(). |