Society of Robots - Robot Forum

Software => Software => Topic started by: lucasromeiro on March 29, 2010, 06:56:32 PM

Title: (stampy_sumo_source_code)
Post by: lucasromeiro on March 29, 2010, 06:56:32 PM
hello, I'm d Brazil. I saw the code so sumo (stampy_sumo_source_code) downloaded the file and looked at the controls and had a lot of trouble understanding, someone could guide me, to give some tips, because I need the code of the sensor to the scan complete (radar) could not only use part of the radar, I need it because I am doing a project that needs something like this ... help me? you do for me will be very grateful. Thanks

link: http://www.societyofrobots.com/downloads/stampy_sumo_source_code.zip (http://www.societyofrobots.com/downloads/stampy_sumo_source_code.zip)
Title: Re: (stampy_sumo_source_code)
Post by: lucasromeiro on March 30, 2010, 10:19:24 AM
Muio need this code, remove only part of the scanner! help me .. please.

void scan()
   {
   //swap scan directions
   
   /*psuedocode
   while object is detected
      scan left while object detected
   while object not detected
      scan right until object detected*/
   
   target_distance = analog(A3);//check sensor
   
   if (target_distance > distance_thresh)//object detected
      {
      if (scan_angle>-20) //overflow protection
         scan_angle-=1;//scan left
      }
   else //object not detected
      {
      if (scan_angle<130) //overflow protection
         scan_angle+=1; //scan right
      else //if scanned all the way, this forces it to start over
         scan_angle=-20;
      }
     
   //servo scan code
   output_bit(PIN_D2, 1);//139 center
   long_delay_us(130+scan_angle);
   output_bit(PIN_D2, 0);
     
   //printf("angle: %ld distance: %u\r\n", scan_angle, target_distance);//debug code
   }

????????????????????????????????????????

does not work, do not know if that is ..



HELPPPPPPPPPPPPPPPPPPPPPP
Title: Re: (stampy_sumo_source_code)
Post by: Admin on April 04, 2010, 05:13:14 AM
Did you read the Stampy tutorial?
http://www.societyofrobots.com/robot_sumo.shtml (http://www.societyofrobots.com/robot_sumo.shtml)

I'm not sure how else to explain it . . .