Close

Speaking Chess: Building the Language of Robot Chess Intelligence

A project log for ChessMate - ROS2 Chess Robot

An AI chess master with expressive eyes, custom electronics, and a precision arm that will checkmate you with style!

vipin-mVipin M 07/02/2025 at 04:430 Comments

Established the fundamental ROS 2 communication interfaces that form the backbone of ChessMate’s distributed intelligence system. This work focused on creating standardized message definitions, service interfaces, and action specifications that enable seamless communication between all system components.

Custom Message Package Creation

Packagechessmate_msgs

Successfully created and configured the core message package with proper ROS 2 structure:

Chess Game Message Definitions

Core Chess Messages

// ChessMove.msg - Standardized chess move representation
string from_square     # e.g., "e2"
string to_square       # e.g., "e4"  string piece_type      # "pawn", "rook", "knight", "bishop", "queen", "king"
string move_type       # "normal", "castle", "en_passant", "promotion"
string promotion_piece # For pawn promotion (optional, empty if not promotion)
bool is_capture        # True if move captures opponent piece
float32 confidence     # AI confidence in move (0.0-1.0)
int64 timestamp        # Move timestamp (nanoseconds)
// ChessPiece.msg - Individual piece representation
string color      # "white", "black", or "empty"
string type       # "pawn", "rook", "knight", "bishop", "queen", "king", or "none"
bool has_moved    # For castling/en passant logic
int32 square_id   # 0-63 representing a1-h8 (optional, for board representation)
// BoardState.msg - Complete chess board representation
ChessPiece[64] squares    # Array representing 8x8 board (a1=0, b1=1, ..., h8=63)
string active_color       # "white" or "black"
string castling_rights    # "KQkq" format
string en_passant_target  # Square name or "-" if no en passant possible
int32 halfmove_clock     # Moves since last capture/pawn move (for 50-move rule)
int32 fullmove_number    # Game move counter
string fen_string        # Full FEN representation for validation
int64 timestamp          # Board state timestamp

Robot Control Message Definitions

Hardware Interface Messages

// GripperCommand.msg - End effector control
string action        # "open", "close", "grip_piece", "release_piece"
float32 force_limit  # Maximum grip force (Newtons, 0.0 = no limit)
float32 timeout      # Command timeout (seconds)
bool gentle_mode     # True for delicate piece handling
// RobotStatus.msg - System health monitoring
string state           # "idle", "moving", "gripping", "error", "calibrating"
geometry_msgs/Pose current_pose
sensor_msgs/JointState joint_states
string[] active_warnings
string[] error_messages
float32 battery_voltage  # For future wireless operation (0.0 if N/A)
bool gripper_has_piece   # True if gripper is holding a piece
int64 timestamp          # Status timestamp

Service Interface Definitions

Kinematics Services

// ForwardKinematics.srv - Joint angles to Cartesian position
# Request
float64[3] joint_angles    # [theta1, theta2, z] in radians/meters
---
# Response
geometry_msgs/Pose end_effector_pose
bool success
string message
// InverseKinematics.srv - Cartesian position to joint angles
# Request
geometry_msgs/Pose target_pose
float64[3] seed_angles     # Initial guess for solver (optional)
---
# Response
float64[3] joint_angles    # Solution angles [theta1, theta2, z]
bool success
string message
float64 solution_quality   # Metric for solution optimality (0.0-1.0)
// ChessSquareKinematics.srv - Chess-specific positioning
# Request
string square_name         # "a1" through "h8"
float32 piece_height      # Height above board (mm)
string approach_direction # "top", "side" for collision avoidance
---
# Response
geometry_msgs/Pose target_pose
float64[3] joint_angles
bool success
string message

Action Interface Definition

Complex Multi-Step Operations

// ExecuteChessMove.action - Complete move execution
# Goal
ChessMove move
bool animate_move          # Show intermediate positions
float32 move_speed        # Speed multiplier (0.1-2.0, 1.0 = normal)
---
# Result
bool success
string completion_message
float32 execution_time
ChessMove executed_move    # Echo of the move that was executed
---
# Feedback
string current_phase      # "approaching", "gripping", "lifting", "moving", "placing", "complete"
float32 progress_percent  # 0.0-100.0
geometry_msgs/Pose current_pose
string status_message     # Human-readable status

Build System Integration

Package Configuration

Build Verification

# Successfully generated all interfaces:
chessmate_msgs/msg/BoardState
chessmate_msgs/msg/ChessMove
chessmate_msgs/msg/ChessPiece
chessmate_msgs/msg/GripperCommand
chessmate_msgs/msg/RobotStatus
chessmate_msgs/srv/ChessSquareKinematics
chessmate_msgs/srv/ForwardKinematics
chessmate_msgs/srv/InverseKinematics
chessmate_msgs/action/ExecuteChessMove

Interface Testing & Validation

Message Structure Verification

Architecture Benefits

Completion Status

✅ Completed

Discussions