Monday, May 17, 2010

Arduino Fun

Started playing around with my Arduino today. Got it working with the ultrasonic sensor, super impressed by how easy it was to set up and test stuff. USB interface and quality (and open-source) software package makes things so easy! Probably had the ultrasound returning calibrated distance data to the computer screen within an hour of taking the Arduino out of the box. Something tells me the PIC with homemade programmer and freeware software will not be as easy.

Next I started playing around with some of the math functions to see what my options are in terms of room mapping algorithms. A sine calculation takes about 10ms, which will be a serious barrier. I need this one because I will know what direction the robot is facing (relative to the room frame), and how far a wall or object is, so to plot it on a room-frame map I will need to take the sine.

After pages of drawing and discussions, my brother and I formulated a potential algorithm for mapping and vacuuming. Let me try to explain (see the diagram):


  1. The robot rotates 360 degrees to scan the room where it starts. The area it can see (un-occluded) is shown in grey. It will see mostly walls (or beds or tables) and then a small gap which could be a doorway, space between desk and bed etc. This gap is represented by a dotted line.
  2. The robot positions itself near the gap and scans around 360 degrees. Either it will fill in the gap (maybe this was a small, open closet) or the gap will remain open (eg. doorway, large space). If the gap remains open, it is marked as a doorway, and the room inside the doorway is marked for cleaning. If it is closed, the new area enclosed is also marked for cleaning.
  3. The robot then cleans the "room" that it has identified.
  4. If there is one "doorway" (dotted line), the robot drives through and scans the new "room". If there are multiple, it notes the location of all of them, and then chooses the closest one in its bank of un-scanned doorways to drive through and scan.
  5. This process is repeated until batteries run out.
Essentially what is happening is the robot will partition the room in real time as it discovers it, and clean small portions at a time. This is similar to the way a human would clean a carpet or floor.

Some drawbacks I see (I'm sure I'll discover more as I go along):
  1. Could be tricky if the room is very large or open. It may be possible for the robot to spend all its battery energy attempting to enclose an area for cleaning, without doing any of the actual cleaning.
  2. Doesn't take advantage of the fact that the room generally will look the same from week to week. There is very little storage and reuse of maps.
  3. Representing the room in the robot's memory will be tricky. Currently my plan is to overlay a grid on the room, and have the robot identify which squares are occupied by walls, tables, etc. and which need cleaning. Memory usage will be inversely proportional to the resolution required (which I think will be around 10-15cm square).
And a couple advantages:
  1. Rooms are cleaned in segments. This way when the robot runs out of battery, at least contiguous sections of the house are all clean.
  2. Low processing requirements. The toughest computations will be: calculating the position of ultrasonic identified objects, determining if walls are connected or if there is a doorway, and choosing a path through the room to clean all open the floor space.
-Mike

No comments:

Post a Comment