Exemple #1
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
Exemple #2
0
    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()
Exemple #3
0
 def move_four_corners(self, pause_second=5):
     target_cells = ['A1', 'A19', 'T1', 'T19']
     for this_cell in target_cells:
         cell = ChessboardCell()
         cell.from_name(this_cell)
         target_FK = self.__chessboard_helper.get_interpolated_FK_from_cell(
             cell)
         self.__move_to_FK_Position(target_FK)
         rospy.sleep(pause_second)
Exemple #4
0
 def play(self, cell_name, color_code):
     # print('[Info] ChessBoard.play(cell_name=%s,color=%s)' %(cell_name,color))
     cell = ChessboardCell()
     cell.from_name(cell_name)
     # value = self.__BLANK
     # if color =='Black':
     #     value = self._BLACK
     # elif color == 'White':
     #     value = self._WHITE
     # else:
     #     logging.info('ChessBoard.play(cell_name=%s,color=%s)' %(cell_name,color))
     self._layout_array[cell.col_id][cell.row_id] = color_code
Exemple #5
0
 def set_cell_value_from_name(self, cell_name, new_value):
     cell = ChessboardCell()
     cell.from_name(cell_name)
     self.set_cell_value(cell.col_id, cell.row_id, new_value)