Proximity Sensors

From IridiaWiki
Revision as of 16:32, 19 October 2011 by Manubrambi (talk | contribs) (New page: Note that the e-pucks do not see each other with the proximity. The solution is to use reflective tape on the outer ring of the robots. With that they see each other fairly well. Here is ...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

Note that the e-pucks do not see each other with the proximity. The solution is to use reflective tape on the outer ring of the robots. With that they see each other fairly well.

Here is the function I use to calibrate the proximity sensors:

void ProxSensorCalibrate() {
  int i, j;
  char tmp[50];
  long sensor[8];
  long delay;
  for (i=0; i<8; i++) {
     sensor[i]=0;
  }
  for (j=0; j<64; j++) {
     for (i=0; i<8; i++) {
        sensor[i]+=e_get_prox(i);
     }
     for (delay = 0; delay < 100000; delay++){
        __asm__("nop");
     }
  }
  btcomSendString("calibration prox:\n");
  for (i=0; i<8; i++) {
     prox_sensor_zero[i]=(sensor[i]>>6);
     sprintf(tmp,"%d\t%d",i, prox_sensor_zero[i]);   
     btcomSendString(tmp);
     btcomSendString("\n");
  }
  
  for (delay = 0; delay < 100000; delay++){
     __asm__("nop");
  }
}