Author Topic: how can i make 50$ robot with sharp IR stop when 10cm from target?  (Read 882 times)

0 Members and 1 Guest are viewing this topic.

Offline ballbreakerTopic starter

  • Full Member
  • ***
  • Posts: 78
  • Helpful? 1
what are the commands? also how can i make it to stop and turn away when facing wall (doesn't have to follow objects.)
For Those About To Rock, We Salute You!

Offline Choco_liger

  • Full Member
  • ***
  • Posts: 81
  • Helpful? 3
Re: how can i make 50$ robot with sharp IR stop when 10cm from target?
« Reply #1 on: July 14, 2010, 06:59:16 AM »
Heh. That's what I'm doing now.


Offline ballbreakerTopic starter

  • Full Member
  • ***
  • Posts: 78
  • Helpful? 1
Re: how can i make 50$ robot with sharp IR stop when 10cm from target?
« Reply #2 on: July 14, 2010, 08:40:57 AM »
well any tips?
For Those About To Rock, We Salute You!

Offline Conscripted

  • Robot Overlord
  • ****
  • Posts: 291
  • Helpful? 10
Re: how can i make 50$ robot with sharp IR stop when 10cm from target?
« Reply #3 on: July 14, 2010, 11:06:14 AM »
It should be as simple as finding the sharp's output at 10cm and then use that as your threshold value.

Conscripted

Offline ballbreakerTopic starter

  • Full Member
  • ***
  • Posts: 78
  • Helpful? 1
Re: how can i make 50$ robot with sharp IR stop when 10cm from target?
« Reply #4 on: July 16, 2010, 03:12:59 PM »
will this work to follow an object and when its too close to turn?

   while(1)
      {
      scan();
      
      //object on left
      if(scan_angle > 57 && sharp_IR_reading > scan_thresh)
         robot_turn_left();

      //object on right
      else if(scan_angle < 41 && sharp_IR_reading > scan_thresh)
         robot_turn_right();
   
       // object at close distance
      else if(sharp_IR_reading == scan_thresh)
          robot_turn_left();
        
            
      //object is centered
   else if(sharp_IR_reading > scan_thresh && scan_angle >41 <57)
      robot_go_straight();
         
delay_cycles(400);

}

can anyone find any errors or if this would work as an idea?
« Last Edit: July 16, 2010, 03:16:07 PM by ballbreaker »
For Those About To Rock, We Salute You!

 


Get Your Ad Here