コード例 #1
0
def sync(sender):
    wireless = wifi.is_connected()
    show_wifi_status()
    if wireless:
        views[0]['label2'].text = 'Connecting...'
        drive = Drive()
        updated = drive.update('journal.jl')
        sync_status_alert(updated)
        if updated:
            views[0]['label2'].text = 'All changes saved to Google Drive'
        else:
            views[0]['label2'].text = 'Out of Sync'
    else:
        console.alert('WiFi required for sync')
コード例 #2
0
def cozmo_program(robot: cozmo.robot.Robot):
    f = Face(robot)
    f.find_person()
    d = Drive(robot)
    weather = Weather(f.city)
    weather.set_outfit()
    welcome = Welcome(robot)
    welcome.hello(weather.w, weather.outfit, f.city, f.name)
    e = input()
    if e == "exit":
        robot.say_text("Goodbye")
    else:
        l = Lights()
        l.set_lights(d, weather.number)
        d.find(weather.number)
コード例 #3
0
 def generate_drivers(self, number_of_drivers: int,
                      loadbalancer: Loadbalancer):
     for driver in range(number_of_drivers):
         drive = Drive(loadbalancer, self.gui)
         dp = DrivePainter(driver, self.gui)
         dp.init_drawing()
         self.__list_of_drivers.append(drive)
コード例 #4
0
ファイル: Bleuette.py プロジェクト: thoastbrot/Bleuette
    def __init__(self):
        if Config.FAKE_MODE == False:
            self.BPi = BleuettePi(Config.SERIAL_DEV)
        else:
            self.BPi = BleuettePi(SerialFake)

        self.Sequencer = Sequencer(self.BPi.Servo)
        self.Drive = Drive(self.Sequencer)
コード例 #5
0
def main():
	atexit.register(cleanup)

	sonars = SonarArray(TRIG_L, TRIG_C, TRIG_R, ECHO_L, ECHO_C, ECHO_R)
	sonars.start()
	
	drive = Drive(mh.getMotor(1), mh.getMotor(3))
	drive.start()

	avoid = Avoid(sonars.ranges, drive.speeds)
	avoid.start()

	keep_running = True
	while keep_running:
		print str(sonars.ranges[0]) + "\t" + str(sonars.ranges[1]) + "\t" + str(sonars.ranges[2]) + \
			"\t" + str(drive.speeds[0]) + "\t" + str(drive.speeds[1])

		fs = 0
		angs = 0
		key = readchar.readkey()
		if key == 'w':
		  fs=150
		elif key == 'a':
		  angs=75
		elif key == 'd':
		  angs=-75
		elif key == 's':
		  fs=-75
		elif key == '~':
			keep_running = False
		else:
			fs=0
			angs=0

		avoid.commands[0] = fs
		avoid.commands[1] = angs

		time.sleep(0.1)

	print "Exiting...."

	sonars.keep_running = False
	drive.keep_running = False
	avoid.keep_running = False
コード例 #6
0
ファイル: GUI.py プロジェクト: NWChen/SERGE
	def __init__(self, root, joystick=None, canvas_width=1000, canvas_height=1000, radius=20, wheel_diagonal=10):	
		self.joystick = joystick

		# Canvas on which to draw graphics
		self.w = Canvas(root, width=canvas_width, height=canvas_height)
		self.w.pack()
		self.drive = Drive(0, Point(canvas_width/2, canvas_height/2), radius)
		self.wheel_diagonal = wheel_diagonal
		self.s_wheels = []

		# Draw the chassis of the robot. "s" stands for "shape"
		self.s_drive = self.w.create_polygon(self.drive.wheels[0].center.x, self.drive.wheels[0].center.y,
																			self.drive.wheels[1].center.x, self.drive.wheels[1].center.y, 
																			self.drive.wheels[2].center.x, self.drive.wheels[2].center.y, fill="#3E3E3E")
		self.s_frontedge = self.w.create_line(self.drive.wheels[0].center.x, self.drive.wheels[0].center.y,
																			self.drive.wheels[1].center.x, self.drive.wheels[1].center.y, fill="#22A7F0", width=3.0)
		# Draw the wheels of the robot
		for wheel in self.drive.wheels:
			self.s_wheels.append(self.w.create_polygon(wheel.center.x-wheel_diagonal/4, wheel.center.y+math.sqrt(3)*wheel_diagonal/2,
																	wheel.center.x+wheel_diagonal/4, wheel.center.y+math.sqrt(3)*wheel_diagonal/2,
																	wheel.center.x+wheel_diagonal/4, wheel.center.y-math.sqrt(3)*wheel_diagonal/2,
																	wheel.center.x-wheel_diagonal/4, wheel.center.y-math.sqrt(3)*wheel_diagonal/2, stipple="gray75"))
コード例 #7
0
ファイル: DriveScan.py プロジェクト: toxic87/lfde
    def get_drive_list(self):
        drives = []

        part_fh = open("/proc/partitions", "r")

        i = 0
        for line in part_fh:
            #skip the first 2 lines
            if i < 2:
                i += 1
                continue

            line = line.rstrip().lstrip()
            fields = line.split()
            name = fields[3]

            # we're only interested in sd* devices
            if re.match(r"sd[a-z]+$", name):
                size = self.get_size(name)
                drives.append(Drive(name, size))

        part_fh.close()

        return drives
コード例 #8
0
ファイル: Cli.py プロジェクト: VLADYRON/GoogleDriveClient-1
                    nargs=2)
parser.add_argument("--uploads",
                    help="upload all the files under the folder to drive",
                    metavar=('<file_path>', '<remote_path>'),
                    nargs=2)
parser.add_argument("--ls",
                    help="show the list of path in drive",
                    metavar="<remote_path>")
parser.add_argument("--delete",
                    help="delete file or folder",
                    metavar="<remote_path>")

args = parser.parse_args()

credentials = Oauth.Load()
drive = Drive(credentials)

while True:
    if args.upload is not None:
        drive.upload_file(args.upload[1], args.upload[0])
        break
    if args.uploads is not None:
        drive.upload_files(args.uploads[1], args.uploads[0])
        break
    if args.ls is not None:
        items = drive.ls(args.ls)
        if items:
            for item in items:
                filesize = '?'
                if 'fileSize' in item:
                    filesize = int(item['fileSize']) / (1024 * 1024.0)
コード例 #9
0
ファイル: Drive_tester.py プロジェクト: NWChen/SERGE
from Drive import Drive
import math

def assert_wheels():
	assert math.fabs(drive.wheels[0].speed <= 1.0)
	assert math.fabs(drive.wheels[1].speed <= 1.0)
	assert math.fabs(drive.wheels[2].speed <= 1.0)
	assert drive.wheels[0].angle > 0 or drive.wheels[0].angle < 360
	assert drive.wheels[1].angle > 0 or drive.wheels[1].angle < 360
	assert drive.wheels[2].angle > 0 or drive.wheels[2].angle < 360

drive = Drive()
for i in range(10**3):
	drive.turn(math.sin(i*(math.pi/36)))
	assert_wheels()
	drive.crab(i, math.sin(i*(math.pi/36)))
	assert_wheels()
print "Passed"
コード例 #10
0
def main():
    """ Stupid test. """
    x = Drive()
    x.download_directory(f"{sys.argv[1]}", "Carelink_data")
コード例 #11
0
ファイル: GUI.py プロジェクト: NWChen/SERGE
class GUI(object):

	"""
	Creates a GUI instance.
	@type root: Tkinter.Tk()
	@param root: A Tkinter.Tk object
	@type canvas_width: number
	@param canvas_width: The width of the canvas, in pixels
	@type canvas_height: number
	@param canvas_height: The height of the canvas, in pixels
	@type radius: number
	@param radius: The length of the diagonal of the rectangle representing a wheel
	""" 
	def __init__(self, root, joystick=None, canvas_width=1000, canvas_height=1000, radius=20, wheel_diagonal=10):	
		self.joystick = joystick

		# Canvas on which to draw graphics
		self.w = Canvas(root, width=canvas_width, height=canvas_height)
		self.w.pack()
		self.drive = Drive(0, Point(canvas_width/2, canvas_height/2), radius)
		self.wheel_diagonal = wheel_diagonal
		self.s_wheels = []

		# Draw the chassis of the robot. "s" stands for "shape"
		self.s_drive = self.w.create_polygon(self.drive.wheels[0].center.x, self.drive.wheels[0].center.y,
																			self.drive.wheels[1].center.x, self.drive.wheels[1].center.y, 
																			self.drive.wheels[2].center.x, self.drive.wheels[2].center.y, fill="#3E3E3E")
		self.s_frontedge = self.w.create_line(self.drive.wheels[0].center.x, self.drive.wheels[0].center.y,
																			self.drive.wheels[1].center.x, self.drive.wheels[1].center.y, fill="#22A7F0", width=3.0)
		# Draw the wheels of the robot
		for wheel in self.drive.wheels:
			self.s_wheels.append(self.w.create_polygon(wheel.center.x-wheel_diagonal/4, wheel.center.y+math.sqrt(3)*wheel_diagonal/2,
																	wheel.center.x+wheel_diagonal/4, wheel.center.y+math.sqrt(3)*wheel_diagonal/2,
																	wheel.center.x+wheel_diagonal/4, wheel.center.y-math.sqrt(3)*wheel_diagonal/2,
																	wheel.center.x-wheel_diagonal/4, wheel.center.y-math.sqrt(3)*wheel_diagonal/2, stipple="gray75"))
		
	"""
	Animates the turning of the robot.
	@type speed: number
	@param speed: The speed at which the robot should turn
	"""
	def robot_turn(self, speed):
		self.drive.turn(speed)
		self.update_robot()
		for i in range(0, 3):
			self.build_rectangle(self.s_wheels[i], self.drive.center, self.drive.angle)
		self.w.update()

	"""
	Animates the translational crab motion of the robot.
	@type angle: number
	@param speed: The angle at which the robot should move
	@type speed: number
	@param speed: The speed at which the robot should move
	"""
	def robot_crab(self, angle, speed):
		self.drive.crab(angle, speed)
		self.update_robot()
		self.w.update()

	"""
	Redraws the robot on the field.
	"""
	def update_robot(self):
		self.w.coords(self.s_drive, self.drive.wheels[0].center.x, self.drive.wheels[0].center.y,
																	self.drive.wheels[1].center.x, self.drive.wheels[1].center.y, 
																	self.drive.wheels[2].center.x, self.drive.wheels[2].center.y)
		self.w.coords(self.s_frontedge, self.drive.wheels[0].center.x, self.drive.wheels[0].center.y,
																			self.drive.wheels[2].center.x, self.drive.wheels[2].center.y)

	"""
	Redraws a robot wheel.
	@type wr_angle: number
	@param wr_angle: The angle of the wheel to the robot's axis perpendicular to the front edge.
	"""
	def build_rectangle(self, shape, wheel, wr_angle=0):
		wf_angle = self.drive.angle - wr_angle # Angle of wheel to the field, where the north direction is 0
		dx = math.sin(wf_angle)*self.wheel_diagonal/2
		dy = math.cos(wf_angle)*self.wheel_diagonal/2
		w.coords(shape, wheel.center.x+)
コード例 #12
0
from LANEDetection import LANEDetection
import cv2
from FPS import FPS
from Drive import Drive
from RegSvet import RegSvet
drive_data = DataControl()
drive_data.start()
# drive_data.set("tfl", "red")
objd = OBJDetection()
objd.load()
laned = LANEDetection(drive_data)

cap = CVCapIN(id_c="./Sign_and_person.mkv")
cap.start()

drive = Drive(drive_data=drive_data)

fpser = FPS()
fpser.start()

rs = RegSvet(cap)
rs.reg_toggle(True)
rs.load_model_svm("tld.svm")
while cv2.waitKey(1) != ord("q"):
    
    # drive_data.set("tfl", "red")
    _, frame = cap.read()
    cv2.imshow("ddd", frame)
    laned_img = laned.run(frame.copy())
    cv2.imshow("laned", laned_img)
    objd_img, sss, mmm = objd.run(frame.copy())