1:Space sp=UNIVERSE;
2:Resource R1=< (within(Sp)==TRUE)&(motion>0) >;
3:Location AverageLoc;
4:
5:for(inti=1;i<= 25;i++){
6:       AverageLoc = average(R1->Location);
7:   if (AverageLoc != NULL){
8:         System.out.println (
9:    “Average(“+i+”)=”+AverageLoc);
10:   sp.updateRegion(AverageLoc, 10);
11:    }   else    {
12:    System.out.println (
13:Average(“+i+”)= NOT FOUND);
14:    sp = UNIVERSE;
15:  }
16:  sleep(4000);
17:  }
Algorithm 5: Pseudocode for our object-tracking application.