Esempio n. 1
0
 def __init__(self, emulate = False):
     if not emulate:
         self.m1 = motor.MotorController('/dev/ttyACM0')
         self.m2 = motor.MotorController('/dev/ttyACM1')
         self.Reset()
     else:
         self.m1 = MotorEmulate()
         self.m2 = MotorEmulate()
     self.speed = [0,0]
     self.accel = 1500
     self.cycle_time = 200 #ms
     self.speed_steps = 800
     self.speed_steps_stop = 100
     self.state = "STOP"
     self.new_state = None
     return
Esempio n. 2
0
	def __init__(self):

		# initialize controlls
		self.camera = camera.CameraController()
		self.inferface = interface.InterfaceController()
		self.motor = motor.MotorController()
		self.joystick = joystick.JoystickController()
		self.ai = jetson_ai.JetsonAI()
		self.ultrasonic = ultrasonic.UltrasonicController()
Esempio n. 3
0
import motor as m

motor = m.MotorController()
motor.initialize()

motor.right(2.5)

Esempio n. 4
0
from picamera.array import PiRGBArray
from picamera import PiCamera
import time

import classifier
import range
import motor

GPIO.setmode(GPIO.BCM)

trig_pin = 23
echo_pin = 24
led_pin = 16
minimum_feature_size = 500

motor = motor.MotorController()

def clamp(n, minn, maxn):
	return max(min(maxn, n), minn)

try:
	GPIO.setup(led_pin,GPIO.OUT)
	GPIO.output(led_pin, GPIO.HIGH)

	range_sensor = range.RangeSensor(trig_pin, echo_pin)

	# Initialize distance sensor

	camera = PiCamera()
	camera.resolution = (640, 480)
	camera.framerate = 32
Esempio n. 5
0
# emulated camera
#from camera import Camera

# Raspberry Pi camera module (requires picamera package)
from camera_pi import Camera

app = Flask(__name__)

pan = servo.ServoController(25)
pan.setAngle(0)

tilt = servo.ServoController(24)
tilt.setAngle(0)

motorA = motor.MotorController(8, 7)
motorB = motor.MotorController(10, 9)


@app.route('/')
def index():
    """Video streaming home page."""
    return render_template('index.html')


def gen(camera):
    """Video streaming generator function."""
    while True:
        frame = camera.get_frame()
        yield (b'--frame\r\n'
               b'Content-Type: image/jpeg\r\n\r\n' + frame + b'\r\n')