Society of Robots
     | Robot Forum | Robot Tutorials | Robot FAQ |
Welcome, Guest. Please login or register.
Did you miss your activation email?
November 20, 2009, 10:00:25 PM

Login with username, password and session length
Search:     Advanced search
Sept 30th - The 5th SoR Robot contest is now open! Win an Axon II!

Robot Forum
72,667 Posts in 9,267 Topics by 5,292 Members
Latest Member: lepomis
* Home Help Help Login Register
0 Members and 1 Guest are viewing this topic.
Pages: [1] Print
Author Topic: a* tutorial, for beginners  (Read 5769 times)
AdminTopic starter
Administrator
Supreme Robot
*****

Helpful? 62
Online Online

Posts: 8,610



View Profile WWW
« on: February 03, 2008, 04:14:46 PM »

Another robot pathfinding tutorial:

http://www.policyalmanac.org/games/aStarTutorial.htm

Logged

neo01124
Jr. Member
**

Helpful? 0
Offline Offline

Posts: 46


View Profile
« Reply #1 on: February 06, 2008, 09:44:16 AM »

http://theory.stanford.edu/~amitp/GameProgramming/
Check this out as well, really interesting link 

Hey Admin i wanted to ask, isnt ur wavefront algorithm a special case of a* where g is set to zero?
« Last Edit: February 06, 2008, 09:46:18 AM by neo01124 » Logged
paulstreats
Supreme Robot
*****

Helpful? 12
Offline Offline

Posts: 1,248



View Profile WWW
« Reply #2 on: February 06, 2008, 04:28:43 PM »

Is there any advantage over using a standard wavefront style algorythm?

The only one that i can see is that it calculates for turning while you are moving. If you look at the diagrams, there is a faster way or a way to get to the goal in less steps then what is shown but this approach seems to work on the basis that it is faster to move through say 4 blocks instead of 3 to get to the goal because otherwise you have to stop and turn first
Logged
benji
Supreme Robot
*****

Helpful? 0
Offline Offline

Posts: 830



View Profile
« Reply #3 on: February 07, 2008, 04:57:41 AM »

nice links guys

the problem of these algorithms is that they consider that the size of an obstacle is the same size of the robot
Logged

good ol' BeNNy
HDL_CinC_Dragon
Supreme Robot
*****

Helpful? 5
Offline Offline

Posts: 1,252



View Profile
« Reply #4 on: February 07, 2008, 06:03:43 AM »

The only one that i can see is that it calculates for turning while you are moving. If you look at the diagrams, there is a faster way or a way to get to the goal in less steps then what is shown but this approach seems to work on the basis that it is faster to move through say 4 blocks instead of 3 to get to the goal because otherwise you have to stop and turn first
.... what? Are you talking about the picture above? Because the route plotted is the fastest route in that case. Explain your thinking a bit?
Logged
benji
Supreme Robot
*****

Helpful? 0
Offline Offline

Posts: 830



View Profile
« Reply #5 on: February 07, 2008, 03:29:35 PM »

Robots needs smooth paths,, not always shortest , another good link

http://www.gamasutra.com/features/20010314/pinter_01.htm
Logged

good ol' BeNNy
paulstreats
Supreme Robot
*****

Helpful? 12
Offline Offline

Posts: 1,248



View Profile WWW
« Reply #6 on: February 07, 2008, 04:18:22 PM »

A traditional wavefront would look like this:



But to actually follow the path, the robot would have to stop and and turn at the bottom of the blue pillar.

So, assuming that the robot is at a standing start, the following image would be better, There is 1 more square involved but the robot wouldnt have to stop which would save time even though its travelling a greater distance (it would also operate more smoothly)



The following would be more realistic though to make sure that the bot didnt bump into the corners

« Last Edit: February 07, 2008, 04:21:55 PM by paulstreats » Logged
HDL_CinC_Dragon
Supreme Robot
*****

Helpful? 5
Offline Offline

Posts: 1,252



View Profile
« Reply #7 on: February 07, 2008, 08:31:48 PM »

It would have to turn the same amount of times though.
In both pictures, assume that the bot is already facing the bottom of the image.
Original path:
It would drive forward 1 square(1s,0t). Then turn 45deg to its right(1s,1t). Then drive forward 1 square(2s,1t). Then turn 45deg to its right(2s,2t). Then drive forward 2 squares(4s,2t). Then turn 90deg to its right(4s,3t). Then drive forward 1 square(5s,3t). Then turn to its left 45deg(5s,4t). Then drive forward 1 square(6s,4t).
So for the first path, it had a displacement of 6 squares and turned four times and turned 225 total degrees. And with your suggested path:

Suggested path:
It would drive forward 1 square(1s,0t). Then turn 45deg to its right(1s,1t). Then drive forward 1 square(2s,1t). Then turn 45deg to its right(2s,2t). Then drive forward 2 squares(4s,2t). Then turn 45deg to its right(4s,3t). Then drive forward 1 square(5s,3t). Then turn to its right 45deg(5s,4t). Then drive forward 1 square(6s,4t).
So for the second path, it had a displacement of 6 squares and turned four times and turned 180 total degrees.


You win Smiley My bad >_< Sorry to have doubted you Paul Sad
Logged
benji
Supreme Robot
*****

Helpful? 0
Offline Offline

Posts: 830



View Profile
« Reply #8 on: February 08, 2008, 08:09:55 AM »

you can have a path similar to the one generated by the A-STAR by modding the wavefront a little bit

1- you check for all adjacent squares( all the 8 )
2-when there is an obstacle to the right you dont take the squares ( south-right nor north-right )
 -same goes for all directions

step 1 to let robot move with angle 45
step 2 to not bump into the wall (just like paul's pics)

it seems to work like the A* exactly,, still not sure,,but the problem here is that this would take more computational time
Logged

good ol' BeNNy
benji
Supreme Robot
*****

Helpful? 0
Offline Offline

Posts: 830



View Profile
« Reply #9 on: February 08, 2008, 09:35:05 AM »

sorry guys , it seems it started to fail, i even tried to give a weight of 1.4 to 45 degrees transitions but it still bumps into corners
actually the first step works fine , the problem is in the second step
,,lookslike we still need the A* one Grin
Logged

good ol' BeNNy
paulstreats
Supreme Robot
*****

Helpful? 12
Offline Offline

Posts: 1,248



View Profile WWW
« Reply #10 on: February 08, 2008, 04:18:12 PM »

I think that there is a difference between the a* and the wavefront systems.

The difference is that the a* seems to be made to accomplish several things in 1 routine Wheras wavefront is there just to literally find a path.

 I would personally go with a wavefront to produce the initial results, and then translate those results into something more realistic.

 Its like modern day computing vs old day computing. In the old days 1 program was built to accomplish everything that was required(a*). These days individual programs are made that work together to produce the result(a basic wavefront would be one of these programs)
Logged
benji
Supreme Robot
*****

Helpful? 0
Offline Offline

Posts: 830



View Profile
« Reply #11 on: February 09, 2008, 03:07:27 PM »

but the wavefront fails also when you make 45 degrees movement available
(or it works only to find the shortest path only)
you cannot add any other conditions, so in robot navigation it fails because in case of robots you neeed to add other conditions in the algorithm
like making sure that there is enough space for the robot bodyalong the path
(im considering that the robot body occupies more than one square thats because i dont want to treat a small obstacle the same as the robot body).
considering any small obstacle the same size as the robot then the wavefront alone with no added conditions would do
but this would be very basic ....u know,, a big robot would cancel possible paths because of a tiny obstacle Huh?? thats a lil stupid
Logged

good ol' BeNNy
benji
Supreme Robot
*****

Helpful? 0
Offline Offline

Posts: 830



View Profile
« Reply #12 on: February 15, 2008, 09:08:54 AM »

Admin, do you have the algorithm to make the wavefront capable of making diagonal movements?

i tried but i couldnt get it to work ....
Logged

good ol' BeNNy
AdminTopic starter
Administrator
Supreme Robot
*****

Helpful? 62
Online Online

Posts: 8,610



View Profile WWW
« Reply #13 on: February 17, 2008, 08:39:07 AM »

Yes, a wavefront can do 45 deg motions. It will of course be much more computationally expensive, in return for a more optimal robot path. My wavefront code, with minor modifications, can be made to work. Use my simulator code to test your modifications.

What many of you guys are discussing is called cost of motion. There are various algorithms out there that find multiple paths (not just one solution), calculate the cost of motion, then tell the robot to take the path with the lowest cost of motion. Whats great about this is that you can not only account for number of turns, but also terrain - hills, mud, etc.

One day I'll write a tutorial on it . . . but for now, here is some stuff for those who are interested to search and read up on:
accessability, departability, connectivity, and visibility graph maps
cell decomposition map
adjacency graph

Each of those maps will find multiple paths, then your robot can choose the optimal one.
Logged

benji
Supreme Robot
*****

Helpful? 0
Offline Offline

Posts: 830



View Profile
« Reply #14 on: February 17, 2008, 10:00:23 AM »

Quote
with minor modifications

 Embarrassed couldnt get it to work diagonally
Logged

good ol' BeNNy
AdminTopic starter
Administrator
Supreme Robot
*****

Helpful? 62
Online Online

Posts: 8,610



View Profile WWW
« Reply #15 on: March 16, 2008, 07:49:51 AM »

A friend of mine, who doesn't do robots but instead game programming, sent me this neat A* demo:

http://www.societyofrobots.com/programming_nav_a_star_demo.shtml

(yeap, robot navigation algorithms are heavily used in video games)
Logged

benji
Supreme Robot
*****

Helpful? 0
Offline Offline

Posts: 830



View Profile
« Reply #16 on: March 16, 2008, 07:58:11 AM »

nice demo
Logged

good ol' BeNNy
benji
Supreme Robot
*****

Helpful? 0
Offline Offline

Posts: 830



View Profile
« Reply #17 on: March 17, 2008, 04:59:22 AM »

by the way, under what catagory is the A* catagorized?
Logged

good ol' BeNNy
Pages: [1] Print 
Jump to:  


Related Topics
Subject Started by Replies Views Last post
beginners
Electronics
rahulvyas10 2 2399 Last post October 01, 2006, 11:01:32 PM
by Handmixer.com
Good article for beginners in microproccesor programing
Software
JesseWelling 3 2558 Last post January 05, 2008, 06:23:29 AM
by dunk
BEGINNERS - READ THIS FIRST!
Misc
Admin 2 10682 Last post July 14, 2007, 07:28:53 AM
by Admin
MOSFET tutorial for beginners
Robot Videos
Admin 2 4578 Last post December 19, 2008, 08:29:40 AM
by Admin
Powered by MySQL Powered by PHP Powered by SMF 1.1.10 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!


Advertise on this Forum