This is my senior years final project, i build the mini tank with M4-Carbine Airsoft gun mounted. It can wireless control RGB color tracking. let see robot specification source code below.

- Manual control
with joy stick and GUI moving forward, backward, turn left, turn right, spin left, spin right with full speed control, fire button with safety button, turn on/off flashlight, laser sight, swap the video cameras.

- Autonomous Control
Auto Aim Mode from RGB selection colors (pitch and yaw) still can control the wheel by manual
Lock-On Mode that will let robot autonomous control the wheels, It will reading the target distance and keep it in range, if the target is too far it will move forward or if it too close it will move backward, or even target disappear on the right or left side it will automatic spinning their wheel to search the target as you can see on the video.

- Hardware

Communication : 2x Xbee Pro Serries 2.5 60mW 2.4GHz with 5dBi antenna
Wireless Video Transmitter: 2W 2.4GHz Analog Module with EasyCap USB video converter
Microcontroller : 1x Arduino Mega and 2x of Arduino with serial communication together
Wheel Motor & Drive: 2x of 250W bicycle motors, 418A FET speed control with H-bridge Relay
Airsoft Gun Trigger : RC Servo
Batteries: lead acid – 2x 7.5A 12V series together for 24V main power, 6V 5A for microntroller and sensor, 12V 2A for video transmitter, all fully regulated and auto power source swapping when some of batteries run out.

On the High-Level Detail

this project done on 7 months period with 2 men working on it, we start with CAD/CAM computer design some parts done by CNC machine but most of it done by our hand. We have two camera on the robot with one transmitter it can swap by relay circuit the front camera send the video back to receiver and convert the video analog signal to computer by using EasyCap USB converter. i done the high-level program on Processing the RGB image processing core using Jmyron library, Graphic User Interface done by controlP5 and USB joystick connection done by proCONTROLL library. image processing on Jmyron library gave me very impressive but still not aim the right target when it has two object or some noise, so i done it by sort all object that detected to find the biggest RGB color selection target area by that way the robot could select the big one first. The Robot also can convert the object size to distance by math function i done it by collecting the data of object size that change by distance and using Eureqa to discover it, well i successfully done the robot range finder by single camera but you need to know and specify the target size on GUI panel. by this way we can got X,Y position from original image processing and got Z (distance) by range finder so i using the target range information to compensate the auto aim mode, and distance keeper on Lock-On mode. to make the robot keep tracking the RGB selection object it simple done by classic PID algorithm but i use only P control it enough for Lock-On mode only implement the soft-start on P Control that not made the robot look too aggressive when it start/stop moving. We send data to control the robot via Xbee module that simply as serial communication i written the code for encoding the ASCII command with package header to tell what the robot need to do.

On the Low-Level Detail
I use Arduino Mega connect directly to Xbee on first serial port and two of Arduino boards connect to Serial1 and Serial2 for pitch and yaw control. by this way Arduino Mega is main microcontroller it will receive package command from Xbee and if command for wheels control, swapping video, fire command, on/off laser it will processing inside the Arduino Mega and sending signal output to control the hardware. if it command to control pitch or yaw angle it will forward the package to Arduino 1 or 2 by Serial1 and 2. On the arduino board it will processing the package return to integer that tell them self which angle that it will move for by PID algorithm again i use only P control that all enough for error on 0.2 degree it could not reduce anymore by limitation of hardware. the pitch and yaw control system using potentiometer that attach on the robot arm to feedback the position.

*** PS as you can see the little red wire on auto mode testing, it wire for transfer AV video signal, becuase i have problem with cheap Analog 2.4 GHz video transmitter that very noisy that cause the image processing as wrong result on sometimes. the wireless video has been interfere by Xbee device and around with strong signal WiFi Access point that use the same 2.4 GHz frequency. for the best result testing on laboratory and easy way to solve the problem, so i wire it up. for fix this problem may be replace the video transmitter to 5.8 GHz digital, but for me it very hard to find and very expensive.

Souce Code: Download

please feel free to post comment, thank for reading.