Implementation

Hardware

The only hardware we used was a suction gripper for Baxter and a large checkers set.

Assembly

Set up with checkers set placed before the Baxter robot's right hand.

Required components:

  • Baxter Robot
    • Suction Gripper attached to right hand group
    • Right hand camera turned on
  • Checkers Set
    • Checkers board with AR tags attached to two corners - we attached the checkers mat to a cardboard piece for stability
    • Checkers pieces
    • AR tags attached to the human pieces
  • Table to place checkers set on

Code Implementation

Full code available on GitHub here!

Launch File

  • Launches Rviz with MoveIt Planner in a similar manner to demo_baxter.launch
  • Also starts AR tracking node from ar_track_alvar
    • Sets AR Tag size to 4.0 cm, sets image topic to left_hand_camera/image, and publishes transforms with respect to Baxter's base frame

Message Types

BoardCalibration

  • Contains (x, y, z) coordinates for upper left AR Tag and lower right AR Tag with respect to Baxter's base frame
  • Used to send calibrated values to the file which moves Baxter's arm to the checkers pieces, also enables us to recalibrate anytime if the board moves

CheckersMove

  • Contains (start, end) locations on the board for the move being made by either Baxter or the human
  • Allows algorithm to send message to file which moves Baxter's arm

Main Files

game.py

  • This is the main logic file which contains the CheckerBoard object and publishes messages

Main Flow:

  1. Initialization: game node, human_moves publisher, robot_moves publisher, board_calibration publisher, CheckerBoard object
  2. Move Baxter to calibrate and publish calibration positions
  3. Repeat until game ends:
    1. Check whose turn it is
      1. If human's turn, wait until move is detected and publish the human's move
      2. If Baxter's turn, call the CheckerBoard object to run minimax and find the start and end locations of its next move, then publish this to the topic

move_baxter.py

  • This is the main movement file for Baxter

Main Flow:

  1. Initialization: movement node, tf listener, right_arm MoveGroup, left_arm MoveGroup, suction Gripper, robot_moves subscriber, board_calibration subscriber
    1. Callback for robot_moves
      1. When a new robot move is published, determine the real (x, y, z) coordinates from the received CheckersMove message and move Baxter there
      2. Use 2-part trajectory to make move
    2. Callback for board_calibration
      1. Update upper_left and lower_right real (x, y, z) coordinates

Helper Files

ik.py

  • This file gives the helper functions for calculating Baxter's moves

arthur.py

  • This file provides the agent logic for Arthur Samuel's algorithm

Diagram for the code dependencies. The file game.py publishes the messages /board_calibration and /checker_moves that move_baxter.py subscribes to.

Complete System

The complete system uses sensing, planning, and algorithmic portions to play a game of checkers against a human opponent. The game starts with calibrating the board to locate the positions of each piece and how to move Baxter's pieces. The game then uses two-part moves to play the game.

Complete Game System Steps:

  1. Baxter uses camera to calibrate the board and calculates the position of each piece
  2. Repeat until game ends:
    1. Baxter uses the algorithmic portion to decide its move
    2. Baxter makes move using two-step pickup and place with inverse kinematics in planning portion
    3. Human opponent makes a move
    4. Baxter uses camera to detect human move with sensing portion
    5. Baxter updates its algorithm
  3. Report the game's winner