Example #1
0
class first_center(Task):
    def on_first_run(self, results):
        self.update_data(results)

        path_found = self.path_results.visible > 0

        self.centered_checker = ConsistencyCheck(8, 10)

        self.center = DownwardTarget(
            lambda self=self:
            (self.path_results.center_x, self.path_results.center_y),
            target=(0, 0),
            deadband=(.05, .05),
            px=0.5,
            py=0.5,
            dx=0.02,
            dy=0.02,
            valid=path_found)

    def on_run(self, results):
        self.update_data(results)
        self.center()

        # if not check_seen(results):
        #     self.finish(success=False)
        if self.centered_checker.check(self.center.finished):
            self.center.stop()
            self.finish()
Example #2
0
class center(Task):
    def update_data(self):
        self.pipe_results = shm.pipe_results.get()

    def on_first_run(self):
        self.update_data()

        pipe_found = self.pipe_results.heuristic_score > 0

        self.centered_checker = ConsistencyCheck(8, 10)

        self.center = DownwardTarget(
            lambda self=self:
            (self.pipe_results.center_x, self.pipe_results.center_y),
            target=get_downward_camera_center,
            deadband=(30, 30),
            px=0.002,
            py=0.002,
            dx=0.002,
            dy=0.002,
            valid=pipe_found)
        #self.logi("Beginning to center on the pipe")

    def on_run(self):
        self.update_data()
        self.center()
        #self.logi("Results Y: {}".format(str(self.pipe_results.center_y)))
        #self.logi("Center: {}".format(str(get_downward_camera_center()[1])))

        if not check_seen():
            self.finish(success=False)

        if self.centered_checker.check(self.center.finished):
            self.center.stop()
            self.finish()
Example #3
0
class center(Task):
    def update_data(self):
        self.pipe_results = shm.pipe_results.get()

    def on_first_run(self):
        self.update_data()

        pipe_found = self.pipe_results.heuristic_score > 0

        self.centered_checker = ConsistencyCheck(18, 20)

        self.center = DownwardTarget(lambda self=self:
                                     (self.pipe_results.center_x * 100, self.
                                      pipe_results.center_y * 100),
                                     target=(0, 0),
                                     deadband=(4, 4),
                                     px=0.03,
                                     py=0.03,
                                     dx=0.01,
                                     dy=0.01,
                                     valid=pipe_found)
        self.logi("Beginning to center on the pipe")

        self.logi("Pipe center" + str(self.pipe_results.center_x) + " " +
                  str(self.pipe_results.center_y))

    def on_run(self):
        self.update_data()
        self.center()

        if self.centered_checker.check(self.center.finished):
            self.center.stop()
            self.finish()
Example #4
0
class center(Task):
    def update_data(self):
        self.pipe_results = shm.pipe_results.get()

    def on_first_run(self):
        self.update_data()

        pipe_found = self.pipe_results.heuristic_score > 0

        self.centered_checker = ConsistencyCheck(18, 20)

        self.center = DownwardTarget(lambda self=self: (self.pipe_results.center_x, self.pipe_results.center_y),
                                     target=lambda self=self: get_camera_center(self.pipe_results),
                                     deadband=(30,30), px=0.003, py=0.003, dx=0.001, dy=0.001,
                                     valid=pipe_found)
        self.logi("Beginning to center on the pipe")

    def on_run(self):
        self.update_data()
        self.center()

        if self.centered_checker.check(self.center.finished):
            self.center.stop()
            self.finish()