Yoorae’s Status Report for 10/30

This week, in a team meeting with Tamal and professor Bryon on Monday, professor has pointed out the edge cases that I have missed for the chess game logic. To update the Chess game logic to take account of every possible edge cases that are possible, I researched the chess rules in depth and I made an update on the struct of board state to return the location of each piece name and the piece color to take account of every possible edge cases in the chess game. The board state struct will also contain an int counter to take account of number of turns that have been played, to check the allowed moves for pawn. This will make the check valid process a bit slower, but it is necessary to correctly process many edge cases in the chess game such as  ‘en passant’ state of the pawns and ‘castling’ state (in which two pieces can move in one turn).

 

I also wrote test benches to check the correctness of my current structure. The current test bench consists of 50 general moves, and each special move per edge case. My logic is currently returning a 100% correctness according to the test bench results.

Team’s Status Report for 10/30

This week, we continued to work on the three main areas of our project. Creating our custom chessboard, detecting moves with CV, and implementing the chess logic to check for valid moves. We are still working individually but am starting to think about integration on what information needs to be communicated between different modules.

There was one challenge regarding the sample chessboard for CV testing. Working with two chessboards did not work out as well as we expected. The sample chessboard was supposed to be taped together because gluing takes a long time. However, it was difficult to keep the pieces together with tape, and the gaps between pieces made edge detection hard. To mitigate this challenge, we decided to keep the main chessboard in the lab instead of having it in Demi’s apartment for the rest of the semester. Until this week, we mostly worked remotely in our apartments, but from now on we plan to work together in the lab with the main board.

There are no major changes made to our schedule.

Demi’s Status Report for 10/30

This week, I mainly worked on making the case for the chessboard. I chose to use cardboard for the first prototype because cardboard is cheap and easy to cut and drill. I created dxf files using SolidWorks and went to Tech Spark to laser cut them. I also finished gluing the chessboard top, ordered a push button, and connected the LEDs to the RPi and tested controlling the LEDs using the NeoPixel library.

Below is an image of the grids and case glued together with the chessboard on top. The grids are used to separate the light from one LED to other LEDs to ensure that only the correct squares light up. The grids have small holes on the bottom to allow the LED strips to go through. I still have to make the top cover of the electronic case and install the LEDs and push button.

      

Next week’s goal is to have the full 8×8 LED matrix installed under the board. This will require cutting the LED strip into 64 LEDs and soldering them together. I will test the LEDs lighting up correctly given a coordinate. I will also install the push button once it arrives.

Anoushka’s status report for 10/30

This week I spent time gluing and taping the sample chessboard pieces Demi gave me. This took a significant amount of time because I had to remove the wraps and place the pieces properly so there aren’t gaps between them which would make CV hard.

I also tested my algorithm on images of the actual chessboard that Demi sent me. Attached is an image of the results. The first is the original image, the second is with Canny edge detection. The third one contains blue lines which are the slope 0 or infinity lines in the Hough transform. The yellow color on the squares indicates that these are the squares that have been formed by the line. This works as intended.

Another thing I worked on was ensuring that the pieces are detected properly and the contrast is high enough in our board. This worked fine, but I had to ensure that I use the unblurred image for this because otherwise some of the edges don’t remain sharp anymore. I use the blurred for detecting squares so that the image is less noisy, but the pieces are sometimes considered noise. This result is with the unblurred image. All pieces are detected. The actual edges detected don’t matter in our case, we just want to ensure some edges are detected for each piece.

Because Demi has the board I was unable to test on it with actual pieces, but I have been tested on my imperfect sample board. The sample board is harder to work with because the best pieces were picked for the main board so the ones for the sample board aren’t cut as properly.

I wasn’t able to deliver the test metrics on the actual board because I don’t have it yet. I already talked to Byron and Tamal about this and we decided I would give the chess pieces to Demi and ask her to take pictures because she has the board. On Monday, I will give the pieces to Demi. I am also requesting her to bring the board on Monday so I am able to get some time with it on campus and get the pictures I need.

This week, I plan on forming metrics for the actual chessboard on Monday. I am one day behind schedule, but will be caught up on beginning of next week.

After that, I plan to figure how to get the metrics higher if needed and determine if we need any minimum lighting requirements. I will also look into the metric regarding how “inside” a square a piece needs to be to be detected properly.  This is a problem with the corners of the board because the tall pieces often have edges outside of the square due to the fact that we are looking top-down. I will look into ways to mitigate this.

 

Team Status Report for 10/23

Lask week, our group spent most  of our time on writing our Design report. We updated our Gantt chart to make updates on changes of current schedule. Anoushka worked on introduction, design requirements, CV trade studies, and CV system description. Demi worked on Architecture, LED trade studies, and hardware system description. Yoorae helped Anoushka on design requirements, and wrote trade studies for AI engine, Project management, and ethical issues sections. We met on Thursday night last weekend to combine our work and finalize our design reports. This week, we discussed ethical issues on Monday to prepare for ethics discussion and ethics assignment for our project. We have concluded that our major goal of the project was to create leisure activity for people who enjoy chess but who are not very familiar with technology by eliminating any software interactions from user’s point of view, but can cause ethical harm by creating more social isolation since our project does not provide any user to user interaction.

 

One of the most significant risks still remains the accuracy of the CV. This is being managed by ensuring that the board does not have any qualities that would make detection harder. For example, Anoushka found that even slight irregularities on a square can cause issues. We are ensuring that the board does not have any of these. In terms of contingency plans, the main one is to ensure that the user has a way of telling us the detection is wrong. This took some planning to ensure that the game doesn’t become unplayable, but we got help from professors and TA. We decided to light up LEDs to display the detected move and provide the user with a button to press if the detection is wrong. There were no changes to the system diagram after the design report.

 

Updated Gantt Schedule:

 

Demi’s Status Report for 10/23

10/10-16
I mainly worked on the design document. I created a system diagram to illustrate the overall flow of our project and recreated the block diagram. I also wrote the requirements section for LEDs and trade study sections for LEDs and board integration.

10/17-23
Earlier this week, I laser cut the squares for the second chessboard. Due to time and cost constraints, the plan is to only make one complete chessboard with the LEDs and push button installed. The second chessboard will just be the chessboard top without any LEDs, to allow Anoushka and Yoorae to test CV while I make the main chessboard.

The weld-on glue has arrived, so I have started gluing the squares. As of 10:30 pm, I have been able to glue 24 squares. The gluing part is taking longer than expected. The initial bond forms within a few minutes, and I have to hold the pieces together during this 2-3 minute period before moving on to the next piece. My goal is to finish welding all 64 squares by Sunday night. Due to time constraint, for the sample chessboard, instead of using glue, I will use tape to hold the pieces together.

I have set up the Raspberry Pi. There was an issue at the beginning. When I connected the RPi for the first time, I got a missing HDMI output message on the monitor. I tried every solution on the internet but could not solve it. As a last resort, I decided to use a different SD card to see if the SD card was the issue. I formatted and installed NOOBS on the new card and was able to see a signal on the monitor. I have installed the NeoPixel library for the LEDs. Because of the initial SD card error, I was not able to test the LEDs with the RPi yet.

Next week, I am planning to connect the LEDs to the RPi and test them. I will also laser cut the internals of the chessboard for the LED matrix. Lastly, I am going to place an order for the wooden sheets and push button.

Anoushka’s status report for 10/23

The week of 10/16 I mostly worked on the design report. I wrote the introduction, the design requirements (move detection), architecture overview, design trade studies for computer vision (edge detection and piece vs change detection) and system description (Move detection). I also worked on a flowchart representing that CV pipeline. This took a considerable amount of time because there were a lot of cases to consider and it still had to be as readable as possible.

I also spent time coming up with more design requirements that would help us measure the performance of the Computer Vision. For example, how far can the center of the piece be from the center of the square and still be detected correctly? 

I spent a lot more time on the design report that I had predicted, and spent most of week 10/23 trying to catch up on the actual project.

I spent the first 2 days trying to figure out the detected lines (grid) in the input image once we have detected edges. A picture is attached below of the input image and the detected lines that correctly form the grid.

 

 

The way I did this was first applying the hough transform and then iterating through the peaks. The peaks were of the form (angle, dist), and I got the coordinates of the point by:

 (x0, y0) = dist * np.array([np.cos(angle), np.sin(angle)])

The slope of the line is the tangent of the angle. 

Once I had this, I found the intersection points of these lines with either y=0 (for the vertical lines) and x=0 (for the horizontal lines). Then, for each vertical line I iterated through all the horizontal lines and formed rectangles with the coordinates:

 

[[this_line, this_hor_line], [next_line, this_hor_line],

        [this_line, next_hor_line], [next_line, next_hor_line]]

 

Here this_line is the x axis intersection of the current vertical line and next_line is the next one. 

Similarly, this_horizontal_line is the y intersection of the current horizontal line (as we iterate through the lines) and next_hor_line the next one.

One tricky part was ensuring that we didn’t end up with extra lines towards the left  and right due to the edge of the chessboard being taken as an edge. We corrected for this in the following way:

  1. finding the middle 2 vertical lines and calculating the gap between them
  2. Go left and right from each of these 2 lines and +- the gap to get all the other lines. 
  3. Stop when enough lines have been placed to ensure the edge of the board or any noise does not affect the output.

 

Once I had that working, I began work on actually determining the move. Once we had the grid, this surprisingly wasn’t as hard to implement. I did the following:

  1. Iterate through each rectangle
  2. Get the edges inside the square
  3. Apply the logic of the flowchart above

 

One issue I had however is that the chessboard I am testing on had a few lines on the square due to the pictures being of  wooden chessboard. This is because the 64 squares we are making aren’t ready yet (we have 32). However, I confirmed with Demi that this will not be a problem for us because we don’t use wood and our pieces are smooth. 

Now that I have most of the harder things working, I am going to test on the chessboard we purchased. From preliminary testing, this seems to be working a lot easier than on my original chessboard picture because it doesn’t have the wood problem. This is what I plan to do this week. Yoorae will be helping out as well as CV is a shared task due to complexity.

I’m behind schedule but I am confident I will catch up this week. Most of this was due to not allocating enough time for the design review. However, I have also been doing the “optimizing for speed” thing in parallel, so that is not a different task anymore. This week, I will be working on completing move detection and being ready to test when Demi finishes the board. 

I updated the Gantt chart for myself to allow more time for move detection. I was expected to be done with it last week, but I have updated that to finish this week instead. The color for 11/1 is just for testing on the actual chessboard because I have to wait for Demi to finish it.  

 

I plan to catch up by day 1-2 this week. I have also been doing some work on figuring out how we will integrate with Stockfish (eg how the moves will be sent to it), and that integration seems fairly simple. There shouldn’t be too many complex tasks left after this week. 

 

Deliverable: Completed move detection, tested on at least the sample chess board. If I get the actual chessboard, I will also test on that. I will also calculate metrics such as accuracy, distance from the center etc., as described in the design report. I am to have preliminary testing reports out this week.

 

 

 

 

 

Yoorae’s Status Report for 10/23

Last week I have spent most of my time on lab hours for writing Design Review Report. The portion I was responsible for was any part that was related to integration of Stockfish Engine of the project. I was also responsible for writing project management portion (including schedule, team member responsibilities, budget, and risk management), related ethical issues, and related work.

I have also finalized the chess logic algorithm that returns boolean values on whether player has made a valid move or not. Since every chess piece has different allowed movements, I have created a class for each chess piece. The main function ‘validate’ will be inputed the current board state, chess piece type,  and a new location that user has indicated. The original state of selected piece (before movement) will be reachable in a board class that is passed into the function. If the movement is validated from the piece class as a possible movement, the function will return a tuple of new coordinates for the piece, else, it will return Null and the function will return false.

 

I am also working on a transition function for Chess AI integration. Anoushka has updated coordinate algorithm from CV edge detection, which has to be translated to be computed with bit boards in Stockfish engine.

From next week, I will be working with Anoushka with the  background subtraction algorithm to help her with updating board states.

Yoorae’s Status Report for 10/9

This week I spent most of my time practicing for Design Review presentation. I practiced speaking with my teammates and practiced answering possible questions that can be asked to me. I also started writing Design Review Report, and wrote a code in C that can detect any illegal moves in Chess.

Demi’s Status Report for 10/9

This week I laser cut the chessboard squares and handed it over to Anoushka for CV testing. Once the acrylic weld-on arrives, I will glue the squares together. I decided that it would be convenient to have two sets of chessboard. In that way we can work in parallel, building the chessboard and testing with CV, so I ordered another pair of green and white acrylic sheets. I also made orders for the WS2812B 30 pixels/m LEDS, 5V 10A power supply, and acrylic weld-on and picked up the Raspberry Pi which we borrowed from the capstone inventory.

I have researched how the WS2812B LED strips are connected and controlled by RPi. I will be using the rpi_ws281x library. From our proposal presentation, we got feedback on how we will be controlling 64 LEDs with the limited number of pins on the RPi. I looked into it and concluded that we only need one GPIO pin since there is only one data line for the WS2812B LED strip.

I am on track schedule wise. I now have most of the parts needed for creating the board and have finalized the details of the design. I plan on to work on the design report early on next week. For the rest of the week, I will test the LEDs with the RPi and make an additional chessboard.