In preparation for International Nodebots Day this July 30th 2016, I built this Bot that can be controlled in Virtual Reality.
When we went to Mars, we sent a Mars Rover. In Virtual Reality, I sent an Earth Rover to explore our world. I control the bot using browser using WebVR.
Introduction
My name is Ron Dagdag and I'm doing a series of VR projects. This is part 5 of 6 series project exploring Virtual Reality as a Maker. I'm not going to create games, I am going to explore different ways to create new experiences and interact in VR/AR.
Part 1: Amazon Echo VR Controller
https://www.hackster.io/RONDAGDAG/amazon-echo-vr-controller-724c89
Part 2: Gesture Controller using Particle Photon and Sparkfun RGB and Gesture Sensor APDS-9960
https://www.hackster.io/18937/augmented-reality-virtual-reality-dinosaur-experience-be9c8c
Part 3: Virtual Reality Fireworks using Color Sensor
https://www.hackster.io/RONDAGDAG/virtual-reality-fireworks-using-color-sensor-779ea7
Part 4: ConstructAR - The Holographic Tool Belt
https://www.hackster.io/team-constructar/constructar-the-holographic-tool-belt-b44698
Part 5: Control your "Earth Rover" in Virtual Reality
Part 6: Posture Recognition using Kinect, Azure IoT, ML and WebVR
https://www.hackster.io/RONDAGDAG/posture-recognition-using-kinect-azure-iot-ml-and-webvr-e9c4f7
Using Virtual Reality and Leap Motion to control a robot is awesome.
Rover Bot
I bought one on aliexpress because it's cheaper, it came everything you need including an Arduino Uno. It has Motor Drivers, Servo Controller, the Wheels, the Base, Battery even Distance Sensors.
The instructions are easy to follow and came with pictures, just what I need.
http://www.makeuseof.com/tag/build-4wd-arduino-robot-beginners/
So instead of using Arduino Uno, I replaced it with Intel Edison with Intel Edison Arduino Breakout Board.
The Intel Edison Arduino Breakout Board allows us to connect the Intel Edison to Arduino shields. It has integrated Wifi, Bluetooth, storage and USB connectors. I plugged in my USB Camera and found this project called edi-cam.
https://github.com/drejkim/edi-cam
I based my project here. Since the Intel Edison support Yocto Linux, I has NodeJS built in. Everything I need for my Nodebot.
edi-cam project demonstrates live video streaming on Intel Edison using Node.js and WebSockets.
To get the USB camera working, make sure that you're powering it up with a 9-Volt battery or the Wall plug. You can't use the USB if you're using the micro USB to power up Intel Edison from your computer. It's not enough power to run the camera.
After getting the edi-cam going on my Intel Edison, I've noticed that the camera would just freeze after two minutes. I scratched my head. After digging into, I found out that the later version of NodeJS would timeout and close the http socket connection after 2 minutes. I fixed that by changing the timeout to zero.
Now, I need to control my robot. Move left, right, forward or back. I saw this project on Github.
https://github.com/bocoup/reconbot
Just what I need. It's using NodeJS and Johnny Five to control the Bot.
Johnny-Five is platform for Javascript Robotics and IoT. It's easier to control motors, servos. It's also easier to debug.
Virtual Reality
I have Oculus Rift and I've done programming with it inside Unity. I want to try a different way without installing any apps and using VR Web.
I came across Aframe.io while I'm browsing about Virtual Reality and I'm amazed how easy and extensible it is to do Virtual Reality applications.
Aframe.io is building blocks for the virtual reality web. It uses markup to create VR experiences that work across desktop, iOS, Android, and the Oculus Rift. It's using webgl and javascript. Currently to get the Aframe.IO working on Oculus Rift, you need to use the Nightly build of Mozilla browser.
To read more about Aframe.io, use this link
It reminded me of VRML back in the early days of the web. Aframe is way better though. It's extensible, and open source. I found this component that allows to use Leap Motion in Aframe.
https://github.com/openleap/aframe-leap-hands
Leap Motion and Virtual Reality works well together. Leap Motion a great way to interact with Virtual Reality, being able to see and manipulate virtual things is awesome. That's why I included it in this project. I can use a "planet" to make the robot turn left or right just by grabbing it.
Since I'm using Aframe.io, Google Cardboard integration came with it. So I can go to the website on my phone, put it on VR mode and plug my phone to Google Cardboard.
Parts:
1. Rover Bot
2. USB Camera
https://www.amazon.com/dp/B0092QJRPC/
3. Intel Edison Arduino Breakout
https://www.sparkfun.com/products/13097
4. Leap Motion
To Setup, follow the instructions here:
https://github.com/rondagdag/edi-cam-vrbot/blob/master/README.md
Final Thoughts
The great thing about this hack is it uses all web technologies. Javascript is what drives it from NodeJS, Johnny-Five, Aframe.IO.
Also, I only deploy it in one place which is inside Intel Edison. There are no extra installs on my laptop or my phone. I start my web server and It just works.
If this project made you interested in developing in Oculus Rift, tinker with Aframe.io, Johnny-Five, or just learned something from this article, please click Respect Thumbs Up button and follow me. Feel free to contact me if you have questions. Thanks.
Comments