#include <Communicator.h>
Inheritance diagram for Communicator:
Public Member Functions | |
Communicator () | |
int | activate () |
bool | getHaveClusterPoint () |
bool | setClusterPoint (double x, double y) |
void | initialize (void) |
Static Public Attributes | |
const int | DONE = 0 |
const int | NOT_ONE_RESPONSE = 1 |
const int | ROBOT_LEFT = 2 |
Private Member Functions | |
bool | justify () |
bool | exchangeData () |
void | int2BYTEArray (int valueToConvert, BYTE *arrayToContainValue) |
void | intArray2BYTEArray (int numberOfValues, int *values, BYTE *arrayToContainValues) |
void | BYTEArray2Int (BYTE *arrayContainingValue, int &value) |
void | BYTEArray2IntArray (int numberOfValues, BYTE *arrayContainingValues, int values[]) |
void | emptyMessageQueue (void) |
Private Attributes | |
bool | haveClusterPoint |
int | waitingPeriod |
Radio * | radio |
Timer | timer |
Compass * | compass |
|
|
|
Activates this behavior
|
|
Converts an array of BYTEs into an int. The passed array must have enough have at least 4 bytes
|
|
Converts an array of BYTEs into an array of ints. The passed array must have enough have at least 4 bytes for each int that is to be converted
|
|
Empties the message queue of the radio by reading all messages in the queue. The messages are not retained! |
|
Tries to exchange data with the robot that we met by sending out messages to all nearby robots and waiting for incoming messages. If exactly one incoming message is received we know that it is probably from the robot facing us. The cluster point age or density and the cluster point location are exchanged. Based on the exchanged data the older or the denser of the two cluster points is chosen as cluster point for this robot
|
|
|
|
The simulator does not allow the usage of RoBIOS functions in class constructors. Therefore we use public initialize methods for classes that need RoBIOS functions for their initializations. Reimplemented from Behavior. |
|
Converts an int into an array of BYTEs. The passed array must have enough space for an int, i.e. at least 4 bytes
|
|
Converts an array of ints into an array of BYTEs. The passed array of BYTEs must have enough space for the number of ints that are to be converted, i.e. at least 4 bytes for each int
|
|
Tries to justify this robot so that it faces the robot it tries to communicate with at a close distance
|
|
Used to tell the communicator to set the robot's cluster point to the passed position. This is only done if Communicator::getHaveClusterPoint() returns false, i.e. if no cluster point was chosen yet. Otherwise the communicator ignores this command and decides himself which cluster point to use
|
|
The Communicator needs the Compass to correctly exchange its position with the other robot |
|
Used as result code for Communicator::activate() |
|
Stores if the robot does already have a cluster point |
|
Used as result code for Communicator::activate() |
|
The Communicator uses the Radio to communicate |
|
Used as result code for Communicator::activate() |
|
The Communicator has a Timer to determine cluster point ages and to wait for incoming messages |
|
Determines how long the robot waits for incoming responses when exchanging data with other robots
|