Society of Robots - Robot Forum

Software => Software => Topic started by: mlandergan on April 15, 2011, 08:25:36 PM

Title: Wavefront Mapping with Arduino?
Post by: mlandergan on April 15, 2011, 08:25:36 PM
Hi I am somewhat new to robotics. I am currently building my own E.R.P (experimental robotic platform). The robot plate form is a tank kit. You can find it here: http://www.robotshop.com/dfrobotshop-rover-tracked-robot-basic-kit.html  (http://www.robotshop.com/dfrobotshop-rover-tracked-robot-basic-kit.html) Built into this robot, there is a temperature and light sensor that I am planning on using. So I was thinking of what to add software wise to my robot and I came across the wavefront tutorial http://www.societyofrobots.com/programming_wavefront.shtml (http://www.societyofrobots.com/programming_wavefront.shtml). My question is how I could interface this algorithm with my robot, if possible. I have a ping))) ultrasound sensor, but no servor to make a sweeping sensor. First of is this possible and if so, how would I go about doing so?

Any code, help or guidance will be much appreciated.

-Mark
Title: Re: Wavefront Mapping with Arduino?
Post by: rbtying on April 15, 2011, 09:44:02 PM
Make some encoders http://www.societyofrobots.com/sensors_encoder.shtml (http://www.societyofrobots.com/sensors_encoder.shtml) and attach them to your wheels - you can rotate the bot to replicate the servo scan (albeit inefficiently) and you'll want encoders for dead reckoning anyways. 

Do you know how to code in C/C++, and are you familiar with the Arduino IDE/toolchain (or whatever you're using)? 

You will also want to clarify your goals - wavefront isn't as easy as, say, obstacle avoidance, and depends partially on being able to get a decent angular resolution for each distance measured (this means that your sonar is probably not going to work out too well, as its field of view is huge as compared to a Sharp IR rangefinder).
Title: Re: Wavefront Mapping with Arduino?
Post by: mlandergan on April 16, 2011, 06:02:41 AM
Make some encoders
This seems like a great idea, I will work on this soon.  


Do you know how to code in C/C++, and are you familiar with the Arduino IDE/toolchain (or whatever you're using)?
I would say that I am an intermediate at c, but I don't know too much about c++. But I keep on learning\ and looking at examples.



You will also want to clarify your goals - wavefront isn't as easy as, say, obstacle avoidance, and depends partially on being able to get a decent angular resolution for each distance measured (this means that your sonar is probably not going to work out too well, as its field of view is huge as compared to a Sharp IR rangefinder).

My ultimate goal is to have a robot that can map out it environment, ovoid objects, and follow a line. I am going to take the simplest one and work my way up to mapping. If sonar won't work well then I purchase a sharp IR rangefinder. I was going to use a sonar because I have it lying around. Thanks for the response

-Mark
Title: Re: Wavefront Mapping with Arduino?
Post by: rbtying on April 16, 2011, 09:13:39 AM
The simplest one for you right now is probably object avoidance.  You will need to interface with your sonar sensor to find the distance to the nearest object in its field of view (in this case pointing straight forwards is probably the best), and turn to one direction or another when the distance threshold is breached. 

Psuedocode:

Code: [Select]
// ... read the sonar code
sonar_reading_cm; // store the sonar value here
if (sonar_reading_cm < THRESHOLD) {
  setLeftMotorSpeed(-speed); // causes a leftward turn
  setRightMotorSpeed(speed);
} else {
  setLeftMotorSpeed(speed); // causes it to drive straight
  setRightMotorSpeed(speed);
}
Title: Re: Wavefront Mapping with Arduino?
Post by: Admin on April 16, 2011, 09:22:08 AM
The Arduino doesn't have enough memory to effectively do wavefront beyond a single small uncluttered room. You'll need either an Axon or Arduino Mega. :P
Title: Re: Wavefront Mapping with Arduino?
Post by: mlandergan on April 16, 2011, 09:46:01 AM
To: Admin

I have two arduino uno's, if there is a way to create such a slave/master thing, will it then have enough?

Thanks
-Mark
Title: Re: Wavefront Mapping with Arduino?
Post by: Admin on April 16, 2011, 09:59:37 AM
For how big a map? Hmmmm thinking about it some more . . .

Your best bet would be to save the data to EEPROM, using 1 bit per datapoint in a large matrix.

The ATmega328P has 1kb EEPROM, or ~8000 bits of storage space.

So if your map resolution is 9 bits per square foot, you'll have decent resolution to see chair legs. That means you'll have 8000/9 = 888 square feet of a map to use. Thats about the size of ~2.5 rooms.

The Axon and Arduino Mega (both basically use the same microcontroller) has 4kb EEPROM, giving you 4x more mapping space (ie enough for a house).
Title: Re: Wavefront Mapping with Arduino?
Post by: Ro-Bot-X on April 16, 2011, 11:43:04 AM
If you have 2 Arduinos, then I suggest to use one just for mapping ant the other for driving, line following, etc. This one would be the Master, reading most of the sensors, deciding the action. Using TWI (I2C) interface, it can ask the Slave to look on the map, calculate the path, etc. The Slave would have a scanning servo and sensor to be able to create an object map or verify the robot's position by measuring distance to known objects and triangulating. A good help would be a compass sensor, because the robot must know it's orientation on the map and, as said before, encoders, to be able to measure traveled distance (not absolutely necessary if you're working on a known map, compass and triangulation is enough). This is similar with my MiniEric (http://www.societyofrobots.com/robotforum/index.php?topic=7106.0) robot, an ongoing project, I just never got to the point of mapping with it.
Title: Re: Wavefront Mapping with Arduino?
Post by: rbtying on April 16, 2011, 11:45:53 AM
You could use an SD card via the SPI protocol to store your map - even the smallest SD card is >= 16mb, and has more than enough space.  It will be slower and require more programming, though.
Title: Re: Wavefront Mapping with Arduino?
Post by: mlandergan on April 20, 2011, 06:44:25 AM
To Ro-Bot-X: How does  TWI (I2C) interface work? Do I connect the arduino's together via a wire?

Thanks for all the responses
-Mark
Title: Re: Wavefront Mapping with Arduino?
Post by: Ro-Bot-X on April 20, 2011, 03:56:02 PM
Read here (http://www.arduino.cc/en/Reference/Wire) and look at all the links from here (http://www.arduino.cc/playground/Main/InterfacingWithHardware#i2c).
Title: Re: Wavefront Mapping with Arduino?
Post by: BradleyK on May 08, 2011, 07:09:06 PM
hi,
i have done the wave front on an arduino, i am just have added a 256kbit eeprom to be able to do larger rooms,
it work great,
Title: Re: Wavefront Mapping with Arduino?
Post by: Ghostrunner on October 05, 2012, 06:20:37 AM
@BradleyK:

Could you tell me a little bit about your setup. I'm just starting to look into this, And it would be cool with some pointers.
You say you got it working

Rasmus