Vous êtes sur la page 1sur 4

# Atilla Negreiros Maia

## 3.1 Pairwise Agreement

Existence:

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

## , where n is the amount of robots.

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 =

1 = 2 (?)

But, i =

+
2

+
2

+
2

2( + )
2

Convergence:

12 =
12 =

=1( )2

## [( - )2 + (xj - )2 + (x1 - )2 + ( - )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 + ...]

1

[(

+
2

2(

- )2 + (

+
2

- )2 ] +

2 + 2 + 2 <
2

+
2

## [(xi2 - 2xi + 2) + (xj2 - 2xj + 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

## 3.2 Tolerating Error

Protocol Design

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.

## Robot 1 (sender) algorithm:

delay(x)
#startingcomunication
try = 0
send_SYNC()
while(listen()!=ACK && timeout)
send_SYNC()
try++
if (try == 3) return failure # after three tries to send it returns a fail flag
try = 0
send_DATA ()
while(listen()!=DATA_ACK && timeout)

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:
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.

Conservation:

r2
r1

r3

=
=

1 =

1 + 2 + 3
3

1 + 2 + 3

; 2 =

1 + 2 + 3
3

; 3 =

2 + 3
2

3

(51 + 82 + 53 )
18

1 + 2

## - global average beofe pairwise

31 + 32 + 21 + 22 + 23 + 32 + 33
18

1 + 2 + 3
3

## 4.1 Orientation Math

Having values of bearing and orientation from the neighbor, we subtract the orientation from the
bearing and add to scale:
= +
Calculating vector axis:
= cos()
= ()

tan1

= tan1

=1 sin( )
=1 cos( )