コード例 #1
0
ファイル: IK_calibrator.py プロジェクト: voicevon/gogame_bot
    def move_row_by_row(self,
                        start_cell_name='T1',
                        step=1,
                        is_upper_letter=True):
        cell = ChessboardCell()
        cell.from_name(start_cell_name)
        start_cell_id = cell.id
        for index in range(start_cell_id, 361, step):
            if index % 19 == 0:
                # change postion to new row
                cell.from_id(180)
                temp_FK = self.__chessboard_helper.get_interpolated_FK_from_cell(
                    cell)
                self.__move_to_FK_Position(temp_FK)
            cell.from_id(index)
            print(cell.to_diction())
            target_FK = self.__chessboard_helper.get_interpolated_FK_from_cell(
                cell)
            if is_upper_letter:
                self.__robot.current_pose.name = cell.name.upper()
                target_FK.z = 0.001
            else:
                self.__robot.current_pose.name = cell.name.lower()
                target_FK.z = 0.098

            self.__move_to_FK_Position(target_FK)
            rospy.sleep(10)
            self.__robot.update_current_pose_to_diction()
            self.__robot.write_pose_diction_to_json_file()
コード例 #2
0
    def test_pickup_from_warehouse(self, auto_pause):
        self.__robot.eye_open('origin')
        # self.__robot.eye_open('candy')

        for i in range(0, 360):
            self.__robot.action_pickup_chess_from_warehouse()
            this_cell = ChessboardCell()
            this_cell.from_id(i)
            self.__robot.action_place_chess_to_a_cell(this_cell.name)

        if auto_pause:
            key = click.getchar()
            if key == '\x1b':
                #Escape
                zero = self.__robot.get_target_pose_by_name('ZERO')
                self.__robot.goto_here(zero)
                print('You can shout down the power now.')
                key = click.getchar()
コード例 #3
0
    def test_row_by_row(self, start_cell_name):
        self.__robot.eye_open('origin')
        first_cell = ChessboardCell()
        first_cell.from_name(start_cell_name)
        second_cell = ChessboardCell()
        # pickup from warehouse, the first one
        self.__robot.action_pickup_chess_from_warehouse()
        self.__robot.action_place_chess_to_a_cell(first_cell.name)

        # pickup from warehouse, the second one
        self.__robot.action_pickup_chess_from_warehouse()
        second_cell.from_id(first_cell.id + 1)
        self.__robot.action_place_chess_to_a_cell(second_cell.name)

        for i in range(first_cell.row_id * 19, 361):
            this_cell = ChessboardCell()
            this_cell.from_id(i)
            next_cell = ChessboardCell()
            next_cell.from_id(i + 2)
            print('******************************* %s' % this_cell.name)
            print('******************************* %s' % next_cell.name)
            self.__robot.action_pickup_chess_from_a_cell(this_cell.name)
            self.__robot.action_place_chess_to_a_cell(next_cell.name)

            if self.__last_pressed_key == '\x1b':  #Esc
                self.__robot.eef_sleep()
                zero = self.__robot.get_target_pose_by_name('ZERO')
                self.__robot.goto_here(zero)
                return
コード例 #4
0
    def test_col_by_col(self, start_col):
        self.__robot.eye_open('origin')
        self.__robot.action_pickup_chess_from_warehouse()
        self.__robot.action_place_chess_to_a_cell('A' + str(start_col))
        self.__robot.action_pickup_chess_from_warehouse()
        self.__robot.action_place_chess_to_a_cell('B' + str(start_col))

        for iCol in range(0, 19):
            for iRow in range(start_col, 19):
                this_cell = ChessboardCell()
                this_cell.from_id(iRow * 19 + iCol)
                next_cell = ChessboardCell()
                next_cell.from_id(iRow * 19 + iCol)
                print('******************************* %s' % this_cell.name)
                print('******************************* %s' % next_cell.name)
                self.__robot.action_pickup_chess_from_a_cell(this_cell.name)
                self.__robot.action_place_chess_to_a_cell(next_cell.name)

                if self.__last_pressed_key == '\x1b':  #Esc
                    self.__robot.eef_sleep()
                    zero = self.__robot.get_target_pose_by_name('ZERO')
                    self.__robot.goto_here(zero)
                    return