Divide & Conquer
Seems like you’re starting from near zero knowledge, am I right? First robot?
Regardless, you need to get some basics on electronics first, also programming if you don’t know any yet.
1st- Start simple: Build the obiquitous obstacle avoider which can be later upgraded.
– If what stated above is your complete parts list, there is at least one big part missing: motor driver. This is needed to control the geared motors, which you can’t just directly connect to the arduino.
— you can either shell out some money and buy a motor shield that plugs into the arduino board, or just make one yourself. In the latter case electronics knowledge will be required.
As a side note, a micro servo where to mount the sonar module may be useful later for sweeping (sort of like a radar) and help with future mapping.
2nd- Once you get a basic obstacle avoider going you can start thinking about the mapping, and as Bajdi said wheel encoders will allow you to control/measure travelled distances. Also probably you’ll be wanting some form of persistant stored of those maps. I myself never delved into mapping so I can only suggest you search ( e.g. google ) on the subject, I’m sure there will be plenty of examples to choose from.
There’s lots of details I don’t mention here, however the main points I want to get across are:
- Learn your basics (electronics, programming, etc).
(NOTE: This point is VERY useful for asking specific questions, because nothing upsets more a potential helper than a person that can’t help him/her self. – I’ve highlighted some keypoints where it might be useful for you to do some research.)
- Start small & incrementally advance your project as you build your own knowledge