The 12-second video below shows my Lego robot in action.
As you can see, it’s a pretty simple program. The robot (whom I’ve dubbed “Procyon”) moves forward until he gets close to something, then backs up, turns, and keeps going.
A few things to point out:
1. I am not remote-controlling him. Procyon is doing this “on his own,” so to speak.
2. The program governing his behavior actually runs on my PC and controls him wirelessly via Bluetooth. As I described earlier, I’m using a third-party library to bypass Lego’s proprietary programming language and write code in C++.
3. Procyon can tell when he’s close to something by checking his ultrasonic sensor, which is that light gray T-shaped piece mounted on the front. Essentially, he navigates with echolocation, the same thing bats and whales use.
4. Although the behavior is pretty simple, programming it did present some challenges. The biggest challenge is that, when I send a signal like “Turn your wheels backward 720 degrees,” there’s no way to say “Wait for that command to finish before moving on with the program.” (At least, not that I’ve found yet.) I’ve got a workaround for now, but I’ll need to come up with a more robust solution as I get into more complex programs.
5. I haven’t yet given Procyon even a hint of real artificial intelligence, but that is my eventual goal.
But AI for Procyon – even a very simple, stripped-down model like the one I plan to start with – is still a long way off.
In the meantime, what other cool stuff could I program him to do?