Software

The software is the brains of the whole thing. We used parts from all over in order to make it work. In particular we used AForge.NET Framework by Andrew Kirillov (specifically we used andrew's motion detection code which is at codeproject) and servo controlling pioneered by Colin Karpfinger. What it essentially does is it compares a frame from the camera to a previous or standard frame. Then it recognizes where the differences between these frames are, logically that has to be movement. The center pixel location of the moving object is sent to the Pololu servo controller that aims the dispenser on target and automatically pulls a trigger if so selected.

There are a couple of interesting options incorporated in the software.

Such as:

- The software (when on autofire) automatically selects the biggest target and fires. The logic behind it is that the biggest target is the closest so that one first until it is gone or doesn’t move anymore, then the next one and so on. Obviously there is room for improvement with regard to tracking of objects and their recognition. For instance you could then say do/don’t shoot humans, cars, animals, etc.

Other targeting algorithms could for instance select a certain other target property than size such as estimated distance (you will need object recognition for this), speed, etc. You could also have the sentry rotate through the various targets or three biggest or any other combinations. Personally I wonder how useful this is in getting a hit.

- If you click anywhere in the grey area on the left the dispenser aims there.

- Double click anywhere in the grey area on the left and the dispenser aims and fires there.

- Adjustable difference filter threshold for outdoor operation.

- You can limit the size of the target you want to hit. This is related to the amount of moving pixels. Keep in mind that a target further away also means it is a smaller amount of pixels. I.E. a very small target that is very close can also be recognized as viable. This is also a handy makeshift tool to limit the distance of your sentry. Meaning that it only fires when something reaches a certain size (therefore distance, which is a moderately debatable assumption) from the sentry.

- Shooting regions, you are able to select regions in the picture where the sentry is not allowed to pull the trigger until the target comes out of that region.

- Servo movement range setting

- Servo speed controll

- Automatic recognition of hardware

- Various motion algorithms

- If you want more accuracy you can adjust the step size of the servo, remember to recalibrate the max min settings of the servos.

What has to be noted is that the software does not in any way distinguish between anything at all, consequently it is indiscriminant of objects friends or foe. i.e. IF IT MOVES.. IT GETS creamed. If you have problems with reaction times and so on consider usb 2.0.

Software developments

The software is “as is”, following the directions you will be able to make a working sentry that dispenses whatever you put on it. Do keep in mind that if you opted for a normal camera and not an infra red camera you will need to have the laser turned off when set on automatic. This as the laser is without a doubt the brightest point in the video screen so if it moves during a shot the motion detection will go into some insane feedbackloop as the dispenser/laser will never be 100% in line with the servo center setting and because there is a small deviation in the motors or somewhere else. Now either you will need to shut the of during firing or you will have to make the software ignore this bright point or the threshold will be very high and ruin the experience, so you need to figure this out but I think you’d best have a infra red camera even though calibration will be a little more difficult. If you have made and interesting addition that you think could be incorporated in the open source code send it in or contact us.

Interesting additions for example are:

- Automatic difference/threshold filter adjustment

- Human recognition

- Car/animal/etc recognition

- Better motion detection

- Improved tracking capabilities

- Face recognition

- Friend /foe identification, Dan and Oliver suggested semacode to do this

- Targeting algorithms for longer distance

- Improved camera tracking for instance, auto-zooming for targets at distance

- Attaching more than one camera so that the field of view can be larger. Related to this you could also modify your servos to be able to turn 360 degrees. Although I wonder how you’re going to run away from it or get it back once you turn it on.

- Distance estimation to target for parabolic trajectories and parabolic targeting algorithms.

- Automatic servo speed adjustment following a normal distribution curve to the target, although i am not sure this is nessesary unless you have a heavy dispenser and servos that are not strong enough for the weight.

- speed of moving object and expected position for targeting