Proximity Sensors

From IridiaWiki
Jump to: navigation, 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");
  }
}
Personal tools