I used the Gizmo 2Gizmo 2 single-board computer for this project.
This project was originally inspired by a few of the image processing projects that I have gotten involved in as well as my strong interest in robotics. After hearing about the Gizmo 2's small size, reasonable power consumption and fast x86_64 processor, I saw it as a perfect fit for small to moderate size robotics projects that involve large amounts of computation. With all of the buzz lately over self driving cars, I thought it would be cool to create my very own 1/10th scale self driving RC car. This type of project is very well suited to the Gizmo 2 since it fulfills every aspect of the preceding criteria.
The final project is an a fully autonomous, self driving, object tracking 1/10th scale car. The car is a 1/10 scale Traxxas Slash pro-class short course RC race truck that is powered by a high performance 12 turn brushed DC motor. Mounted to the hood is a Logitech C920-C USB camera which captures video that is sent in real time to the Gizmo 2, which it mounted on the rear of the car using a custom laser-cut mounting bracket.
Power to the entire system is provided by 2 lithium polymer batteries, a 4 cell 3.2Ah pack for powering the Gizmo 2 and all USB peripherals along with a 2 cell pack providing drive power for the car. Battery life is slightly over 3 hours with the Gizmo 2 and car running constantly. The main motor is controlled via the standard brushed motor ESC (electronic speed controller) included with the car. The RC radio system of the car has been replaced with a custom designed control system consisting of the AMD / Gizmosphere Gizmo 2 running Arch Linux as well as an Arduino Uno. The Gizmo 2 and Arduino work together such that the Gizmo 2 processes the video frames from the webcam and performs the several hundred matrix operations necessary to process the incoming video stream using OpenCV libraries and locate the colored object if it is present in the video frame.
If the colored object is detected, the software running on the Gizmo 2 will then proceed to compute a vector from the center of the frame to the location of the center of the object. The magnitude and direction of this vector are then used to compute a speed and steering angle, where the steering angle is proportional to the location of the object with respect to the center of the frame and the speed is inversely proportional to the steering angle. This causes the car to always turn towards the object as well as slow down during tight turns.
The computed speed and steering angle values are then transferred to the Arduino using a custom designed, fault tolerant serial protocol. The Arduino then decodes these incoming data packets and uses a combination of data from an onboard hall effect based RPM sensor along with a PI (Proportional-Integral) control system to compute approximately 60 motor power adjustments per second that are required to maintain the car at the speed requested by the Gizmo 2 even in changing terrain conditions.
The output of the speed regulation algorithm as well as the steering position values are finally input into a series of hardware timers in the Arduino's ATMega328 microcontroller that synthesize the PWM(Pulse Width Modulation) signals that will finally be interpreted by the car's ESC and steering servo.
Telemetry for configuration and monitoring is accomplished via a dual band TP-LINK TL-WDN3200 USB wireless adapter as well as the dhcpd and hostapd linux utilities, which allow the Gizmo 2 to create its own WiFi network for the control computer. The SSH and VNC protocols are then used for console access and initial configuration as well as access to the graphical desktop for actually running the image processing application respectively.
Bill of Materials
AMD/Gizmosphere Gizmo 2AMD/Gizmosphere Gizmo 2
Traxxas Slash 2WD RC Racing Truck
Traxxas Big Bore Shock Kit
Traxxas RPM sensor and trigger magnet
16GB microSD memory card
XT60 connectors
Various sizes of heat shrink tubing
12"x12"x1/4" acrylic sheet
4-40x1" nylon bolts with nuts
4-40x3/4" steel bolts with nuts
1/4" spacers
Arduino ProtoShield
TP-LINK TL-WDN3200 N600 Dual Band Wireless USB Adapter
Arduino UNO R3 Board
Venom 30C 4S 3200mAh 14.8v LiPo Battery
Venom 40C 2S 5000mAh 7.4v LiPo Battery
1 meter, full size USB A to B cable.
Bussmann ATO inline fuseholder
2.5x5.5mm barrel plug power cable
Logitech C920-C Webcam
HiTec 44165 X1 AC Plus Single Port 6 Amp AC/DC Charger (NiCd/NiMH/LiPo)
Code