Page 1 of 1

### Where do you start to create logic like a Roomba

Posted: Thu Aug 14, 2014 6:55 pm
Where do you start , read or whatever to create logic like a Roomba?
Those things have avoidance, maps that memorize rooms and the ability to
get there and back. Are there any online dummy books for this logic?
I have a concept for a vacuum and want to know if its even possible
before I put any effort into it.
Thanks,

### Re: Where do you start to create logic like a Roomba

Posted: Thu Aug 14, 2014 7:34 pm
Are there any online dummy books for this logic?
No.
It is like asking 'where can I get a dummies book for surgery'.
You are talking about a very sophisticated device which will have lots and lots of SW inside.
You need a lot of knowledge before making a 'map building, remembering and obstacles avoiding' robot.

I strongly suggest you start with simple robot challenges and build up from there.

### Re: Where do you start to create logic like a Roomba

Posted: Fri Aug 15, 2014 12:30 am
Gert is right!

There is a lot of software to figure out where you are.

But I'm on my fourth Roomba, They last 3 to 4 years! . I resell them before they died.

The Roomba , as far I know, doesn't use a mapping system. It does figure out the dimension of the room. But I could assure you that the roomba will missed some floor space. Since it is running every day , eventually the missing area will be swept.
I think is more or less some kind of fuzzy logic using different patterns to maximize the surface and obstacles but often I returned from work and I have to put both roombas, one for each floor level, on their stand. This mean that they don't know their exact location and they can't see the base station beam to run to it.

Maybe you should start with motors drive and wall detection first and add sensor one by one.

I did post and a video on my old roomba 400 series (I still have a 430 running). I was using a webcam with the I.R. filter removed. This way you could see the floor sensor in action.

This is the video
https://dl.dropboxusercontent.com/u/488 ... roomba.wmv

This is the full post (In French)
http://www.raspberrypi.org/forums/viewt ... 09#p463609

B.T.W. The 400 series had an advantage from the newest models. You could power them ON by I.R. remote. The I.R. remote works on the newest models but you canâ€™t turn them ON. Some do have however a Xbee RF transmitter.

regards,

Daniel

### Re: Where do you start to create logic like a Roomba

Posted: Fri Aug 15, 2014 7:24 am
There's an old, but still very interesting, document here:
http://www-personal.umich.edu/~johannb/ ... s_rprt.pdf
(it's too long, just start by looking for the dead reckoning/odometry section)

Of course it doesn't cover the sensors available today, but still worth a read.

Some people have built arduino based "radars" based on Sharp IR rangefinders. You might want to search around for something like that...

Also search around for David Anderson's IMU odometry pages for his jBot and nBot robots.

### Re: Where do you start to create logic like a Roomba

Posted: Fri Aug 15, 2014 4:34 pm
danjperron wrote:The Roomba , as far I know, doesn't use a mapping system. It does figure out the dimension of the room
This is my understanding as well.

The Roomba is very hacker friendly with a serial port where instructions can be sent and sensors read. With a pair of microcontrollers and cheap nRF24L01+ modules I used a PlayStation 2 controller to make our Roomba remote controlled.

One of my future robotics projects is to add three IR LEDs to the Roomba and you a camera from a WiiMote to monitor the location of the Roomba. I'm thinking with an externally located camera monitoring the Roomba's location, it would be easier to control the path of the robot. Of course this is all easier said than done.

Roomba's are great robotics platforms. You just send it commands of how fast you want to travel and what radius to turn and it takes care of driving the motors for you.

### Re: Where do you start to create logic like a Roomba

Posted: Fri Aug 15, 2014 6:48 pm
If you're wondering about the sensors, read up on robotics. Bump sensors, drop-off sensors (reflective sensors), range finders, and so on are pretty common. To detect whether it's hitting a lot of dirt, I believe it uses a piezoelectric sensor. The wheels have encoders so that it can determine how far each has gone and whether one (or both) is stuck. The sensors, I think, are the easy part.

As others have said, the Roomba does not map out the room. It estimates its size by taking random turns and making long runs, and it uses the longest run that it can make to estimate the size of the room, and uses that estimate to determine how long to continue cleaning. I would assume, without having checked, that it assumes that the room is roughly square and the longest run is approximately the diagonal across that square, or a little shorter. By determining the area and dividing by the width of the beater bar, it can estimate how long a perfect run would take to cover the floor. It should then multiply by some factor and use that to determine how long its run should be. This is all my guess based on my little research and observing how mine worked before the battery died. At least that's how I'd probably do it, and then run many many tests to determine what that factor should be and whether it works well. I would expect that you could do this with an Arduino. A Pi would certainly be overkill for this job.

If you wanted to create a map of the room, you would probably have to assume that it would be at least a bit inaccurate due to wheel slippage, moving obstacles, unknown impact angles, etc, but I wouldn't think that it would be too terribly difficult to try. I'd probably make a large grid to represent the room with low accuracy, start in the center of it, and measure how many grid spaces I can travel in one direction. When I hit something, I'd mark the grid that there's an obstacle there, turn, and try another run, marking the map each time I hit something. This would eventually create a rough map of the room. Problem is, if you get bumped just a fraction of a degree out of alignment, pretty soon the map will be useless, which is probably why Roomba doesn't bother. This would also require far more memory and processing power than a simplistic random model.

### Re: Where do you start to create logic like a Roomba

Posted: Sat Aug 16, 2014 7:06 pm
I have seen a cheap room a clone perform admirably and all it seem to do was something along the lines of.

Go forwards until bumb
Turn x degrees
Turn forward until bumb

Its slight bit more complex but you could easily start there. It had 3 bumb switches on the front middle, right and left. If it hit head on it would then 90 degrees. If it hit on the right it would turn ever so slightly left then go forward then hit on the right sensor then go ever so slightly left again.

I'd start with the 3 bumb sensors and work from there adding in a range finder and maybe something to stop it going over the stairs.

You could always use iBeacons to help with the mapping. We use those for internal mapping at work and they are a few quid a pop these days.

### Re: Where do you start to create logic like a Roomba

Posted: Sat Aug 16, 2014 7:12 pm
This is basically what I have seen from cheap robot vacuums.
http://electronics.howstuffworks.com/ga ... acuum2.htm

### Re: Where do you start to create logic like a Roomba

Posted: Tue Aug 19, 2014 6:10 am
This tutorial was of great help when I was developing route navigation algorithm for my robot boat. Using this approach it was quite easy to implement complex route navigation logic such as:

- If current leg is not set or if the robot is near current leg end, switch to next leg in the course
- If the robot is far from current leg centerline, try to approach leg asap
- If the robot is near leg centerline, orient the robot to leg heading
- If the robot is near leg center with correct heading, try to keep leg course while minimizing cross-track error
- Etc. etc.

Trying to write such logic with if/then/else is pure hell, but surprisingly easy using behavioral pattern as described in the tutorial.