Make Your Own‎ > ‎

Using the Software


When you run the Processing code, two windows should pop up. One is the Webcam View and the other is the Control Panel

Software Features:

  • Autonomous Mode can track motion, color, or both
  • Target path anticipation
  • Scanning option when idle
  • Safe color identification
  • Fire-restricted zones
  • Tweak calibration
  • Save Settings
  • Use an Input Device such as a USB game controller or joystick

Some suggestions on tweaking the targeting performance:

There are several ways to tweak the performance. While tweaking it, you should enable "Show Different Pixels" under "display settings". That will highlight the pixels that are being read by motion. Also enable "Show Target Box", which will display a red box around the detected target.

Most important is the Min Size (under 'tracking options'). About 300 pixels works for me. you can go lower if you expect to be tracking really small targets, but don't go too low, because then it will start thinking random camera static is a target. So, if the code is picking up random target everywhere and bouncing around, raise the Min Size.

The next most important part is the target anticipation (see 'anticipation options'). Essentially, the anticipation feature lets the sentry calculate where the target will be in a moment - and aims a little ahead, 'leading' the target.
First, disable this by unchecking the checkbox, which often will reduce a lot of the jitter and bouncy motion.
If you want to use the target anticipation features, re-enable it. Set Memory and Sensitivity to around 10. Then, set both the "X Degree of anticipation" and "Y Degree of anticipation" to 0. Most people leave the Y-degree at 0, because most of their targets will be moving horizontally not vertically. Increase your X-degree until you are satisfied with how much the sentry is leading targets. But seeing the X-degree too high will cause a lot of extra bounce and jitter.

Finally, you can turn on the smoothing function (v6.02 and forward) if you want to reduce a lot of the extra movement. A warning though: the smoothing function will slow down your sentry's "reflexes", so to speak. It impairs Target Anticipation, and makes the sentry much slower to react to a rapidly-moving target. On the other hand, it makes for, well, smoother tracking. Give it a try, and see what you prefer.


Description of Controls:

Autonomous / Manual: in Manual Mode, you can aim and fire by pointing and clicking on the webcam view. In Autonomous Mode, the software takes over, and your gun gains a life of it's own! Give it a little time to adjust to the background, and then it will shoot at anything that enters its view.

Safe / Fire: tells the gun to fire or not to fire

Tolerance (motion): allows you to set the amount of color difference needed for a pixel to be defined as containing motion. Higher value will be more sensitive.

Min Target Area: How many pixels in size should the target be? Set to a higher value to avoid tracking birds and cats and blowing leaves.

Tolerance (color): If you are tracking a color, how specific do you want to be? A higher value will see a wider range of colors close to the color you selected, a lower value will see only colors very close to what you selected.

Background: Press this button to save the current camera view as the background. The background will also automatically adjust over time, so for example if a leaf falls in front of the camera, it will consider it part of the background if it stays still for a few minutes.

Track Motion: This toggle allows you to tell the sentry to track or not to track motion (default on)

Track A Color: This toggle allows you to tell the sentry to track or not to track a color (default off)
Note: you can track only motion, only color, or both. They work fine side-by-side.

Select Color to Track: Clicking this button will bring up a color picker. Hover over the color you want to track (in the webcam view), and click to select the color.

Semi / Auto: Fire selector for the gun. Semi will squeeze and release the trigger repeatedly, Auto will hold down the trigger. For specific tuning of the trigger servo movements, see the Arduino code comments. (default Auto)
Note: even if you have an automatic gun, semi can be a nice setting, to conserve ammo.

Scan When Idle: If this is set to on, during autonomous mode if there is no action for 10 seconds, the gun will begin to pan slowly back and forth. This is just for show. (default on)

Show Restricted Zones: Restricted zones are a unique feature that allows you to set 'safe' or 'no-fire' areas in the camera view. Hold down 'R' and click-and-drag from the upper left corner to the lower right corner of the area you want to set as safe. This toggle will display the restricted zones as transparent green rectangles. (default off)

Show Target Box: This displays a transparent red box around targets. Useful for troubleshooting, also some people just think it looks cool too. Personal preference. (default off)

Show Diff Pixels: Diff pixels are what the sentry sees as movement. (see Tolerance (motion) above). Turning this setting on will highlight pixels containing motion.
The list below the toggle allows you to select how you want to highlight Diff pixels. Try out the different options to see what you like best (opaque, transparent, negative, negative transparent). You can adjust the highlighting color by changing the values in the diffPixelsColor array in the code.

Show Cam View: Turn this off to hide the view from the camera. This may slightly speed up the software, but not by much. (default on)

Mirror Webcam: This allows you to horizontally mirror the view from the webcam. (default off)

Webcam Settings: Clicking this button will bring up a separate window where you can change the camera driver settings.

Play Sound: Press this button to hear a random recorded sound.

Sound Effects on / off: Here you can shut off those recorded sounds if they get annoying or interfere with tracking. (default on)

Tolerance (safe color): How sensitive do you want the sentry to be for detecting the safe color? A higher value will result in more colors being identified as safe colored, while a lower value will detect only colors very close to the set safe color.

Safe Color Min Size: How many pixels should be safe colored for the sentry to inactivate?

Recognize Safe Color: Turning this on will allow you to use a 'safe color'. When the sentry sees the safe color, it will stop firing. This can be used to remotely disable the sentry, or to keep from shooting at friendly forces in a game. (default off)

Select safe color: Pressing this will bring up a color picker. Hover over the color you want to use as a safe color (in the webcam view), and click on it to set it as the safe color.

Enable / Disable (Anticipation): Enable or disable target anticipation, or leading. (default on)

Memory (Frames): How many frames back should the target leading use for reference? A larger number allows for  smoother leading, but response to sudden rapid movements is slightly slowed the higher the memory #.

Horizontal Degree of Anticipation: How much should the software lead the target, along the x-axis?

Vertical Degree of Anticipation: How much should the software lead the target, along the y-axis?



Running Without Arduino Attached

The software should detect if no Arduino is attached. Watch for a message at the bottom of the IDE that reports if an Arduino was detected.
If you want to always use the software without an Arduino attached, change the initialization of the runWithoutArduino variable to true.


Saving Settings

After you have your settings where you want them, click "Save Settings". Next time you run the code, it will use your saved settings.



Last step: Calibration


Comments