This demonstration shows how to control the Desktop RoboTurret via PC using data from a webcam using the RoboRealm software.
Download the Sketch
A .zip file with all of the RoboTurret Sketches can be found here.
Unzip the file and you will have a folder called
We recommend that you create a folder
RobotGeek Sketches in your Arduino user folder and put the
desktopRoboTurretV3-master in there. The rest of this guide will assume you've placed your sketches in the following folder.
Arduino -> RobotGeek Sketches -> desktopRoboTurretV3-master
This will be the same 'Arduino' folder you put your libraries and robotgeek tools in, and NOT the folder where the Arduino application is.
PC Control - Vision Tracking Via RoboRealm
The Geekduino's microprocessor does not have enough power to perform vision tracking on its own - it needs some additional help. By loading a 'pass through' sketch onto the board, the Geekduino can be directly controlled by a computer. The computer can run the processor intensive vision tracking algorithms, then control the turret in response to movement.
For this example you will need the following in addition to your RoboTurret:
- A Computer running Windows XP, Vista, 7, or 8
- A copy of RoboRealm
- A Webcam (this example will use a RobotGeek Webcam, but any camera supported by RoboRealm will work)
Roborealm, the RobotGeek Webcam, and the mounting hardware are included in the Vision Tracking Kit.
First you will need to load the pass-through sketch onto your Geekduino. You can find the sketch here:
File -> Sketchbook -> RobotGeek Sketches -> RoboTurret v3 -> roboTurret3_roboRealm
Wiring to the Sensor Shield for Vision Tracking is identical to the Test setup. You will also need to attach the webcam directly to your computer.
|Device||Pin Type||Pin #|
You will now need to install RoboRealm. Insert the CD and follow the installer instructions.
Once you have installed RoboRealm, launch the program. Click the
Camera button to try out your camera.
If you do not see a camera or it is slow, click the
Optionsbutton. From the Video tab, select your camera from the drop-down menu. You should now be able to click the Video Format button to adjust the picture size and frame rate.
- If you do not see your camera listed, use the Windows device manager to make sure your webcam is properly installed
- If you are having poor performance, try lowering the resolution or frame rate of your camera.
- For best performance, plug your camera directly into your computer, and not through any extenders or hubs.
Now that your camera is working, you can open up the RoboRealm demo file. The file is in the same folder as the Arduino RoboRealm pass-through sketch.
Arduino -> RobotGeek Sketches ->desktopRoboTurretV3-master -> roboTurret3_roboRealm ->Desktop_RoboTurret_v3_color.robo
With your camera activated, you can now press the
Run button to run the vision tracking program. A blue box should appear around the largest red object in the camera's view. Your RoboTurret should move along, keeping the red object centered in the camera's view.
Sparkfun_Arduinofield and select the correct serial port from the
COM Portdrop-down. This will be the same port you used to program your Geekduino.
- Set PAN_SERVO = 1500, TILT_SERVO = 1500, LASER = 0 This module will set the default values for the pan/tilt servo and the laser. You can adjust these if you want to change the default behavior of the turret.
- RGB_Filter Red This module will allow you to pick different colors to track. We recommend that you only try to track one color at a time. You can also fine-tune the intensity, hue, and hysteresis to get better results for your lighting environment.
- Blob Size 50 - 0 This module lets you adjust the size of the object being tracked.
- Center of Gravity This module calculates the center of the object being tracked. You can use this module to change the overlay color and behavior.
- VBScript Program This module runs the logic that will make the RoboTurret move. The code will take in the center of gravity information and move the turrets to keep that object in the center of the camera's view.
- Sparkfun_Arduino This module is the bridge between RoboRealm and the Geekduino. By sending serial data to the Geekduino, this module can control each port. If you would like to directly test any of the ports, delete the Variable text from the field - you can then use the sliders and checkboxes to activate connected devices - just be sure to set the variables back when your done!
PC Control These demos and projects allow the robot to be controlled via a computer.
ArbotiX Commander Control - These demos and projects control the Robot using the ArbotiX Commander, the handheld Arduino based remote control.
Direct Control - These demos and projects control the Robot directly from sensors connected directly to the Robot's control board.
Pose Control - These demos and projects allow you to create and playback a sequence of poses.
Serial Control - These demos and projects control the robot using a serial packet protocol.
Standalone - These demos and projects are deisgned to let your robot function without a computer or additional microcontroller.
Wireless Control - These demos and projects allow you to control the robot wirelessly - usually by replacing the Serial Connection with XBee modules.
Reference - These articles have technical details regarding the control and operation of the robot.
More info here