Once inside the GoPiGo folder, double click the Projects folder, and finally double click the AgentKK folderAllow me to appeal to the kid in you.
Younger siblings -- gross! They sneak into your room and grime up your stuff. Sometimes you might also feel that way about your spouse. Babe, get your greasy mitts off my sunglasses.
What you need is a sentinel, a guardian, a robot defender. This latest project comes to ZDNet via Dexter Industries, which makes cool components for DIY robotics builds. I have no affiliation to Dexter, but I dig what they do and I'm happy they've brought us a new build.
Build and program this little GoPiGo to protect your wardrobe, your closet, or your whole room. Hide GoPiGo behind a closed door and when the door is opened it will attack, scaring intruders and snapping a picture as proof that your inner sanctum has been violated.
You can choose to use any of the last three items, or all of them, or none of them. The more you use, the better the protection, but if one is not available, it's not a deal-breaker. The Guardianwill guard without it.
If this is your first project with GoPiGo, take a look at the Getting Started pages before implementing this project.
Agent KK, your mission, should you choose to accept it, is to assemble the Guardian following these steps. We will deny all knowledge of your mission (but if you have questions, feel free to contact us).
The code for this project is available for both Python and Scratch. Use "DI Update Software" to get the latest versions of our projects (you can find this script on your Raspbian for Robots desktop). Depending on which version you want to use, choose one of the following two methods to access the code. Just don't execute the code right away as our Guardian is not in position yet.
Scratch:
Launch Scratch through the "Scratch for Robots" interface. If you need help with this step, please follow the instructions described in this tutorial
Click on File/Open (you can also use Ctrl-O for a direct access) to get the File dialog.
Click on the Desktop button, then double click the GoPiGofolder.
Once inside the GoPiGo folder, double click the Projects folder, and finally double click the AgentKK folder.
Choose agentKK and click the OK button to load it up inside Scratch.
Python
Open up a Terminal window.
Navigate to ~/home/pi/Desktop/GoPiGo/Projects/AgentKK
cd ~/Desktop/GoPiGo/Projects/AgentKK
if you want to see what the Python code looks like, you can:
nano agentKK.py
Let's verify that everything is working, before sending our Guardian off to do its job.
Start by putting GoPiGo on its back so it won't run off when it detects an intrusion. Be careful not to hurt the ultrasonic sensor or the camera when you do this.Place an obstacle in front of the ultrasonic sensor, less than 10 cm or 4 inches away.Launch the script.
Sudo python agentKK.py
Remove the obstacle in front of the ultrasonic sensor. There should be plenty of space in front of it now, enough to trigger the attack mode.
Are you getting the appropriate reactions?
The Guardian is meant to guard a closed door against unauthorized opening.
cd /home/pi/Desktop/GoPiGo/Projects/AgentKK
sudo python agentKK.py
For an ultimate test, open the door, and watch it go!