Shop OBEX P1 Docs P2 Docs Learn Events
Robot navigation around an object — Parallax Forums

Robot navigation around an object

ArchiverArchiver Posts: 46,084
edited 2002-08-12 02:54 in General Discussion
Hi all: I have a small robot with a range finder on the front. What I want
to do if I sense an object is
1)stop
2) rotate 30 degrees left, take a range reading and store it
3) rotate 15 degrees left, take another reading store it
4) rotate back to center or 0 degrees, take a reading store it
5) rotate right 15 Degrees etc
6) rotate right 30 degrees etc.
When I am done with range readings I may have a string, or table that looks
like the following in inches.
100,110,10,30,90 with 100,110 being left, 10 being the center, 30 and 90
being right.
I then want the robot to perform some logic on those 5 numbers and determine
that the left hand direction is the best direction to turn, because there is
a range of 100 inches that direction.
My problem is I am stumped on how to actually program this.
I know I can store values in a string, but how do I search on the string,
find the highest value, and then know what degree setting of a compass that
value is, to turn the robot in that direction. The first 100 value for
instance may indicate the robot would have to turn 30 degrees left and move
forward. An if-then sequence seems horribly messy at best, I can't figure
out if branch or lookdown tables will help me either.
My robot works like a tank, I send power to motors in a timed manner to
determine how many degrees I rotate. There is no position feedback, but my
theory should still work, albeit wheels spinning etc. I had thought I could
just change the time/turn variable of the motor's depending on the range
value that is best for movment forward. If position one in my table(value
100) then turn 30 degrees left etc, BUT how to come up with which of the 5
positions is best?
If anyone can give me some pointers on how to program this I would
appreciate it.



Very respectfully, your obedient servant.
Kerry
Admin@M...
WWW server hosting [url=Http://mntnweb.com]Http://mntnweb.com[/url]
Kerry Barlow
p.o. box 21
kirkwood ny
13795
607-775-1575

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2002-08-12 02:54
    You are making it too hard.

    Just have the robot scan from left to right and only record the position
    where it measures the farthest distance on the ranger. You turn the robot
    that direction and go.

    Original Message

    > Hi all: I have a small robot with a range finder on the front. What I want
    > to do if I sense an object is
    > 1)stop
    > 2) rotate 30 degrees left, take a range reading and store it
    > 3) rotate 15 degrees left, take another reading store it
    > 4) rotate back to center or 0 degrees, take a reading store it
    > 5) rotate right 15 Degrees etc
    > 6) rotate right 30 degrees etc.
    > When I am done with range readings I may have a string, or table that
    looks
    > like the following in inches.
    > 100,110,10,30,90 with 100,110 being left, 10 being the center, 30 and 90
    > being right.
    > I then want the robot to perform some logic on those 5 numbers and
    determine
    > that the left hand direction is the best direction to turn, because there
    is
    > a range of 100 inches that direction.
    > My problem is I am stumped on how to actually program this.
    > I know I can store values in a string, but how do I search on the string,
    > find the highest value, and then know what degree setting of a compass
    that
    > value is, to turn the robot in that direction. The first 100 value for
    > instance may indicate the robot would have to turn 30 degrees left and
    move
    > forward. An if-then sequence seems horribly messy at best, I can't figure
    > out if branch or lookdown tables will help me either.
    > My robot works like a tank, I send power to motors in a timed manner to
    > determine how many degrees I rotate. There is no position feedback, but my
    > theory should still work, albeit wheels spinning etc. I had thought I
    could
    > just change the time/turn variable of the motor's depending on the range
    > value that is best for movment forward. If position one in my table(value
    > 100) then turn 30 degrees left etc, BUT how to come up with which of the 5
    > positions is best?
    > If anyone can give me some pointers on how to program this I would
    > appreciate it.
Sign In or Register to comment.