Пример #1
0
import logging
import time

from Tkinter import *
from ImageTk import PhotoImage

import cv
import ImageDraw
import Image as Img

from epuck.controller import Controller

logging.basicConfig(level=logging.ERROR)

c = Controller('/dev/rfcomm0', timeout=5, asynchronous=True)

# Set camera properties
c.set_front_led(1)
c.set_camera(Controller.GREYSCALE_MODE, 55, 55, 8)

# Create the application layout
root = Tk()
img_face = Label(root)
img_face.pack()

cascade = cv.Load('haarcascade_frontalface_alt.xml')


def show_photo():
    # Get the photo
Пример #2
0
import logging
import time

from Tkinter import *
from ImageTk import PhotoImage

import cv
import ImageDraw
import Image as Img

from epuck.controller import Controller


logging.basicConfig(level=logging.ERROR)

c = Controller('/dev/rfcomm0', timeout=5, asynchronous=True)

# Set camera properties
c.set_front_led(1)
c.set_camera(Controller.GREYSCALE_MODE, 55, 55, 8)

# Create the application layout
root = Tk()
img_face = Label(root)
img_face.pack()

cascade = cv.Load('haarcascade_frontalface_alt.xml')

def show_photo():
    # Get the photo
    img = c.get_photo() \
import logging
import time
import sys
import signal

from epuck.controller import Controller

logging.basicConfig(level=logging.WARNING)

c = Controller('/dev/rfcomm0', asynchronous=True, timeout=5, max_tries=1)

# Signal handler to cleanup after shutdown
def handle_signal(signum, frame):
    r = c.stop()
    r.join()
    sys.exit(0)

# SIGINT is interrupt signal sent by CTRL+C
signal.signal(signal.SIGINT, handle_signal)


while True:
    # Read ambient light sensors
    r = c.get_ambient_sensors().get_response()

    front_side = r['L10'] + r['R10']
    left_side = r['L45'] + r['L90']
    right_side = r['R45'] + r['R90']

    # The light source is straight ahead
    if front_side < left_side and front_side < right_side:
Пример #4
0
import logging
import time
import sys
import signal

from epuck.controller import Controller

logging.basicConfig(level=logging.WARNING)

c = Controller('/dev/rfcomm0', asynchronous=True, timeout=5, max_tries=1)


# Signal handler to cleanup after shutdown
def handle_signal(signum, frame):
    r = c.stop()
    r.join()
    sys.exit(0)


# SIGINT is interrupt signal sent by CTRL+C
signal.signal(signal.SIGINT, handle_signal)

while True:
    # Read ambient light sensors
    r = c.get_ambient_sensors().get_response()

    front_side = r['L10'] + r['R10']
    left_side = r['L45'] + r['L90']
    right_side = r['R45'] + r['R90']

    # The light source is straight ahead
Пример #5
0
import logging
import time

from epuck.controller import Controller

logging.basicConfig(level=logging.ERROR)

c = Controller('/dev/rfcomm0', asynchronous=False, timeout=5, max_tries=10)
s = c.comm.serial_connection