Git Product home page Git Product logo

chess-robot's Introduction

LSS Chess Robot

The LSS Chess Robot is a robotic arm that can play chess against you. This is a free and open source project that integrates aspects of robotics, computer vision, and of course chess.

Table of Contents

Requirements

Hardware

  • Lynxmotion Smart Servo (LSS) 4 DoF Robotic Arm
  • Raspberry Pi or Windows PC
  • Display
  • Keyboard
  • Mouse
  • Camera (USB or Raspberry Pi Camera Module)
  • Lighting
  • Chess board and pieces
  • Speaker or Headphones (Optional)

Software

Modules list

Getting Started

To start using this project, proceed to the standard clone procedure:

cd <some_directory>
git clone https://github.com/Robotics-Technology/Chess-Robot.git

Install

  • On Windows PC
pip install -r requirements.txt
  • On Raspberry Pi
pip3 install -r requirements.txt

If you are using the Raspberry Camera Module

pip3 install "picamera[array]"

Note: To avoid incompatibilities use the versions established in the "requirements", for this it is recommended to use a virtual environment.

If you have issues with OpenCV on the Raspberry Pi try the following commands:

sudo apt-get install libatlas-base-dev
sudo apt-get install libjasper-dev
sudo apt-get install libqtgui4
sudo apt-get install libqt4-test
sudo apt-get install libhdf5-dev 
sudo apt-get install libhdf5-serial-dev
sudo apt-get install python3-pyqt5
sudo apt-get install stockfish
sudo pip3 install opencv-python==3.4.6.27
sudo pip3 install opencv-contrib-python==3.4.6.27

Run

cd <project_directory>
python Interface.py

Chess Robot Interface

Chess Robot Gameplay

Gameplay Video

Authors

License

LSS Chess Robot is available under the GNU General Public License v3.0

Contributing

Anyone is very welcome to contribute. Below is a list of identified improvements.

To do

  • Change the gripper aperture acording to the chess piecce type
  • Allow re-taking pictures in the case of board obstruction

Limitations

  • The chessboard is limited by the reach of the arm and the squares need to be big enough so the arm gripper doesn’t stumble upon adjacent pieces.
  • This project was specifically made to be used with LSS smart servo motors using the LSS serial communication protocol so if you want to use it for a different robotic arm you will need to change how the servos are controlled and change the inverse kinematics parameters to match your specific arm.

Resources

Every module of the project is explained in the tutorial series available here.

Read more about the LSS Robotic Arm in the wiki.

Purchase the LSS arm on RobotShop.

Official Lynxmotion Smart Servo (LSS) libraries for Python available here.

If you want more details about the LSS protocol, go here.

Have any questions? Ask them on the Robotshop Community.

chess-robot's People

Contributors

geraldinebc avatar edgetronics-official avatar dependabot[bot] avatar eduardofna avatar

Stargazers

shiroyasha avatar Chinedu avatar Shankar Ambady avatar Rakshith R avatar  avatar Adam Jimenez avatar SuiFei avatar  avatar Pranav krishna U avatar Elvin Li avatar Jan Bours avatar Kalisetti Nihanth Naidu avatar  avatar Farkad Adnan avatar Alsaady avatar  avatar k10 avatar  avatar Ludovic Delval avatar  avatar João Victor P. B. Avanzini avatar  avatar Craig Vear avatar  avatar

Watchers

James Cloos avatar Kostas Georgiou avatar  avatar  avatar

chess-robot's Issues

Thanks, everything works now

the robot starts moving behind the figures, but is immediately interrupted by an error with the words "O, wait":

  1. MOVE UP
  • Unknown status
  • Unknown status
  • Unknown status
  • Unknown status
  • Unknown status
  • Issue detected
  • Retrying
    ...

Experimentally found out that in the code of the file "ArmControl" :

Check if they reached the requested position

while arrived == False and issue == 0:
bStat= base.GetStatus()
sStat = shoulder.GetStatus()
estate = elbow.GetStatus()
wStat = wrist.GetStatus()
gStat =gripper.GetStatus()

the "bStat" parameter takes the value "None". Maybe something is wrong with the database. What the error might be and how to fix it?

ValueError: math domain error acos()

Hello!
I use your guide to set up and play chess with the LSS 4 Of Robotic Arm robot.
After setting up the chessboard parameters:
Base Radius 9.00
Chess Board Frame 8.00
Square Size 1.00
ChessBoard Height 0.75
Tallest Piece Height 2.25

and calibrating the camera and launching the game - I get an error:

"...
Exception in thread Thread-2 (pcTurn):
Traceback (most recent call last):
File "C:\Users\chepu\AppData\Local\Programs\Python\Python310\lib\threading.py", line 1016, in _bootstrap_inner
self.run()
File "C:\Users\chepu\AppData\Local\Programs\Python\Python310\lib\threading.py", line 953, in run
self._target(*self._args, self._kwargs)
File "C:\LSS_Chess_Robot\Chess-Robot\Interface.py", line 137, in pcTurn
ac.executeMove(sequence["seq"], physicalParams, playerColor, homography, cap, selectedCam)
File "C:\LSS_Chess_Robot\Chess-Robot\ArmControl.py", line 213, in executeMove
angles_BSEWG1 = LSS_IK([x, y, z + 1, gripState])
File "C:\LSS_Chess_Robot\Chess-Robot\ArmControl.py", line 76, in LSS_IK
a2 = acos((d2
2 - d32 + h2)/(2 * d2 * h))
ValueError: math domain error

Incorrect mathematical calculations - the system tries to calculate acos(1.58) and therefore gets an error

Tell me what this could mean and what am I doing wrong?

[Bug] AttributeError: 'LSS' object has no attribute 'setFilterPositionCount'

PS D:\Dev\GitRepo\ChessBotReproduceBug> python .\Interface.py
pygame 2.0.1 (SDL 2.0.14, Python 3.8.3)
Hello from the pygame community. https://www.pygame.org/contribute.html
<_io.TextIOWrapper name='params.txt' mode='r' encoding='cp936'>
Exception in thread Thread-2:
Traceback (most recent call last):
File "D:\ProgramData\Anaconda3\lib\threading.py", line 932, in _bootstrap_inner
self.run()
File "D:\ProgramData\Anaconda3\lib\threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File ".\Interface.py", line 137, in pcTurn
ac.executeMove(sequence["seq"], physicalParams, playerColor, homography, cap, selectedCam)
File "D:\Dev\GitRepo\ChessBotReproduceBug\ArmControl.py", line 200, in executeMove
shoulder.setFilterPositionCount(fpc)
AttributeError: 'LSS' object has no attribute 'setFilterPositionCount'

Reproduce procedure:

  1. Start the robot arm
  2. run "python .Interface.py"
  3. Set "params.txt"
  4. Press "New Game", play as white
  5. Adjust the camera, place pieces, select "white zone"
  6. Human player moves one white piece and ends his turn
  7. The error message comes out

It seems that there is no definition of "setFilterPositionCount" inside "lss.py"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.