Author Topic: How to make my Bot move away from object instead of going into them  (Read 1227 times)

0 Members and 1 Guest are viewing this topic.

Offline jabird60Topic starter

  • Beginner
  • *
  • Posts: 2
  • Helpful? 0
I have to source code to the IR Range finder and i just need to kno what to change to make it move away from things instead of hauling butt to them.. I have the
Quote
//object on left
      if(scan_angle > 57)
         robot_turn_right();

      //object on right
      else if(scan_angle < 41)
         robot_turn_left();
fixed because you just swap them but im not sure how to make it go backwards and how to change it to if it doesnt see anything go straight and not keep looking for something.

Offline mstacho

  • Supreme Robot
  • *****
  • Posts: 376
  • Helpful? 10
Re: How to make my Bot move away from object instead of going into them
« Reply #1 on: April 20, 2011, 12:11:12 PM »
What kind of microcontroller are you using?  How are you controlling the motors?  Since you can make the robot turn left and right, you appear to already have the ability to move the motors backwards and forwards, so why not just do:

//keep moving until see the obstacle
robot_move_forwards();

//object on left -- turn right and move backwards
   if(scan_angle > 57)
        robot_turn_right();
        robot_move_backwards();

Then after a while (a second or something), start moving forward again.

I'm not 100% sure I understand what you're asking, but if you can go straight, you can go backwards.

MIKE
Current project: tactile sensing systems for multifingered robot hands

Offline jabird60Topic starter

  • Beginner
  • *
  • Posts: 2
  • Helpful? 0
Re: How to make my Bot move away from object instead of going into them
« Reply #2 on: April 20, 2011, 01:03:48 PM »
I am useing the ATMEGA8.. And i just need to kno what to put in my sohc.h file to make it go backwards.. There is a left,right,straight but no back.. i just need to kno what number to put that makes the servo turn backwards

 


Get Your Ad Here

data_list