about
one.principles and practices
two.computer-aided design
three.computer-controlled cutting
four.electronics production
five.3d scanning & printing
six.electronics design
seven.computer-controlled machining
eight.embedded programming
nine.mechanical design
ten.machine design
eleven.input devices
twelve.molding & casting
thirteen.output devices
fourteen.composites
fifteen.networking & communications
sixteen.interface & app. programming
seventeen.applications & implications
eighteen.invention, property & income
Project Development
Setup includes a IR camera with visible light filter. It uses opencv to track a couple of IR tokens on the user then uses the position of its centroid as input to multiple pid controllers that produce PWM servo like pulses. Each servo controls one DOF: pX roll, pY pitch y pZ yaw
def init_leds():
global pinR = 12
global pinG = 16
global pinB = 20
pi0.write(pinR, 1)
time.sleep(.25)
pi0.write(pinG, 1)
time.sleep(.25)
pi0.write(pinB, 1)
time.sleep(.25)
pi0.write(pinR,0)
pi0.write(pinG,0)
pi0.write(pinB,0)
return
next
GOD'S CV PILOT
v0.0
roll and pitch for servo motors
accumulative and non mode
only gray stream
v0.1
roll, pitch and yaw
better information display
available on 3 image modes
v0.2
uses colored image to show info
v0.1+
pilot 1
"""
"""
"""
## packages
from picamera.array import PiRGBArray
from picamera import PiCamera
import numpy as np
import time, math
import cv2
import pigpio
import godsPID
def translate(value, inMin, inMax, outMin, outMax): # like processing's map
inSpan = inMax - inMin
outSpan = outMax - outMin
transVal = float(value - inMin) / float(inSpan) return outMin + (transVal * outSpan)
def distance(x1, y1, x2, y2):
return math.sqrt((x1 - x2)**2 + (y1 - y2)**2)
def init_pwm():
global pin_roll = 17
global pin_pitch = 27
global pin_yaw = 22
global pi0 = pigpio.pi()
global minPWM = 1000
global maxPWM = 2000 pi0.set_servo_pulsewidth(pin_roll, 0) pi0.set_servo_pulsewidth(pin_pitch, 0) pi0.set_servo_pulsewidth(pin_yaw, 0) time.sleep(0.1)
return
The following is the program code that pilotS the vehicle. It uses openCV to treat stream of images from the camera and pigpio for control and modulation of the GPIOs on the Raspberry Pi.
final project
god.