Implementation
Hardware
Hardware
The only hardware we used was a suction gripper for Baxter and a large checkers set.
Assembly
Assembly
Set up with checkers set placed before the Baxter robot's right hand.
Required components:
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
Code Implementation
Full code available on GitHub here!
Launch File
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
Message Types
BoardCalibration
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
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
Main Files
game.py
game.py
- This is the main logic file which contains the CheckerBoard object and publishes messages
Main Flow:
- Initialization: game node, human_moves publisher, robot_moves publisher, board_calibration publisher, CheckerBoard object
- Move Baxter to calibrate and publish calibration positions
- Repeat until game ends:
- Check whose turn it is
- If human's turn, wait until move is detected and publish the human's move
- 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
- Check whose turn it is
move_baxter.py
move_baxter.py
- This is the main movement file for Baxter
Main Flow:
- Initialization: movement node, tf listener, right_arm MoveGroup, left_arm MoveGroup, suction Gripper, robot_moves subscriber, board_calibration subscriber
- Callback for robot_moves
- When a new robot move is published, determine the real (x, y, z) coordinates from the received CheckersMove message and move Baxter there
- Use 2-part trajectory to make move
- Callback for board_calibration
- Update upper_left and lower_right real (x, y, z) coordinates
- Callback for robot_moves
Helper Files
Helper Files
ik.py
ik.py
- This file gives the helper functions for calculating Baxter's moves
arthur.py
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
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:
Complete Game System Steps:
- Baxter uses camera to calibrate the board and calculates the position of each piece
- Repeat until game ends:
- Baxter uses the algorithmic portion to decide its move
- Baxter makes move using two-step pickup and place with inverse kinematics in planning portion
- Human opponent makes a move
- Baxter uses camera to detect human move with sensing portion
- Baxter updates its algorithm
- Report the game's winner