Пример #1
0
    def __init__(self,
                 width,
                 height,
                 obstacles=(),
                 localino_anchors=[
                     LocalinoAnchor(),
                     LocalinoAnchor(),
                     LocalinoAnchor()
                 ]):
        """Initialize all things present in the environment"""
        self.width = width
        self.height = height

        # Generate Localino Tags
        wheelchair_tag = LocalinoTag()
        person_tag = LocalinoTag()

        # Initialize the physical objects
        self.obstacles = obstacles
        self.person = Person(
            localino_tag=person_tag
        )  # person does not need to know the environment but needs a localino tag
        self.wheelchair = Wheelchair(
            environment=self, localino_tag=wheelchair_tag
        )  # wheelchair's sensors need to know the environement and it contains a localino tag

        # Initialize the services
        self.localino_service = LocalinoService(anchors=localino_anchors,
                                                wheelchair_tag=wheelchair_tag,
                                                person_tag=person_tag)
        self.alexa = Alexa()

        # Initialize the pi
        self.pi = Pi(alexa=self.alexa,
                     lidar=self.wheelchair.lidar,
                     localino=self.localino_service,
                     encoder=self.wheelchair.encoder,
                     berryimu=self.wheelchair.berryimu)

        # Verify that all objects are in a valid position
        if not self.verify():
            print("Invalid Initial State")
Пример #2
0
    os.setpgrp()

    hosts = ['192.168.1.20', '192.168.1.21']
    """ 
        One power strip has ip 192.168.1.20; the other, .21
        x.x.x.20 will control bulbs 0-5
        x.x.x.21 will control bulbs 6-11
    """
    power_strip_on_list = Array('i', 13)

    # Create a "CheckFace" object, in webcam_pulse/lib/check_face_visible.py
    face_check_process = CheckFace(camera_obj=camera_obj)

    # Start a process to request all bulbs to turn off.
    # Pi process defined in control_pi.py
    pi = Pi(hosts=hosts)
    pi.start()
    pi.join()
    # Processes are dead; continue.

    # Use camera to get a pulse from a face
    # Perform this _once_ initially
    pulse_val = 0
    App = getPulseApp(args, camera_obj)

    # Generate a pulse
    while pulse_val == 0 or pulse_val == -1:
        pulse_val = App.main_loop()
        time.sleep(1.0 / 16.0)
        pulse_val = App.bpm