How did we get there?
After many failed attempts the most stable robot tracking was done with color detection. We also tried feature detection, channel filtering and led lights. I'll post another article on all the failed attempts. Here's how to do it right. This tutorial is written for Mac OS X. If someone can port it to windows, I'll gladly link to it.
1. Download all necessary frameworks and software
We will be needing this software:
- OpenCV - An image analysis framework
- Jaraco.nxt - A python library for communicating with the Mindstorms NXT robots
- Lego Mindstorms NXT-G software
- Sourcetree (with command line tools - my favourite) or another Mercurial client
- Our sumo arena software from our bitbucket repository
Below are all the installation steps.You can type them in a new Terminal window. I will assume you have nothing installed and start from a clean mac. I'm not sure if you need XCode for the compilers. I think you need it. It's free in the Mac App Store and has a great iOS simulator. The easiest way to install openCV is via homebrew, so we'll install that first. Next are some python libraries. If you like to work with python it's good practice to use virtualenv en virtualenvwrapper. I'll leave that out. Follow the links if you want to know more.
2. Get the hardware
You'll be needing this:
- Two sets of mindstorms NXT. I guess EV3 will do too. ;)
- 6 Omni Wheels. I got mine from robotshop, but others sell them too. Google some to find the cheapest in your area.
- A decent mac
- A decent webcam. We used a €20 Logitech c270 HD Webcam. 720p is the best resolution for this application.
- An arena. We used a second hand living room table, of which I removed the legs.
- A long USB extender cable to get from the ceiling to your mac
3. Build the arena and robots
The robots are based on the great RotaBot by HiTechnic (they sell omniwheels - rotocasters too). We added bumpers to the models and some room to put the markers. While you're there you might want to download the NXT-G programs for moving omnibots. They'll save you a lot of trouble.
4. Time to play!
Let me know if you succeed in building another sumo arena!