Society of Robots - Robot Forum

Software => Software => Topic started by: nckspec on March 24, 2008, 11:00:39 PM

Title: sharp ir rangefinder
Post by: nckspec on March 24, 2008, 11:00:39 PM
I was just wondering. How does your microcontroller know when your sensor is facing forward.
Title: Re: sharp ir rangefinder
Post by: bulkhead on March 25, 2008, 02:48:03 AM
Why wouldn't your sensor be facing forwards?  If you have it on some panning mechanism, say, controlled by a servo, which is probably the easiest way to do pan it, you would probably set delays in the program after telling the servo to go to a specific angle to ensure that it is at that angle when you take a measurement.  In this case you are making the safe assumption that nothing will physically prevent the panning servo from pointing the IR rangefinder in the direction you want (given a reasonable amount of time).
Title: Re: sharp ir rangefinder
Post by: shimniok on March 25, 2008, 07:09:36 AM
My firefighting bot Pokey uses a pair of Sharp IR sensors at 90* angles on an array rotated by servo.

The position of the servo is determined by the MCU -- basically pulse width determines orientation.  And servos are rated in terms of miliseconds to cross 60* so you can calculate roughly how many msec to traverse a given angle (about 300-400 to sweep 180* in my case).  So in other words, you can tell it at what angle to point and wait the appropriate time until the servo is done moving.

Hope this helps

Michael
Title: Re: sharp ir rangefinder
Post by: nckspec on March 25, 2008, 08:36:38 PM
thank you, thats kinda of what i assumed but i wanted to make sure there wasn't a more competent way
I can't wait to do this project. It will be interesting how my dog will react to a robot following it.
Title: Re: sharp ir rangefinder
Post by: JesseWelling on March 26, 2008, 06:40:27 AM
You could use an encoder if you wanted less of a timer based solution and more of an Interrupt based solution.
Title: Re: sharp ir rangefinder
Post by: superchiku on March 26, 2008, 06:49:02 AM
and what do u mean by that???
Title: Re: sharp ir rangefinder
Post by: Admin on March 30, 2008, 10:51:18 AM
Quote
and what do u mean by that???
http://www.societyofrobots.com/sensors_encoder.shtml

If your robot isn't doing highly accurate mapping, you can have your robot guess the angle. Thats what I did for my Stampy (http://Stampy) robot. It knows the angle within ~20 degrees, and that was good enough.

For more accurate mapping, this is what I did on my iRobot Create:
http://www.societyofrobots.com/robot_iRobot_Create_mod.shtml

And another option would be to use a stepper motor
http://www.societyofrobots.com/actuators_steppers.shtml
Title: Re: sharp ir rangefinder
Post by: superchiku on March 31, 2008, 01:18:35 PM
AND HOW DO U MAKE UR ROBOT GUESS THE ANGLE

IS IT JUST MAKING THE ROBOT GO TO A POSITION HAVING THE BEST PROBABILITY OF FINDING UR OBJECT???
Title: Re: sharp ir rangefinder
Post by: nckspec on April 01, 2008, 01:58:24 AM
i read through the stampy code and the code has a sensor_angle variable and when is greater or less than some set numbers it determines where to turn. It pretty much keeps a record of how much it turns to guess the angle
Title: Re: sharp ir rangefinder
Post by: superchiku on April 03, 2008, 08:15:39 AM
sharp ir's can only tell the distance but not the angle i suppose, then how does the robot realise if it has to turn left or right in order to track the object
Title: Re: sharp ir rangefinder
Post by: Admin on April 06, 2008, 11:45:33 AM
superchiku, its in the tutorial:
http://www.societyofrobots.com/robot_sumo.shtml
Title: Re: sharp ir rangefinder
Post by: superchiku on April 06, 2008, 11:49:16 AM
ya i readt that  :P posted this a long time ago
Title: Re: sharp ir rangefinder
Post by: Rebelgium on April 07, 2008, 12:09:10 PM
ya i readt that  :P posted this a long time ago
4 days ago ... ?
Title: Re: sharp ir rangefinder
Post by: superchiku on April 07, 2008, 12:13:55 PM
lol long time for me  ;) coz time is valuable  ;D