Escolar Documentos
Profissional Documentos
Cultura Documentos
For the n robots (r1, r2, ..., rn), we have associated quantities (x1, x2, ,xn). The global average ()
can be expressed by the following equation
=
=1
Conservation:
Let and be the quantities for the robots and , respectively. After pairwise average, we will
have the quantities i and j associated to the robots r i and rj . We have to check if the global average
will be preserved. When it happens, the global average must be the same for both situations: before
( , ) and after ( i j) the pairwise. Then:
1 =
2 =
But, i =
+
2
+
2
+
2
2( + )
2
Convergence:
=1( )2
[( 2 - 2 + 2) + (2 - 2 + 2) +... ] +
[(xi - )2 + ...]
22 = =1( )2
1
22 = [( i - )2 + ( j - )2 ] + [(xi - )2 + ...]
We know that i =
+
2
= j. Then
= +
22 =
[(i - )2 + (j - )2 ] +
[(xi - )2 + ...]
[(
+
2
2(
- )2 + (
+
2
- )2 ] +
2 + 2 + 2 <
2
+
2
[(xi - )2 + ...]
2
42 +42 + 2
2
< 2
) + 2] < 2 + 2 - 2 - 2 + 22
2 + 2 . If , we can set = + x
2 + 2( + ) + ( + )2
- )2 < 2 + 2 - 2 - 2 + 22
2[4 ( 2 + 2 + 2) 2(
<
2 + ( + ) 2
< 22 + 2 + 2
=
22 < 12
To update the communication table, all robots send a broadcast message to all reachable robots.
The protocol design would be a three-way handshake protocol. Thus, a robot sends a SYNC
message, and it waits for an ACK (received); if time out, the robot will send a SYNC message
again. The first robot would answer the ACK with a DATA message, and it waits for DATA_ACK
from the receiver. After it receives a DATA_ACK, the robot sends another ACK meaning that it
received, and it waits for the END_ACK. At that point, the message was transferred. In order to
try to figure out problems with communication between the robots, every step has time-out
functions to resend ACKs, DATA, or SYNCs.
send_DATA ()
try++
if (try == 3) return failure # after three tries to send it returns a fail flag
try = 0
send_ACK ()
while(listen()!=END_ACK && timeout)
send_ACK ()
try++
if (try == 3) return failure # after three tries to send it returns a fails flag
return success # message delivered
#communication established
Robot 2 (receiver) algorithm:
updateTable = broadcastMSG()
delay(x)
#startingcomunication
do msg=listen() while(msg!=SYNC) # waiting for a SYNC message
send_ACK()
try = 0
while(listen()!=DATA && timeout)
send_ACK()
try++
if (try == 3) return failure # after three tries to send it returns a fail flag
send_DATA_ACK()
try = 0
while(listen()!=ACK && timeout)
send_DATA_ACK()
try++
if (try == 3) return failure # after three tries to send it returns a fails flag
send_END_ACK()
try = 0
while(listen()!=ACK && timeout)
send_END_ACK()
try++
if (try == 3) return failure # after three tries to send it returns a fails flag
return success # message delivered
#communication established
Correctness: The chances of a message be lost depend on the network: if the network is not reliable,
it is impossible ensure the protocol effectiveness. Even though the protocol design implements a
time-out functions that resend messages in a specific number of attempts, for instance, a receiver
robot might never know if a DATA_ACK was received; consequently, there is the loss of
communication.
r2
r1
r3
=
=
1 =
1 + 2 + 3
3
1 + 2 + 3
; 2 =
1 + 2 + 3
3
; 3 =
2 + 3
2
(51 + 82 + 53 )
18
1 + 2
31 + 32 + 21 + 22 + 23 + 32 + 33
18
1 + 2 + 3
3
=1 sin( )
=1 cos( )