# The Solver Log

## 2/12/16

After going through the proposal with Deko, we uploaded the proposal to the wiki page. Our mechanical design prototype is almost done. We have learned that the Raspberry Pi works with Python so we just have to learn how the GUI for the Raspberry Pi operates.

## 2/19/16

Due to a misunderstanding in the Gantt chart as far as the dates being the start of the week versus the end of the week, I (Jordan) had to do two weeks worth of work. Oscar also has decided to do two weeks worth of work while Alex has decided to shorten a different task by a week to make up for this mistake.

Solving Algorithm Resources: Rubix PyCuber

Oscar: I have spent this week primarily learning the ropes of Raspberry Pi in order to understand how we will use it in the project. I have watched a variety of tutorials online and have tinkered with the Pi in order to learn my way around. I have also spent time refreshing my knowledge on Python as it will be the language we will program everything in. Jordan and I have found a variety source codes to use as a guide for our own solving algorithm. We were able to download two main ones, one specifically that recognizes the position of the cube and then tells you the steps needed on how to solve it. We both realized we can use it to come up with a way to convert the text of steps into commands to the motors used to turn the cube. I have also started to dig into how I will tackle the color recognition part of the project. The main potential obstacle will be having the Pi able to distinguish between certain colors from the pixels. A solution could be to have the cube well lit so the camera can be consistent with its detection of specific colors. The camera can then take the middle pixel of each square on each side of the cube and then convert that to RGB values. As soon as the budget is cleared, I can begin to use the camera to test this method.

Alex: This week has been spent finishing the CAD files and finalizing the final parts list. Earlier in the week, I printed the gripper I created in inventor and powered it with a personal micro servo, which seems like it will work. This week as well had some design changes, with the decision to switch from stepper motors to servos due to the fact the gripper servo wires prevent continuous rotation anyways and the control circuitry to power the stepper motors while keeping within the budget. Now that we have switched over, a lot of the mounts now have to be redesigned. Still to finish with the CAD this weekend is to redesign the gripper base to accomodate the servo mounts instead of the stepper mounts as well as design a camera mount and a holder for the Pi. We should be able to start printing all the parts on Monday.

## 2/26/16

Jordan:

• Command Prompt gave an error, and even with debugging, the error would not go away
• Found a new Solving Algorithm called pycuber
• Pycuber
• Successfully downloaded pycuber straight onto the Raspberry Pi with little issue
• Tested the Solving Algoithm
• Pycuber displays a grid of numbers detailing the colors on each cubie
• Used the Python Shell to solve the given cube and output a list of moves it took to solve the cube
• Complications this week
• Needing to share the Raspberry Pi with Oscar
• Having an issue with 90% of the solving algorithms I tried to use
• Inputting a specific cube into the program instead of a random cube

Oscar:

• Will be used to allow the raspberry pi recognize different colors and sides of the cube efficiently.
• Began looking at more implementations of color recognition using an arducam
• Will try to use the camera to track colors on a side of the cube and save the configuration of each side of the cube
• If tracking fails, will focus on taking a picture and using the pixels to determine the colors.
• Complicatons:
• Not having the Raspberry Pi when needed due to having to share.
• Parts came in two days ago so no physical trials could be done until late in the week.
• Configuring OpenCV to run on the Raspberry Pi

Alex:

• Purchased parts
• Modified the CAD files to accommodate the dimensions of parts
• Printed the third iteration of the gripper and integrated the parts into it. After a few more alterations to the files, we should be ready to print everything.
• Complications
• Parts got here Wednesday, so I wasn't able to get the necessary dimensions until then.
• Print failed first time.
• I don't have any #5 Machine screws yet to assemble the grippers.
• The microservos don't come with enough screws to mount them so I will need to get some or find another way to mount the gear to the servo.

## 3/4/16

Jordan:

• Discovered a way to input a set of cubies into the solving algorithm by looking into the code a little deeper
• Downloaded all the necessary programs onto the raspberry pi to control the motors used for the Solver
• i2c-tools
• python-smbus
• Found some examples in which the Raspberry Pi is used to control motors that I will base my work off of

Oscar:

• Testing of the camera has commenced.
• Started tinkering with the openCV library
• Started planning how to write code to accurately recognize colors
• K-Means algorithm
• Converting RGB to HSV
• Complications:
• Minor issue getting the openCV library to run

## 3/11/16-Spring Break

Jordan:

• Wrote a program that takes in a move and moves the motors in the right way to turn the rubik's cube
• Still need to
• Write the class to grab/release the servos
• Import the list of moves and do them one by one

Oscar:

• Reinstalled OpenCV after complications with importing it.
• Looked into getting the camera to recognize different color values.

## 3/25/16

Jordan:

• Discussed details of vertical and horizontal positions of the servos with Alex
• Alex will now work on finding the exact positions so that we can rotate the cube efficiently
• Wrote code to take the list of moves and do them one by one

Oscar:

• Code written for recognizing color from an existing photo
• Does not completely work, need to configure it to better mesh with our current setup
• More research being done into how to better execute the code and make sure the camera recognizes the right colors

## 4/1/16

Jordan:

• Basically finished the Motor Control
• Adjusted all of the horizontal and vertical positions on the servos with Alex
• Spent a lot of time checking each position using a sample python code

Oscar:

• Created code that should be able to recognize the colors on the squares of a cube face.
• Camera takes pictures of cube face and selects pixels in each of the 9 squares on the face.
• Code reads the colors RGB values of the pixels, passes the values through conditionals and assigns the square an integer corresponding to its likely color.
• Integers stored in cube face object and code repeats for each face.
• Issues include dealing with the light in the room and the consistency of recognizing the right colors. Will probably decide to use HSV later on. The position of the cube in the frame is something that needs to be fixed. Holding physical trials when the motors and grippers are completed will help with this issue.

## 4/8/16

Jordan:

• Touched up the Motor Control
• Discussed dividing up the code with Oscar

Oscar:

• Figured out better ranges of values for each color
• Discussed using an algorithm to help recognize the colors instead of a template

## 4/15/16

Jordan:

• Wrote some code for Oscar's color algorithm