best method to calculate location on robot

im gonna be making a robot, but i need an accurate method(s) to calculate its location, gps is too expensive(unless i used my android phone), i could use an accelerometer, but what would be the best way

What kind of environment are you going to be operating this robot in? How fast / how far do you intend for it to travel?

it terms of distance, thats infinite(kinda) it will operate indoors on mostly tile and maybe some hard carpet(like classrooms), i want to be able to upload "maps" from my Linux laptop to my arduino bot via Bluetooth, and then i want it to be able to navigate through that map without having to go to some sort of landmark every 30 seconds

in terms of speed, well, not very fast

Well, GPS is going to give you a sphere that your robot is inside. Let's ignore altitude and pretend we're just dealing with a 1-story layout -- or that when you push a map onto the robot it'll include "you're on the 2nd floor" -- that simplifies the problem a lot and gives you circle you're inside.

Now that you know you're inside the circle - but that circle is pretty large in terms of being able to take a right at the end of the hallway and not smack into a wall. So at that point you need something further to get you a better fix.

Sonar might be a good answer, depending. Say the robot is in a hallway - the circle plotted by GPS says it might be in the classroom on the left side of the hall or it might be in the hallway. Pointing the sonar to the right and left and pinging the walls could allow it to fix its position as being in the hallway, not the classroom. Moving towards a known or suspected corner and pinging the walls and applying some trig can help fix your position. Or even (gently) bumping into a wall and then following it to the corner.

If you can decorate the walls with barcodes then it could read one of them to get a fix at a known position.

Counting wheel rotations can help it determine how far it has traveled and know when to start looking for the next known obstacle to avoid. If you're going fast or are on a material where the wheels slip you'll lose some precision though.

Maybe you could use the optics from an optical mouse on the bottom of your robot to help determine how far you've gone.

Needless to say this is not a simple problem. Every time your robot moves additional uncertainty about its current position enters the equation. So if you want to to be able to navigate autonomously then frequently taking advantage of situations where it can get a KNOWN position (corners, optical markers, whatever you can come up with) will help keep it from getting lost.

ok, 2 questions, 1: what about an accelerometer, and 2: what would be the best landmark for the robot?

An accelerometer could be tricky to use. If you know the orientation of your robot as by a compass reading or aligning to a line drawn on the floor for this purpose or flatting up against a wall then you could, presumably, use data off of an accelerometer to note your rate of acceleration, calculate your velocity from there, and then measure time to see how far you've gone. Counting wheel revolutions might be easier.

As to what to use for a landmark, I think that would depend on your operating environment and what you can reasonably do in it. Walls are good because they'll let you fix your location definitively along one axis. Corners are great because you can fix along two axises. Wall-mounted IR LEDs blinking a location code could be quite handy. There are lots of ways to attack the problem.

ok, then my best bet would be: to to use 2 front wheels not connected to motors with a strong grip, and put 2 optical mice on the top part of the wheels to monitor the bot's speed

and of course use landmarks

Wheel rotations are probably a good way to go. Some 2[ch960]r magic and you can convert them to distance traveled. Maybe a rotary encoder instead of an optical mouse would be easy to go.