Вы находитесь на странице: 1из 11

Solving the Rubiks Cube

Project Description
Your team will be provided with instructions for building the robot shown above, as well as MATLAB code to have it scan a Rubiks cube and generate a solution. Your task will be to write an algorithm to have the robot manipulate the cube to solve it.

Specifications
o Your algorithm should be written in MATLAB code. In addition, you should provide a flowchart describing the algorithm. This can be created with Microsoft Word or PowerPoint, or saved as an Adobe PDF file. o o o To document your development process, your team should create a team project website. Your team will need to provide videos of your robot solving a scrambled Rubiks cube. Finally, you must create a presentation (narrated PowerPoint) describing your project.

Schedule & Deliverables


Flowchart: 9% Create a flowchart for your cube manipulating algorithm. This should be saved as a Word/PowerPoint/PDF file and posted to the Files section of your team project website no later than Tuesday, April 12th at 11:55 PM. Failure to included proper heading information will result in a 10 point (out of the 100 possible points for the flowchart) penalty. Late submissions will be penalized 15 points (out of the 100 possible points for the flowchart) per day, including weekends since submission is electronic. The flowchart portion of the project is worth 9% of the overall project grade.

Source Code: 30% Each program/function must contain: o A standard header including: o o o o Team number First and last names of each team member A problem statement describing the purpose of the code Documentation of all variables used in the code 2

Comments throughout the code

Your source code will be evaluated based on: o o o o Documentation (30%) all code must include adequate header information and comments throughout the source code Reusability (25%) all code repeated frequently throughout your project should appear in well documented functions Specification (25%) all code should meet the project requirements outlined in the project description Efficiency (20%) no extraneous calls to unnecessary functions or other poor software design decisions All programs, functions, and the user manual should be added to a ZIP file and posted to the Files section of your team project website no later than Friday, April 29th at 11:55 PM. Failure to included proper heading information will result in a 10 point (out of the 100 possible points for the source code) penalty. Late submissions will be penalized 15 points (out of the 100 possible points for the source code) per day, including weekends since submission is electronic. The source code portion of the project is worth 30% of the overall project grade.

Project Website: 30% Each team must develop and maintain a project website that contains pages dedicated to: o o o o A home page includes a short blurb about the project Project Definition a description of your project and the task your team must accomplish Team Information an introduction of each team member and description of their role within the team To Do List a continually updated list that includes an owner, description of the item, due data, and status of whether or not that item is complete

Daily Updates a blog update posted MWF by one member of the team that documents the events of meetings, as well as the who, what, and when for each item on the to do list

Weekly Updates a blog update of the big picture of project development. These should be posted by every member of the team by Mondays at 5:00 PM. For this project, there should be at least 3 weekly updates. Each member of the team is required to post a weekly update answering the following questions: o o o o What were the major accomplishments for the team the last week? What does the team plan to accomplish by this Friday? What were the road bumps encountered in the last week and how were these problems solved? What problems are anticipated this week?

o o

Calendar an embedded calendar of relevant due dates for the project, to do items, and group meetings File cabinet at the completion of your project, all of the files associated with the project should be posted in a digital file cabinet. By the end of the project, you should have the following files posted: o o o Source Code all project code, functions, and user manual saved in a ZIP file Flowchart saved in a Word/PowerPoint/PDF file Presentation final narrated presentation saved as either a PowerPoint file or a video

Each team may use the Google Site Project template through their Clemson University Google account (you have one if your email address is ___@g.clemson.edu) or develop your own page from scratch. The site must be secure (only your team and Dr. Bowman should have access to it) and editable by any member of your team. This security is built into Google Sites, but youre free to explore alternatives. For more information on how to set up, use, or share Google Sites or use templates for Google Sites, see the following links: o Google Sites Project Template: http://sites.google.com/site/projectwikitemplate_en/

o o

CCITs TechTalk on Google Sites at Clemson: http://connect.clemson.edu/p33193917/ CCITs TechTalk on Google Site Templates: http://connection.clemson.edu/p21654481/

The project website for you team should be created and shared with all your teammates and the TA, Nick Watts, by Friday, April 8th at 11:55 PM. To grant access to a Google Site, click the More Actions button near the top right of your site and click Manage Site. In the Site Manager interface, click Sharing under the Site Settings category. Add your teammates as collaborators and Nick as a viewer. Send Nicks invitation to nwatts@g.clemson.edu. o o o By Friday, April 8th at 11:55 PM, all of the content areas of your site should be set up By Monday, April 11th at 11:55 PM, your project definition, team information, to do list, time tracker, project updates, and calendar should be populated After April 11th, all content areas should be kept up to date they will be graded at random intervals throughout the project, so it is important that you keep each page up to date Late project updates and failure to maintain the other required pages will reduce your teams overall grade. Your team project page will be evaluated at random intervals throughout the project. The team project website is worth 30% of the overall project.

PowerPoint Presentation / Video: 30% Each team must submit a final presentation, including the following components: o o o Introduction and background on the project Discussion of your teams algorithm Video of your teams robot in action

A PowerPoint presentation using narration should be created to satisfy the requirements above. Information on creating a presentation is given in your

textbook in Section 4.1 and the accompanying online slides discuss narration. The presentation will be graded for neatness, organization, and presentation quality. As an alternative, your team can create a narrated video and submit it in a common video format (AVI, MOV, etc.). Ask your instructor before using a different format. This narrated PowerPoint should last no longer than 5 minutes. The presentation should be uploaded to the Files section of your teams project website no later than Friday, April 29th at 11:55 PM. Late submissions will be penalized 15 points (out of the 100 points possible for the presentation portion) per day, including weekends since submission is electronic. The presentation is worth 30% of the overall project grade.

Peer Evaluation: 1% Each team member must submit a 0 (no participation) to 10 (excellent participation) evaluation rating for his/herself and each member of their team. All peer evaluations are to be completed individually by each team member and should not be discussed among team members. Peer evaluations are kept confidential. You should be honest in your evaluation of yourself and your teammates. Peer evaluations will be available on GEO and will be due May 2nd by 5:00 PM. Completion of this evaluation will be awarded a grade of 0 (did not complete) or 100 (completed). No late submissions will be accepted.

Individual Grade Calculation Your individual grade will be calculated using the following formula: (Flowchart+Source Code+Website+Presentation+Peer Evaluation) * Peer Rating / 10 Only the individual grades will be posted on GEO. Discussion of peer evaluations or individual grades is considered to be a violation of academic integrity, so dont do it.

Required Software

RWTH Mindstorms for MATLAB Toolbox


The functions listed above make use of the RWTH Mindstorms for MATLAB toolbox to control the robot. You will need to download the toolbox from the following site: http://www.mindstorms.rwth-aachen.de/trac/wiki/Download Download the most recent version (4.04). Extract the ZIP file and save the extracted folder somewhere on your computer. That folder will need to be added to your MATLAB path. For more documentation on the RWTH toolbox, see the RWTH site (http://www.mindstorms.rwth-aachen.de/trac/wiki/Documentation) or the lab manual for the ECE section of ENGR 190 (http://www.clemson.edu/ces/departments/ece/undergrad/mindstormslab.html)

Unfortunately, the RWTH toolbox is only compatible with the 32-bit version of MATLAB. If you currently have the 64-bit version, the 32-bit version can be installed side by side. To find out which version you have, go to Help->About in MATLAB.

Additionally, you will need to install the Lego Fantom USB driver. It is available at http://mindstorms.lego.com/en-us/support/files/default.aspx#Driver

Provided Code
You will be provided with MATLAB code for the following functions. These can be downloaded from clemson.edu/ces/departments/ece/undergrad/mindstormslab.html. cubeSolver The main program. initCubeSolver Resets all parts of the robot (color sensor, turn table, and arm) to their starting positions. scanCube Scans each face of the cube with the color sensor. Returns a 6x3x3 cell array containing the color of each square of each face. This function is protected because it contains code for manipulating the cube. correctCube Sometimes, the color sensor incorrectly reads a color. This function opens a GUI that allows you to manually set the color for each square of each face of a cube. Returns a 6x3x3 cell array containing the color of each square of each face. Can also take a 6x3x3 cell array as input to initialize the color of each square in the GUI. solveCube Generates a series of moves to solve the current cube. Takes a 6x3x3 cell array as input and returns a string containing a sequence of faces to turn and the direction to turn them. For example, if solveCube returns L R U D, you would turn the left face clockwise, the right face counterclockwise, the top face counterclockwise, and the bottom face clockwise.

CS_Options Allows ports for motors and sensors to be set. Also allows motor power for cube flipping arm to be changed. doSolution Manipulates the cube to solve it. Contains code for how to split up the string returned by solveCube into steps. As is, it just prints out each step. turnToStop Turns a motor until that motor runs into an obstruction and cannot turn any further. Takes as arguments the motor, direction, and power. Read the comments at the top of the file for more information.

Using the Provided Code The cubeSolver function contains the basic sequence of the program. However, it is incomplete and you will need to add your own code to the doSolution function. The scanCube function will have the robot check each square of each face of the cube with the color sensor. It is important to call initCubeSolver before calling scanCube, as the movement of the color sensor depends on it starting at the position that initCubeSolver leaves it in. The scanCube function finishes with the cube and color sensor in the same positions as they started. Also, the color sensor does not distinguish between red and orange. To get around this, if it detects a square as being red, it will switch from color mode to a light intensity mode. This allows it to (sometimes) tell the difference between the brighter orange and the darker red. However, it needs some reference measurements to know how bright each color is. Thus, the first time per MATLAB session that you call scanCube, it will require you to calibrate the sensor. It will prompt you to place the cube on the turntable so that the face with the red/orange center is pointed up and then it will scan the center square of that face. It stores the measured values in

global variables so that they can be accessed later on while scanning the other squares. Still, the colors read may not be 100% accurate, especially the oranges/reds. Thus, the correctCube function opens up a GUI that allows you to manually set the color of each square on the cube. The correctCube folder contains the actual figures and code for the GUIS, and the correctCube function just runs either the Windows or Mac version, depending on which type of computer you have. The correctCube function can be used to correct errors made by the scanCube function with the code:
variable = scanCube(); variable = correctCube( variable );

Alternatively, to save time and battery life while testing, you can just use the correctCube function to manually enter the whole cube. Calling correctCube with no input, as below, starts the GUI with every square blank instead of colored in.
variable = correctCube();

If you dont use scanCube while testing, be sure to call initCubeSolver before running your code, as your code must assume that all parts of the robot start in the positions set by initCubeSolver. The solveCube function calls an external program, either solver_win.exe or solver_mac depending on which type of computer you have, to generate a solution. The first time one of these programs is run, it generates an approximately 500 megabyte file to speed up the solving process. Thus, it is recommended that you run the program outside of MATLAB once and wait for it to generate the file and then exit. This will cut way down on the time it takes for solveCube to run the first time. For more information on why this file is required, see http://kociemba.org/cube.htm. The solution generated comes back as a string, with each letter specifying the face to turn. Turns are clockwise unless the letter is followed by an apostrophe, in which case the turn is counterclockwise. For example, if solveCube returns L R U D, you would turn the left face clockwise, the right face counterclockwise, the top face counterclockwise, and the bottom face clockwise. Keep in mind that which face is

10

considered the front/top/left/ is defined by the starting orientation of the cube, not the current orientation. The CS_Options function allows you to change a few parameters used in the given functions without having to access the source code for those functions. First, it allows you to edit the ports used for each motor and the color sensor. This means that you dont have to worry about plugging the cables into the correct ports; you can just define what the correct ports are. Also, it allows you to set the power used for the flipper arm in the scanCube function. You may have to increase the power as the battery charge decreases.

11

Вам также может понравиться