I know what you’re thinking.

*Why can’t my vacuum do a bunch of random tasks such as wall following, person tracking, obstacle avoidance, and localization via point clouds?*

It’s okay friend , we’ve all been there. Lucky for you if you enroll in Olin college and take ENGR3590-01:A Computational Introduction to Robotics, you can do all this yourself. All with the help of this little guy right here:

By plugging in a raspberry pi into one of these you can both get the readings from its blue laser scan on top and send commands to its wheels to make it drive around. The entire class is based around using these cute buggers to learn and focus on the computational aspect of robotic (if you couldn’t tell from the name).

I’ll briefly go over some of behaviors I coded for the Neato in the rest of the post. BUt you can see most of the behaviors in this video:

The next part will probably be pretty technical.

### Wall Follower

The premise of this is simple, look for a straight line in the environment and follow it. It’s basically implemented by grabbing the closest points and matching them to the expected scans from the LIDAR as if there were a tangential line. So, if the closest point of a wall was at angle 0, the expected scan would look something like this:

By setting a threshold for how much the recorded scans match up we can tell the direction, distance, and confidence of the nearest wall. We can then define a proportional controller to follow the nearest wall at a desired distance.

### Person Tracking

This one was a bit trickier. For this, we wanted to track a person moving in the environment and follow their path as we do. To initialize we continually take the center of the laser scans directly in front of the Neato, if this mean is different enough (i.e. there is movement) we begin our programs and continually update the mean based on the nearest particles around. This way, as the program runs, the correct particles will be found by the previous mean and the new mean will be computed from there. The Neato can then follow this path to track the person. Of course there were a lot of details and additions to make it robust but that’s the basic idea.

### Obstacle Avoidance

This one was pretty simple. Basically just drive until you detect and obstacle, turn and drive until it’s not there anymore, then continue.

### Finite State Controller

The final physical behaviors, the finite state controlled is a behavior that alternates between wall following and person following via bump detection (as shown in the chart below).

This way, the Neato can be wandering around, following walls and follow a person whenever needed and return to the wall when done.

### Localization

For a non-physical challenge we looked at the problem of localization (or kidnapped robot problem) , that is find where you are in a map given input data. A simple implementation of this involve having a bunch of “guesses” as to where we are and refining those guesses over time to get a better idea. So we may start off with a general approximation as to where we are (as shown below) and refine that guess.

‘As the robot moves, we move each of these points, define which points are the most likely to be correct, keep the best ones, and initialize new points around those. By iterating on this method, we get a better and better approximation as to where the robot is and get an accurate (or not) answer.

This is nice and all, but you may notice this first requires an approximation of the Neato’s position. What if we don’t have that? Well, we could just initialize points all over the map.

Need I point out the flaws in this strategy? The points are so spread out that there isn’t even a point near the true position. Even if we constrain the points to be around the map we may still run into this problem. We combat this problem in a simple was: **use a lot of points**.

Instead of using 300 points, we used 20,000.

Yes this comes at a price.

For many implementations, the merit of any individual points can be determined by a complex scheme of matching laser scans and exploring the surrounding environment. But, in order for 20,000 points to work we need to optimize at every step. So, instead we weight each point only by the distance to the closest obstacle (which can be computed efficiently ahead of time). By comparing that to the nearest distance via the input laser scan, we efficiently compute the value of all the points and can afford to use a boatload of points. And, in practice we found that this method works rather well, although it does not scale as well with map size.

That pretty much sums up my projects for the first half of Comprobo. There was a lot of detail that I missed on every single part, so if you’re interest feel free to reach out!