Implementation of an autonomous chess playing

1 downloads 0 Views 613KB Size Report
into Matlab, in order to enable the industrial robot counter the human ... The communication between the main ... Computer Vision System Toolbox in Matlab.
Paper ID 50

The 2nd International Conference on Engineering Science and Innovative Technology (ESIT 2016), Phuket, Thailand, April 21 – 23 2016

Implementation of an autonomous chess playing industrial robot, with the RoBO-2L Interface Jens Golz1, Arno Bergmann1 and Rolf Biesenbach1,*

Abstract This paper demonstrates, based on a chess playing industrial robot, the extended purpose of a common 6-DOF industrial robot, by using a sensor-guided interface to an external PC with the mathematical software MATLAB. Due to the reason of making the robot capable to play autonomous chess with a human entity, manufactures foreign hard/software got integrated. In order to the robot detects the human players move automatically, a webcam is installed which analyzes the checkerboard after the opposites move. So that no manual (keyboard-) input is necessary. One major task of this project was that the program is runnable on the actual KUKA KRC4 robot controller. Therefore the new interface “RoBO-2L”, developed by the Department for Electrical Engineering and Computer Science of the Bochum University of Applied Sciences has to be used. Within this paper two more demo-applications will be introduced. These demo-applications should help to understand the functions for Image Processing and controlling the robot.

Keywords: RoBO-2L, KUKA, MATLAB, industrial robot, Human Machine Interaction, autonomous chess playing robot.

1 Faculty *

of Electrical Engineering and Computer Science, Bochum University of Applied Sciences , Bochum, Germany,

Corresponding author, E-mail: [email protected], [email protected]

1

Paper ID 50

The 2nd International Conference on Engineering Science and Innovative Technology (ESIT 2016), Phuket, Thailand, April 21 – 23 2016

1. Introduction

2. Software Components 2.1 RoBO-2L

A lot of manufactures of industrial robots are restricted in their range of supported hard- and software. In first

RoBO-2L is a sensor-guided Matlab interface, which

order to guarantee safety and protection for the operator

communicates to the robot controller via UDP/IP. Unlike

and in second order, it costs a lot of money and time to

the common programming, the used Robot Sensor

implement and check hard- and software under industrial

Interface (RSI) controls the robot by regulating the

conditions. But especially in the research field, low-cost

manipulators velocity, - not the location coordinates. So

solutions are very important. The use of the Matlab

the known position control functions (PTP, LIN, CIRC) had

Toolbox ‘RoBO-2L’ enables the user to control the robots

to be implemented. The UDP/IP connection between the

motions from the Matlab environment. One benefit of

robot controller and an external pc is established as a

Matlab is that this software already supports a high range

direct connection. The toolbox offers the needed functions

of hard- and software components and opens the

to control the robot motions according to the chess

integration of manufacturer unsupported hard- / software

application.

with additional software bridges. By using such a software bridge, the chess engine “STOCKFISH” has been integrated

2.2 Stockfish

into Matlab, in order to enable the industrial robot counter

Chess engines are programs, which calculate chess

the human entities chess move.

moves but, they usually do not have an own Graphical User Interface (GUI). Stockfish[2] is an Open-Source chess engine and subjects to the GNU General Public Licens (GPL)[3] and therefore it is freely available and distributable. The communication between the main application, in this case Matlab, and the chess engine follows the Universal Chess Interface (UCI) protocol. So first a kind of opening protocol have to be passed. Then the done chess moves will be given to the chess engine and in the end it returns the ‘next best move’ the opponent can do. In order to have a consistent designation for the chess moves the algebraic chess notation (ACN)[6] is followed. ACN is the most commonly used method for recording the moves of a chess game. ACN is an easy readable kind of notation because it is not necessary to name the moved piece in every move. The given biuniqueness between the last known checkerboard state and the coordinates of the affected fields are sufficient to recreate the done move. The eight columns of the checker board get named with a – h

Fig. 1 Integration Schematic

and the eight rows get called with 1 -8 as seen in Fig. 2.

2

Paper ID 50

The 2nd International Conference on Engineering Science and Innovative Technology (ESIT 2016), Phuket, Thailand, April 21 – 23 2016

In order to solve this problem and reduce the computing capacity a snap shot of the checkerboard has to be made before and after the human player has moved his chess figure and then build the composite of both pictures to analyze the differences. To prepare the taken pictures as described the Matlab function imfuse(imageA,imageB)[5] is used. This function builds the composite of two pictures, by gray scaling the whole picture and coloring the differences in green and magenta. Whether the differences become green or magenta depends on if the affected area changed from dark to light or vice versa. So the output of the imfusefunction is gray picture with colored blobs, to find the

Fig. 2 Algebraic chess notation

centroids of those blobs the two color planes, green and red, get examined individually.

3. Particular description

Fig.2 shows an example of this procedure with the red

The main problem, implementation of an autonomous

layer of such a fused image. Due to the reason that the

chess playing industrial robot, can be splitted into three

vision.BlobAnalysis is just able to detect white blobs on a

sub-partitions. Image Processing, Logic Processing and

black background the image had to be prepared once more

Robot Motion. These are also the next Headlines. Two

as follows. Every pixel below a specific brightness

additional examples inside of Image Processing and Robot

threshold had to be colored into black and every pixel

Motion will show the benefits of Matlab and RoBO-2L.

above the brightness threshold had to be colored into white. After this the vision.Blobanalysis function could be

3.1. Image Processing

used and it delivers the centroid of each blob. By using a

In this project two public image processing algorithms

simple pixel interpreter the pixel coordinates could be

are used, in the main application the Blob Analysis[4] and

translated into ACN coordinates. The gained information

in the Demo application the SURF feature detection.

will be analyzed in the Logic Processing part.

3.1.1 Vision Blob Analysis The vision.BlobAnalysis-Function is a part of the Computer Vision System Toolbox in Matlab. The main purpose of the function is to detect white blobs on a black background. Due to the biuniqueness of the CAN it is not necessary to recognize the moved pieces. So that the needed information by the camera is reduced to the coordinates of the moved pieces.

3

Paper ID 50

The 2nd International Conference on Engineering Science and Innovative Technology (ESIT 2016), Phuket, Thailand, April 21 – 23 2016

Fig.4 SURF-Feature detection The algorithm finds those features and the object is tracked. The negatives of this function are that it take a lot of computing capacity and there are several problems to solve if multiple objects are in the same picture. Fig. 5 shows the detected object and the calculated direction vector for the robot.

Fig.3 Image Processing Function 3.1.2 Demo Camera detectSURFfeatures To gain experience with the use of Image Processing combined with the RoBO-2L interface, another application was created. The goal was to mount a webcam at the gripper of the robot and make the robot track a specific object. If the tracked object has a unique color, compared to

the

background,

it

is

possible

to

use

Fig.5 Camera Application original image

the

vision.BlobAnalysis again. But in this case it should be

3.2 Logic Processing

possible to track any known object. The SURF-Feature method [7] is used. SURF means Speeded Up Robust

Before the gained ACN informations about the players

Features, it’s a Matlab own term. Robust features are areas

move can be transmitted to the chess engine they have to

inside

in

be checked. First must be checked whether the move has

recognizability. Every object in every picture got those

the correct order, because the vision algorithm just get

SURF-Features. So the picture of the sought object get

the information about which fields got played and not in

examined for those SURF-Features as seen in Fig. 4 and

which order the move is done. Next it has to be checked if

compare it with the webcam image.

the human player moved a correct piece especially if he

pictures

which

are

of

high

interest

4

Paper ID 50

The 2nd International Conference on Engineering Science and Innovative Technology (ESIT 2016), Phuket, Thailand, April 21 – 23 2016

4 Conclusion and Future Work

moved it correctly according to the chess rules.[8] Therefore, each figure got its own set of mathematical expressions for a legal move. Additionally for these pieces which move along a line, like the bishop for

By using a communication toolbox to connect a KUKA

example, it had to be checked that there is no other piece

robot controller with Matlab a program has been

on this line. If the human player made a correct move, the

implemented which allows the robot arm to play chess

information will be transmitted to a C#-Application

against a human being. A webcam and a chess engine got

which communicates to the Stockfish chess engine. The

integrated, into the Matlab program, for making the robot

calculated counter move will be given to the robot motion

recognize the human player’s move and calculate the next

part.

best move to win the game. An important part of the program is the algorithm that checks if the turn, the human player made, conforms to the chess rules. This has been

3.3 Robot Motion

realized with multiple functions which includes the

To calculate the desired moves von ACN into Cartesian

mathematical expressions of each legal move. The

coordinates, two informations are needed. The width and

connection between the chess engine and Matlab was

height of a checker-field and any position on the

realized by a C# application. This application reduces the

checkerboard in Cartesian coordinates. In this case the size

communication to Matlab on the transfer of the coordinate

of the fields is 55*55mm and the position A8 is known. The

movements and communicates to the chess engine

easiest way to handle the robots arm movements and the

according to the UCI protocol [10].

pick and place procedures is to use the RoBO-2L functions

This kind of application has multiple benefits, in first order

lin(point) and setGripper(state).

it proves the possibilities for research and education by combining the standard tool Matlab with an industrial

3.3.1 Demo Gamepad

robot, in second order the chance for students to gain

To demonstrate the different kind of moving possibilities

experience in controlling robots and use image processing

inside of the running program an Xbox Gamepad is installed at

and as third point if all safety functions given by the

the remote PC, in order to control the robot motions. Unlike the

original robot controller and by RoBO-2L are used it is a

common

nice exhibit for Human Machine Interaction.

programming

language,

the

RoBO-2L

main

movement corresponds to a velocity control, and not a location

The main purpose of this paper is to show the possibilities

control. So that the provided direction vector of the gamepads

for research and education to open the Human Machine

analog sticks [9] will be directly given to the RoBO-2L by

Interaction to a wide range of users.

setting the target velocities for each direction. The short cycle time and velocity control enables that the robot can be controlled

with

direct-transmitted

continuous

motions,

without any delay.

5

Paper ID 50

The 2nd International Conference on Engineering Science and Innovative Technology (ESIT 2016), Phuket, Thailand, April 21 – 23 2016

[5] Mathworks

Fig. 6 Full Function Block diagram

Inc.

2015.

[Online:] www. mathworks.com/help/vision/ref/vision.blobanalysis-

5. Reference

class.html

Considered Literature and visited websites, which

[6] Toolbox, Mathworks Inc.. “Matlab® Image Processing Toolbox description and examples” Mathworks Inc.: 2015 [Online:] www.mathworks.com/products/image/index.html?refresh =true&s_tid=gn_loc_drop [7] Wikimedia Foundation, “Chess notation”, Wikipedia: 2015 [Online:] https://en.wikipedia.org/wiki/Chess_notation [8] Toolbox, Mathworks Inc. “Matlab® Detect SURF features

helped to solve the different tasks of this project are the followings: [1] J. Golz, R. Biesenbach. “Implementation of an autonomous chess playing industrial robot”, Research and Education in

and return SURFPoints object”. Mathworks Inc. 2015

Mechatronics 11/2015.

[Online:]

[2] Tord Romstad, Macro Costalbam and Joona Kiiski, “Stockfish –

Open-Source

Chess

Engiune”,

http://de.mathworks.com/help/vision/ref/detectsurffeatur

2015.

es.html

[Online:] www,stockfishchess.org

[9] Salen, Katie, and Eric Zimmerman. „Rules of play: Game

[3] License, GNU-General Public, “GNU-General Public License Version

design fundamentals”. MIT press, 2004.

3”:2007.

[10] Wikimedia Foundation, “Analog Stick”, Wikipedia 2015.

[Online:] www.gnu.org/licenses/gpl-3.0.en.html

[Online:] en.wikipedia.org/wiki/analog_stick

[4] Toolbox, Mathworks Inc. “Matlab® Computer Vision System

[11] Stefan Meyer-Kahlen, Rudolf Huber. „UCI Schach Engine

Toolbox, vision.Blobanalysis description and examples”,

Protocol“.

Shredder

Chess.

2015.

http://www.shredderchess.de/download.html

6

[Online:]

Suggest Documents