CS 371 - Cozmo Project Documentation

Introduction:

The goal of this project to simulate the "Kidnapped Robot Problem" via implementing Monte Carlo Localization using an Anki Cozmo robot. It uses the built-in camera and movement options of the robot to gather optical information from its surroundings, which it will then use when it is "kidnapped" to re-find where it is.

We originally started with a bit of help from a prior class's work, and their credits (as well as ours) are listed in the corresponding section.

Goals:

Localization Process Outline:

Computer Setup:

Mobile Phone Setup:

Code:

Here is a .zip file containing our code.

Conclusion

Our implementation wasn't able to get the robot to fully localize. We believe we have a better implementation of Monte Carlo Localization than the last team's version, but we also believe we've given our algorithm too little optical information to accurately determine where it is, only giving it a column of pixels' worth of information rather than a whole image. The reason we did that is because we weren't able to find a way to have the image sampling wrap around if it begun near the end of the panorama image. To do that, we'd need to tack on an "extra image" onto the end of the panorama image.

On a more positive note, it does run through the algorithm much faster than before. We've applied image downsampling to the panorama shot and the reference images that the robot takes during its localization process in order to cut down on the computational load of the localization algorithm. In addition, we've implemented binary search on the new population member selection process, as we noticed that the old iteration was terribly slow at picking new members. Finally, we've also used the "numba" module of Python to run the image processing code on the user's device's GPU, allowing us to do the computations faster than on its CPU.

Future improvements:

First off, the next group to work on this should find a way to get the wraparound working, or find some other way to do it. One idea we had ocme up with (but didn't have time to test) was to convert both a panorama image and a little bit of duplicate data from the start of the panorama into arrays and concatenating them together somehow, since you can't stick 'em together with opencv's Stitcher this way. Then, you could take samples of the size of a standard Cozmo camera image.

Second, there are probably some issues with the way we calculate the final best guess at the end of the localize method. It's also largely untested and we're unsure if it reliably calculates the median point of the remaining members of the initial population, and you might need to fiddle with the cutoff to either keep more or less members to get a more accurate final result.

Another thing you could do is some image manipulation to make the panorama shot's left side actually represent the point where the robot looks while taking its first "stitchpic"; i.e., "0 degrees". Currently, the approximate center of the image is the "0 degree point." Failing that, you could possibly put a marker on the panorama image itself to make it clearer to the user where the robot believes it's looking.

Once all that is done, further optimize the code. Fast (working) code is always good.

Credits:

  • Authors of current iteration: Charlie Dale, Raquel Delgado, and Ben DelBaggio
  • Authors of first iteration: Nick Weinel, Charlie Stewart, Matt Ainsworth, Jake Poff, and Parker Sorenson