Skip to content
Martin Repvik Olsbø edited this page Aug 26, 2024 · 9 revisions

Ur5ChessBot

Welcome

Welcome to the new and improved Ur5ChessBot Wiki. The original wiki by Jo Martin Slåtten for the Western University Of applied Science (HVL) you can find at Jo Martin's original wiki page. You can also find the old README and the old project at Jo Martin's webpage.

This project performed by Martin Repvik Olsbø and Jobjørn Røkenes Myren for HVL is dedicated to further improve on the Ur5 chess playing program. Our main goal for the project is to develop a graphical user interface (GUI) for the robot, to display settings and controls for the user. We also have some sub goals to fix the remaining functionalities for the robot (en passent, piece capturing, castling, and pawn promotion), design some kind of safe grip to soften and steady the grip on each piece, and maybe create some kind of captured piece basket or board and layouts to store pieces that might need to be reused for pawn promotions.

This page will act as a documentation of our work where we are going to write down the process. If you wish to know more about how to use it, use the local README page.

Gripper

For the gripper design we planned some back and forth. We had ideas of some fork or hook like gripper claws, that would hook on to the socket of the chess piece, or som other edges on the different pieces. We also thought up some kind of part rubber part PLA grip, that would have the rubber (soft) part pointing towards the piece, and the PLA part as a supporting and socket for the rubber. This way we could make the contact sides of the gripper long and consistent, which made it into some kind of universal grip for all the pieces. This in turn made it so that we did not have to make different grip poses for each unique piece on the chess board. We made the grip out of solid plastics PLA and rubber, but for the part of rubber it might also be even better to use some kind of sponge like material to grip the pieces with. This would make the grip able to pick up any piece shapes and in any rotation.

After this process, we decided to put the gripper design on hold, to focus more on the coding part of the project.

Program and code

The code exists now of 2 programs. One server side written in Python handling the Game environment, and one client side written in React to create a graphical User Interface (GUI). In the following list below, we have put the docstrings of the python file and a small description of the GUI, to help you easier understand what they are and how you can use them.

  • GUI:

  • Python:

    • Settings

      This file contains the settings for the project. It only mostly contains mostly preset constants and configurations and some auto configurated constants, on startup.

    • ToolCenterPoint

      Tool Center Point (TCP) class, for use with a UR5Robot. [INFO]: A TCP, is a point in space deffined by 6 values for 3 dimentions. The 3 first numbers describes the location of the point in a 3D space (x, y, z) and the remaining 3 describes the orientation of the point in a 3D space (rx, ry, rz)

      Fields:
      • TCP: List of floating points of length 6, containing the TCP.
      Constructor:
      • __init__(self, [x, y, z, rx, ry, rz])
      Functions:
      • Position(self):

        Returns the 3 first values determening the TCP location in a list.

      • Orientation(self):

        Returns the 3 last values determening the TCP orientation in a list.

      Examples
      Simple use:
      from ToolCenterPoint import ToolCenterPoint as TCP
      
      x, y, z = 0.5, 0, 0.25
      rx, ry, rz = 0.1, 0, 0.3
      
      point = TCP([x, y, z, rx, ry, rz])
      
      position = point.position()
      orientation = point.orientation()
      
      Used with ur_rtde:
      import rtde_control
      import rtde_recieve
      from ToolCenterPoint import ToolCenterPoint as TCP
      
      ur5RobotsIpAdress = '172.31.1.144'
      control = rtde_control.RTDEControlInterface(ur5RobotsIpAdress)
      info = rtde_receive.RTDEReceiveInterface(ur5RobotsIpAdress)
      
      x, y, z = 0.5, 0, 0.25
      rx, ry, rz = 0.1, 0, 0.3
      oldPos = TCP(info.getActualTCPPose())
      newPos = TCP([x, y, z, rx, ry, rz])
      
      control.moveL(newPos.TCP)`
      
    • UR5Feature

      A class for handling a UR5Robottic feature. [INFO]: A feature is in our case a coordinate system offset from the coordinate system relative to the base. The feature can help you calculate different points relative to your own coordinate systems instead of relative to the robot base. This helps in cases of which you might have to re orient your program or robot as the physical problem gets moved.

      Note:

      The orientation of the feature is saved by the origin TCP, so you will have to orient the Origin TCP accordingly. This is supposed to be calculated differently but it will have to be changed in the future if possible. The calculation is possible, however the people involved in making this file, was not able to calculate it.

      Fields:
      • Origin: The tool center point of the physical origin for the feature, NB (CONTAINS THE FEATURE ORIENTATION!!!).
      • XAxis: The tool center point defining the orientation of the X axis.
      • XYPlane: The tool center point defining the orientation of the XY plane.
      • XAxis: The X axis vector.
      • YAxis: The Y axis vector.
      • ZAxis: The Z axis vector.
      Constructor:
      • __init__(self, origin: TCP, xAxis: TCP, xyPlane: TCP)
      Methodes:
      • getNewTCPByXYZMove(self, currentTCP: TCP, x: float, y: float, z: float) -> TCP:

        Returns the new TCP, moved by x, y, and z in their x, y and z directions relative to the current TCP.

      • getFeatureRelativeTCP(self, x: float, y: float, z: float) -> TCP:

        Returns the new TCP at the coordinates x, y, and z relative to the local origin.

    • UR5Robot:

      UR5Robot class for some simpler work with a UR5Robot playing chess. This class is just meant to store the settings of a robot, as well as the different interfaces in a single object. By doing this we get to create robotic moves by defining the basic movements Goto, Grab, and Dropp, and then combining these basic movements to create movements of our chess needs.

      Fields:
      • travelHeight: The height the robot needs to move to avoid piece collision while moving pieces.

      • homePose: A predefined position for the robot to go to and stop in while not doing anything.

      • connectionIP: The UR5Robots IP address, for connection of the different interfaces.

      • acceleration: The UR5Robots movement acceleration.

      • speed: The UR5Robots movement speed.

      • gripperSpeed: The UR5Robots gripper speed.

      • gripperForce: The UR5Robots gripper force.

      • control: Interface for driving the robot.

      • info: Interface for getting current information about the robot.

      • gripper: Interface for driving the robot's gripper.

      Constructor:
      `__init__(self, travelHeight: float, conectionIP: str, gripperForce: float, gripperSpeed: float, speed: float, acceleration: float)`
      
      Methodes:
      • getPos(self):

        Let's you move the robot arm to a desired location and returns the pose of that location when confirmed.

      • freeDrive(self):

        Let's you move the robot freely until you confirm the position. (To move the robot away).

      Basic movement:
      • goto(self, pos: "list[float]"):

        Moves the robot to the specified position.

      • grab(self):

        Makes the robot gripper close.

      • drop(self):

        Makes the robot gripper open.

      Combined movement:
      • home(self):

        Moves the robot to the predefined home pose.

      • movePiece(self, fromPos: "list[float]", toPos: "list[float]", home = True):

        Moves a chess piece form a specified location to another specified location and returns the robot to the home stance if home = True.

      • capturePiece(self, fromPos: "list[float]", toPos: "list[float]", capturePos: "list[float]"):

        Captures a piece to the capture pos and move the piece from and to the specified positions.

      • enPassent(self, fromPos: "list[float]", toPos: "list[float]", targetPos: "list[float]", capturePos: "list[float]"):

        Performs an "en passent" move, by from and to poses, a target pose and a capture pose.

      • castle(self, fromPosKing: "list[float]", toPosKing: "list[float]", fromPosRook: "list[float]", toPosRook: "list[float]"):

        Performs a casteling move by two sets of from and to poses.

      • promotion(self, fromPos: "list[float]", toPos: "list[float]"):

        Captures a pawn for promotion and requests the user to place down the required piece.

      • capturePromotion(self, fromPos: "list[float]", toPos: "list[float]", capturePos: "list[float]"):

        Captures a pawn and an opponent piece and requests the user to place down the required piece.

    • DGTBoard:

      A class only for handling the DGT board, and its streams.

      Fields:
      • loop: asynchronous loop that runs the "dgtSocket" handlers.
      • dgtConnection: the asynchronous connection to the "dgtBoard".
      Constructor:
      • __init__(self, port: str = "/dev/ttyACM*")
      Methodes:
      • getCurentBoard(self) -> str:

        returns a string representation of the current board in a 15 x 8 size, (15 because of a space " " between each square).