Esempio n. 1
0
    def station_center(self):
        self.shared["autoMotor"] = True

        self.regulate()

        package = se.detect_package(*self.shared["distance"])

        front_values = self.shared["lineSensor"][:]
        center_values = self.shared["middleSensor"][:]

        self.linedet.add_values(front_values, center_values)

        front_station = self.linedet.station_front()
        center_station = self.linedet.station_center()

        if center_station == se.NO_STATION:
            log.info("Leaving center station.")
            self.refresh_flush_timer()
            self.change_state(LINE)
        elif front_station != se.NO_STATION:
            front_obj = Station.create(front_station, package)
            log.info("Found front station with empty=%s and left=%s." %(str(front_obj.is_empty()), str(front_obj.is_left())))
            self.station_queue.append(front_obj)
            log.info([str(e) for e in self.station_queue])
            self.change_state(STATION_BOTH)
Esempio n. 2
0
    def line(self):
        self.shared["autoMotor"] = True

        if self.should_flush() and self.station_queue:
            self.flush_station_queue()
            return

        self.regulate()

        package = se.detect_package(*self.shared["distance"])

        front_values = self.shared["lineSensor"][:]
        center_values = self.shared["middleSensor"][:]

        self.linedet.add_values(front_values, center_values)

        front_station = self.linedet.station_front()
        center_station = self.linedet.station_center()

        if front_station != se.NO_STATION:
            front_obj = Station.create(front_station, package)
            log.info("Found front station with empty=%s and left=%s." %(str(front_obj.is_empty()), str(front_obj.is_left())))
            self.station_queue.append(front_obj)
            log.info([str(e) for e in self.station_queue])
            self.change_state(STATION_FRONT)
        elif center_station != se.NO_STATION:
            self.handle_center_station()