当前位置: 首页>>代码示例>>Python>>正文


Python Camera.start方法代码示例

本文整理汇总了Python中Camera.Camera.start方法的典型用法代码示例。如果您正苦于以下问题:Python Camera.start方法的具体用法?Python Camera.start怎么用?Python Camera.start使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Camera.Camera的用法示例。


在下文中一共展示了Camera.start方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: testmain

# 需要导入模块: from Camera import Camera [as 别名]
# 或者: from Camera.Camera import start [as 别名]
def testmain():
    xxx = Camera()
    xxx.start()

    while True:
        i = yyy.getImage()
	print "YYY got image"
开发者ID:StevenVanAcker,项目名称:ProjectHelios,代码行数:9,代码来源:CameraJPEGServer.py

示例2: CameraJPEGServer

# 需要导入模块: from Camera import Camera [as 别名]
# 或者: from Camera.Camera import start [as 别名]
class CameraJPEGServer(HTTPServer):
    cameraStore = None
    camera = None
    def __init__(self, *args, **kw):
            HTTPServer.__init__(self, *args, **kw)
    	    self.camera = Camera()
	    self.camera.start()
开发者ID:StevenVanAcker,项目名称:ProjectHelios,代码行数:9,代码来源:CameraJPEGServer.py

示例3: main

# 需要导入模块: from Camera import Camera [as 别名]
# 或者: from Camera.Camera import start [as 别名]
def main():
    global x, y, run
    x = y = 0
    run = True

    pi = pigpio.pi()

    motorx = Motor(pi,1)
    motory = Motor(pi,2)

    sampling_period = 0.2

    control = Controller(pi, motorx, motory, sampling_period)

    camera = Camera(sampling_period)

    camera.start()
    #control.start()

    control.generate_transform()
    control.target((0,0))
    time.sleep(1)

    #t = threading.Thread(target=read_input)
    #t.start()

    #obj = Identification()

    try:
        while True:
            ##### Test without the camera #####
            #x = float(input("x: "))
            #y = float(input("y: "))
            #obj.position = (x,y)
            #control.update_positions(obj, camera.laser)
            ############################################

            control.target(camera.object.position)
            time.sleep(sampling_period)
    except(KeyboardInterrupt):
        pass
    finally:
        run = False
        control.stop()
        camera.stop()

        pi.stop()
开发者ID:danielmundi,项目名称:laser-tracking,代码行数:49,代码来源:track.py

示例4: __init__

# 需要导入模块: from Camera import Camera [as 别名]
# 或者: from Camera.Camera import start [as 别名]
class Space:
    def __init__(self):
        self.q_mode_camera = Queue.Queue()
        self.q_mode_com_device = Queue.Queue()
        self.q_com_device_out = Queue.Queue()

        self.camera = Camera(self.q_mode_camera)
        self.gps_logger = ComDevice(self.q_mode_com_device, self.q_com_device_out)
        self.running = True

    def set_mode(self, mode):
        print("Setting mode " + mode)
        self.q_mode_camera.put(mode)
        self.q_mode_com_device.put(mode)

    def shutdown(self):
        self.running = False
        self.set_mode("EXIT")
        print("All shut down")

    def run(self):

        self.gps_logger.start()
        self.camera.start()

        try:
            self.set_mode("Mode 1")
            time.sleep(100)
            self.set_mode("Mode 2")

            while self.running:
                try:
                    msg = self.q_com_device_out.get_nowait()
                    if msg == "Mode 3":
                        self.set_mode("Mode 3")
                    if msg == "Mode 4":
                        self.set_mode("Mode 4")
                    if msg == "Mode 5":
                        self.set_mode("Mode 5")
                except Queue.Empty:
                    None

                time.sleep(1)

        except KeyboardInterrupt:
            self.shutdown()
开发者ID:tobiasterstad,项目名称:space,代码行数:48,代码来源:space.py

示例5: main

# 需要导入模块: from Camera import Camera [as 别名]
# 或者: from Camera.Camera import start [as 别名]
def main():
	# Camera setup
	camera_stack = []
	camera_n = Semaphore(0)
	camera_s = Semaphore(1)
	cameras = Camera(camera_stack, camera_n, camera_s)

	# Start the thread
	cameras.start()
	
	# Try to pull from the stack every 1 second and print data
	for i in range(0, 10):
		time.sleep(1)
		camera_n.acquire()
		camera_s.acquire()
		left_lines = camera_stack.pop()
		right_lines = camera_stack.pop()
		camera_s.release()
		
		print(i)
		if right_lines != None:
			for line in right_lines:
				for rho, theta in line:
					print(rho, theta)
		else:
			print("No right lines")
			
		if left_lines != None:
			for line in left_lines:
				for rho, theta in line:
					print(rho, theta)
		else:
			print("No left lines")
	
	# Stop camera thread and wait for it to finish
	cameras.stop()
	cameras.join()
开发者ID:Harry73,项目名称:IGVC2017,代码行数:39,代码来源:camera_test.py

示例6: HeliosController

# 需要导入模块: from Camera import Camera [as 别名]
# 或者: from Camera.Camera import start [as 别名]
class HeliosController(Observable):
    md = None
    ds = None
    acl = None
    cam = None
    status = {}

    def __init__(self, conffile):
        Observable.__init__(self)
	cp = ConfigParser()
	cp.read(conffile)

	if not Globals.globSimulate:
	    wiringpi.wiringPiSetupGpio()

	self.md = MotorDriver([
		    cp.getint("MotorDriver", "LEFT_L"),
		    cp.getint("MotorDriver", "LEFT_R"),
		    cp.getint("MotorDriver", "RIGHT_L"),
		    cp.getint("MotorDriver", "RIGHT_R"),
		    cp.getint("MotorDriver", "VERTICAL_L"),
		    cp.getint("MotorDriver", "VERTICAL_R"),
		    ])
	self.md.start()

	self.ds = DistanceSensor(
		    cp.getint("DistanceSensor", "TRIGGER"),
		    cp.getint("DistanceSensor", "ECHO")
		    )
	self.ds.start()

	self.acl = AltitudeControlLoop(self.md, self.ds)

	self.update("MotorDriver", self.md)
	self.update("DistanceSensor", self.ds)
	self.update("AltitudeControlLoop", self.acl)

	self.md.subscribe(self.update)
	self.ds.subscribe(self.update)
	self.acl.subscribe(self.update)

	self.setCamera(False)
	#self.acl.debug = True
	#self.md.debug = True

    def shutdown(self):
	self.md.shutdown()
	self.md.join()
	self.ds.shutdown()
	self.ds.join()
	self.setCamera(False)

    def turnLeft(self):
        self.md.turnLeft()
    def turnRight(self):
        self.md.turnRight()

    def forward(self):
        self.md.forward()
    def backward(self):
        self.md.backward()
    def up(self):
        self.md.up()
    def down(self):
        self.md.down()

    def setSpeed(self, val):
    	self.md.setSpeed(val)
    def setAuto(self, val):
    	self.acl.setAuto(val)
    def setHeight(self, val):
    	self.acl.setHeight(val)
    def setForceDescent(self, val):
        self.acl.setForceDescent(val)
    def setSingleSteerMode(self, val):
    	self.md.setSingleSteerMode(val)

    def setCamera(self, val):
	if self.cam == None:
	    if val:
		print "HeliosController enabling camera"
		self.cam = Camera()
		self.cam.subscribe(self.updateImage)
		self.cam.start()
	    else:
		print "HeliosController tried to disable camera, but is not active"
	else:
	    if val:
		print "HeliosController tried to enable camera, but is already active"
	    else:
		print "HeliosController disabling camera"
		self.cam.shutdown()
		self.cam.join()
		self.cam = None
		self.status["cameraImage"] = "data:image/jpeg;base64," + base64.b64encode(open("nocam.jpg","rb").read())

	self.status["cameraActive"] = True if self.cam != None else False
	self.emit("HeliosController", self)

    def updateImage(self, id, cam):
#.........这里部分代码省略.........
开发者ID:StevenVanAcker,项目名称:ProjectHelios,代码行数:103,代码来源:HeliosController.py

示例7: main

# 需要导入模块: from Camera import Camera [as 别名]
# 或者: from Camera.Camera import start [as 别名]
def main():
	logger.debug("Starting TCNJ IGVC 2017")
	logger.debug("Getting USB device mappings")
	device_to_path = get_device_paths()

	# GPS setup
	logger.debug("Beginning GPS setup")
	gps_coords_stack = Manager().list()
	gps_n = Semaphore(0)
	gps_s = Semaphore(1)
	gps_sensor = GPS(gps_coords_stack, gps_n, gps_s, device_to_path["GPS"])
	logger.debug("GPS setup complete")

	# LiDAR setup
	logger.debug("Beginning LiDAR setup")
	lidar_data_stack = Manager().list()
	lidar_n = Semaphore(0)
	lidar_s = Semaphore(1)
	lidar_sensor = LIDAR(lidar_data_stack, lidar_n, lidar_s, device_to_path["LIDAR"])
	logger.debug("LiDAR setup complete")

	# Camera setup
	logger.debug("Beginning camera setup")
	camera_lines_stack = Manager().list()
	camera_n = Semaphore(0)
	camera_s = Semaphore(1)
	camera_controller = Camera(camera_lines_stack, camera_n, camera_s, device_to_path["RIGHT_CAM"], device_to_path["LEFT_CAM"])
	logger.debug("Camera setup complete")

	# Compass setup
	logger.debug("Beginning compass setup")
	compass_stack = Manager().list()
	compass_n = Semaphore(0)
	compass_s = Semaphore(1)
	compass = Compass(compass_stack, compass_n, compass_s)
	logger.debug("Compass setup complete")

	# Wrap all the sensors' stacks and semaphores into 1 object
	sensors = Sensors(
		gps_coords_stack, gps_n, gps_s,
		lidar_data_stack, lidar_n, lidar_s,
		camera_lines_stack, camera_n, camera_s,
		compass_stack, compass_n, compass_s
	)

	# Start the sensor processes
	logger.debug("Setup complete")
	logger.debug("Starting GPS process")
	gps_sensor.start()
	logger.debug("Startting LiDAR process")
	lidar_sensor.start()
	logger.debug("Starting camera process")
	camera_controller.start();
	logger.debug("Starting compass process")
	compass.start();


	# Set up wiringpi2 and GPIO pin 6 as input
	logger.debug("Sensor process started, waiting for motors to turn on")
	motors_on_pin = 6
	wpi.wiringPiSetup()
	wpi.pinMode(motors_on_pin, 0)

	# Wait for motor controller to be turned on
	motors_on = False
	while not motors_on:
		value = wpi.digitalRead(motors_on_pin)
		if value == 1:
			motors_on = True
		else:
			time.sleep(1)

	logger.debug("Motors are on, begin autonomous navigation")
	path_find = Avoidance(sensors)
	path_find.start()

	time.sleep(10)

	# Stop the processes
	logger.debug("Calling for processes to stop")
	path_find.stop()
	time.sleep(1)
	gps_sensor.stop()
	lidar_sensor.stop()
	camera_controller.stop()
	compass.stop()

	# Clean up the processes
	logger.debug("Waiting for processes to end")
	path_find.join()
	gps_sensor.join()
	lidar_sensor.join()
	camera_controller.join()
	compass.join()

	print("--------------- CAMERA STACK ---------------")
	print(camera_lines_stack)
	print("--------------- GPS STACK ---------------")
	print(gps_coords_stack)
	print("--------------- LIDAR STACK ---------------")
#.........这里部分代码省略.........
开发者ID:Harry73,项目名称:IGVC2017,代码行数:103,代码来源:Driver.py


注:本文中的Camera.Camera.start方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。